List 3D Model Layers

List 3D Model Layers
 1# This example lists all the names and GUIDs of the 3d models associated 2d layers.
 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
15                        impact.gui.output_toolbox.add("Model (name, layer name and layer GUID):")
16                        impact.gui.output_toolbox.add(instance.name)
17
18                        layer = model.layer2_d
19
20                        if layer is not None:
21                            impact.gui.output_toolbox.add(layer.full_name)
22                            impact.gui.output_toolbox.add(model.layer_guid2_d)
23
24                        else:
25                            impact.gui.output_toolbox.add("Failed to find the layer associated with this model.")
26
27        else:
28            impact.gui.output_toolbox.add("No 3d scene")