Run a Standard¶
Run a Standard¶
1# This example shows how to create a standard in a new project
2
3# Create a local variable for the output toolbox
4ot = impact.gui.output_toolbox
5
6# Clear the output toolbox
7ot.clear()
8
9# Create a local variable for the active database
10db = impact.active_database
11
12# Note: You should always assign impact.active_database.standard_creator
13# to a local variable
14sc = db.standard_creator
15
16# Create a local variable for the name of the standard to create
17standard_name = "FEFCO 0201"
18
19# Set the standard to create
20sc.standard = standard_name
21
22# Set the material
23sc.material_mts = db.find_master_tool_setting("Corrugated|B Flute", ipMasterSettingType.mstMaterial)
24
25# Check that the IStandardCreator.create() method can be called successfully
26if sc.valid:
27
28 # Add a message to the output toolbox
29 ot.add("Successfully loaded standard: " + str(sc.description))
30
31 # Set some of the variables
32 sc.variable_settings.variables.item("L").value = 100.00
33 sc.variable_settings.variables.item("W").value = 200.00
34 sc.variable_settings.variables.item("D").value = 150.00
35
36 # Get some dimensions settings
37 dimension_settings = db.find_master_tool_setting("FEFCO", ipMasterSettingType.mstDimension)
38
39 # If the dimension settings were found the use them
40 if not dimension_settings.isNone():
41 sc.dimension_mts = dimension_settings
42
43 # sc.add_overall_dimensions = True
44 sc.add_panel_dimensions = True
45
46 # Create the standard
47 drawing = sc.create()
48
49 # Check the standard was created
50 if not drawing.isNone():
51
52 # Add a message to the output toolbox
53 ot.add("Successfully created new project '" + drawing.full_name + "'")
54
55 else:
56
57 # Add an error message to the output toolbox
58 ot.add("Unable to create new project from standard")
59
60else:
61
62 # Add an error message to the output toolbox
63 ot.add("Unable to load the standard '" + str(standard_name) + "'")
64