Flatten 3D models

Flatten 3D models
 1# This example flattens all the 3d models in all the 3d layers in the active drawing.
 2
 3for layer in impact.active_drawing.layers:
 4    if layer.layer_type == "THREE_D":
 5        scene = layer.scene
 6
 7        if scene is not None:
 8            for instance in scene.instances:
 9                object = instance.object()
10
11                if object is not None:
12                    if object.type == ip3DObjectType.ot3DModel:
13                        model = object
14                        model.flatten()
15
16        else:
17            impact.gui.output_toolbox.add("No 3d scene")