Advanced Standard Options

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