Getting and setting the stock sheet¶
Getting and setting the stock sheet¶
1# This example displays the name of the stock sheet of the
2# active layer (if any). All the stock sheets are then retrieved
3# from the active database, if any are found the stock sheet of the
4# active layer is assigned to the first stock sheet found. Note that
5# the StockSheet property is only applicable to multi up layers.
6
7# Check the active layer is a multi up
8if impact.active_drawing.active_layer.layer_type == "MULTI_UP":
9
10 # Clear the output tool box
11 impact.gui.output_toolbox.clear()
12
13 # Get the stock sheet of the active layer
14 stock_sheet = impact.active_drawing.active_layer.stock_sheet
15
16 # If the active layer has a stock sheet assigned display the name of
17 # it in the output toolbox
18 if not stock_sheet.isNone():
19 impact.gui.output_toolbox.add(stock_sheet.name)
20
21 # Find all the stock sheets
22 settings = impact.active_database.find_master_tool_settings(ipMasterSettingType.mstLayoutMachineSheet)
23
24 # Check the stock sheets were found
25 if not settings.isNone():
26 if settings.count > 0:
27
28 # assign the stock sheet of the active layer to the first setting
29 impact.active_drawing.active_layer.stock_sheet = settings.item(1)
30
31 # display the name of it in the output toolbox
32 impact.gui.output_toolbox.add(impact.active_drawing.active_layer.stock_sheet.name)