Set 3D Instance Origin¶
Set 3D Instance Origin¶
1# This example sets the origin to a 3D vector (10, 0, 0) to all the 3D instances in each 3D layer in the active drawing
2
3# Create a local variable for the impact.creator ThreeD object
4three_d = impact.creator.three_d()
5
6# Create a translation vector
7vector = three_d.vector3_d(10, 0, 0)
8
9# Create a local variable for the output toolbox
10ot = impact.gui.output_toolbox
11
12for layer in impact.active_drawing.layers:
13 if layer.layer_type == "THREE_D":
14 scene = layer.scene
15
16 if not scene.isNone():
17 for instance in scene.instances:
18 if not instance.isNone():
19
20 # Sets the origin
21 instance.origin = vector
22
23 origin = instance.origin
24
25 # Prints the new origin
26 ot.add(origin.to_string())
27
28 else:
29 ot.add("No 3D scene")
30
31 else:
32 ot.add("No 3D Layer")
33