NewLayer Auto-Task

NewLayer Auto-Task
 1# This example shows how to use the 'NewLayer (After)' automation task to determine how a
 2# drawing layer was created.
 3#
 4# It is important to use the IDatabase.auto_task_drawing and IDatabase.auto_task_layer rather than
 5# IDrawings.active_drawing or IDrawing.active_layer
 6#
 7
 8ad = impact.active_database.auto_task_drawing
 9al = impact.active_database.auto_task_layer
10
11s =ad.full_name + "->" + al.full_name + ": " + str(al.entities.count) + " entities."
12
13if al.from_master:
14    ml = al.master_layer
15
16    s =str(s) + " (MASTER: " + str(ml.database_item.reference) + "->" + ml.name + ")"
17
18if al.copied_layer:
19    cl = al.copied_source_layer
20
21    s =str(s) + " (COPIED from " + cl.drawing.full_name + "->" + cl.full_name + ")"
22
23impact.gui.show_message(mt_info, s, None)
24