1
0
mirror of https://github.com/nophead/Mendel90.git synced 2025-01-16 20:38:15 +01:00

Update viz.py

This commit is contained in:
theopouris 2022-07-19 18:33:36 +03:00 committed by GitHub
parent a77346794c
commit 517c4b1a99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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