Deleting IML variables¶
Deleting 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# deletes these old IML variables and re-checks for old IML 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 - Deleting them")
14
15 # Delete the old IML variables
16 ad.variable_settings.delete_iml_variables()
17
18 # Check there are no IML variables left
19 if ad.variable_settings.using_iml_variables:
20
21 # Display a message in the output toolbox
22 impact.gui.output_toolbox.add("Drawing still contains old IML variables")
23
24 else:
25
26 # Display a message in the output toolbox
27 impact.gui.output_toolbox.add("Drawing does not contain old IML variables")
28
29 else:
30
31 # Display a message in the output toolbox
32 impact.gui.output_toolbox.add("Drawing does not contain old IML variables")
33
34else:
35
36 # Display a message in the output toolbox
37 impact.gui.output_toolbox.add("unable to continue: no active drawing")
38