Advanced Standard Options (Python)

Advanced Standard Options (Python)
 1# This example shows how to create a mix/match standard
 2# Including specifying various options for creating the standard
 3
 4# Create a local variable for the output toolbox
 5ot = impact.gui.output_toolbox
 6
 7# Clear the output toolbox
 8ot.clear()  # Create a local variable for the active database
 9db = impact.active_database
10
11# Note: You should always assign impact.active_database.standard_creator
12# to a local variable
13sc = db.standard_creator
14
15# Set the standards to mix and match
16sc.standard = "FEFCO 0201"
17sc.standard2 = "FEFCO 0210"
18
19# Set the material
20sc.material_mts = db.find_master_tool_setting( "Corrugated|B Flute", ipMasterSettingType.mstMaterial )
21
22# Check that the IStandardCreator.create method can be called successfully
23if sc.valid:
24
25    # Add a message to the output toolbox
26    ot.add("Successfully loaded standard: " + sc.description)
27
28    # Set some of the variables
29    sc.variable_settings.variables.item("L").value = 100.00
30    sc.variable_settings.variables.item("W").value = 200.00
31    sc.variable_settings.variables.item("D").value = 150.00
32
33    # Override some options
34    sc.delete_parametric_dimensions = True
35    sc.add_panel_dimensions = True
36    sc.add_overall_dimensions = True
37    sc.dimension_horizontal_position = ipHorzTextPos.htpLeft
38    sc.dimension_vertical_position = ipVertTextPos.vtpTop
39
40    # Create the standard
41    drawing = sc.create()
42
43    if drawing.isNone():
44
45        # Add an error message to the output toolbox
46        ot.add("Unable to create new project from standard")
47
48else:
49
50    # Add an error message to the output toolbox
51    ot.add("Unable to load the standards FEFCO 0201/FEFCO 0210")