Skip to content

Commit

Permalink
#28 - update render by blender and its test
Browse files Browse the repository at this point in the history
  • Loading branch information
kittlerm authored and kaklik committed Aug 11, 2023
1 parent 98894f5 commit 6333888
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CAD/src/assembly/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 8 additions & 1 deletion CAD/src/build_manual/update_render_src.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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'])

Expand Down Expand Up @@ -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'))

0 comments on commit 6333888

Please sign in to comment.