From 517c4b1a993563989cf26cea42c179a2ff4a8f5a Mon Sep 17 00:00:00 2001 From: theopouris Date: Tue, 19 Jul 2022 18:33:36 +0300 Subject: [PATCH] Update viz.py --- utils/viz.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/viz.py b/utils/viz.py index ab3a23f..b20d82c 100644 --- a/utils/viz.py +++ b/utils/viz.py @@ -23,7 +23,7 @@ def load_stl(file_path): ob = bpy.context.selected_objects[0] print(ob) bpy.ops.object.select_all(action='DESELECT') - ob.select = True + ob.select_set(True) # remove doubles and clean #py.ops.object.editmode_toggle() #bpy.ops.mesh.select_all(action='TOGGLE') @@ -36,7 +36,9 @@ def load_stl(file_path): print(z_dim) filename = file_path.split(os.sep)[-1] if filename in rotations: - bpy.ops.transform.rotate(value = rotations[filename] * math.pi / 180.0, axis = (False, False, True)) + ov=bpy.context.copy() + ov['area']=[a for a in bpy.context.screen.areas if a.type=="VIEW_3D"][0] + bpy.ops.transform.rotate(ov, value = rotations[filename] * math.pi / 180.0, orient_axis = ('Z')) bpy.ops.transform.translate(value=(0,0,z_dim/2.0)) cam_target = (0,0,z_dim/3.0) # assign material