Converting IML variables¶
Converting IML variables¶
1# This example checks whether the active drawing contains any old
2# IML variables and outputs the fact to the output toolbox. It then
3# trys to convert these old IML variables to new project variables
4
5# Create a local variable for the active drawing
6ad = impact.active_drawing
7
8# Check that there is an active drawing
9if not ad.isNone():
10 if ad.variable_settings.using_iml_variables:
11
12 # Display a message in the output toolbox
13 impact.gui.output_toolbox.add("Drawing contains old IML variables")
14
15 if ad.variable_settings.convert_iml_variables():
16
17 # Display a message in the output toolbox
18 impact.gui.output_toolbox.add("Successfully converted old IML variables")
19
20 else:
21
22 # Display a message in the output toolbox
23 impact.gui.output_toolbox.add("Unable to convert old IML variables")
24
25 else:
26
27 # Display a message in the output toolbox
28 impact.gui.output_toolbox.add("Drawing does not contain old IML variables")
29
30else:
31
32 # Display a message in the output toolbox
33 impact.gui.output_toolbox.add("unable to continue: no active drawing")