From 6333888ced62176245ee20425f782a1ea43cafa6 Mon Sep 17 00:00:00 2001 From: Mojmir Kittler Date: Fri, 5 May 2023 00:37:37 +0200 Subject: [PATCH] #28 - update render by blender and its test --- CAD/src/assembly/test/Makefile | 3 ++- CAD/src/build_manual/update_render_src.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CAD/src/assembly/test/Makefile b/CAD/src/assembly/test/Makefile index 4f7ff324..c2c78f03 100644 --- a/CAD/src/assembly/test/Makefile +++ b/CAD/src/assembly/test/Makefile @@ -6,7 +6,8 @@ SRC_DIR=../../../src/assembly/test # GCD_DIR=../../../gcode # INI_DIR=../../../slicing GIT_ROOT=../../../../ -OUTPUT_FOLDER=. +# FIXME: this is due to SRC+OUTPUT is at GIT ROOT +OUTPUT_FOLDER=CAD NAME_PREFIX=TF-G2_assembly PROCESSOR3D_PARAM=--no_gcode --no_amf diff --git a/CAD/src/build_manual/update_render_src.py b/CAD/src/build_manual/update_render_src.py index b1d015fb..9432cc58 100644 --- a/CAD/src/build_manual/update_render_src.py +++ b/CAD/src/build_manual/update_render_src.py @@ -52,6 +52,7 @@ def set_material(object_name, material = "basic_light_gray"): bpy.data.objects[object_name].data.materials.append(mat) def save_blender_file(filename): + print("Saving blender: {}".format(os.path.abspath(filename))) bpy.ops.wm.save_as_mainfile(filepath=filename) def render_png(filename, frame = 0): @@ -83,7 +84,13 @@ def set_camera_position(rotation, translation): part['name'] = part_k if 'stl' in part: + if not os.path.exists(part['stl']): + # FIXME: continue only if config.pedant=False + print("Missing stl file: {}".format(part['stl'])) + continue pass + #TODO: some files are at CAD/stl/ + # this happens if SRC_DIR in makefile is not at level #TODO: check if file is exists and is valid part['stl'] = os.path.abspath(part['stl']) @@ -115,4 +122,4 @@ def set_camera_position(rotation, translation): render_png(render_file) if config.get('save_blend', False): - save_blender_file(os.path.abspath(config_file.split('.')[0]+'.blend')) + save_blender_file(os.path.abspath(config_name+'.blend'))