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