Creating a project (Python)

Creating a project (Python)
 1# This example creates a project drawing. If the users'
 2# environment options define a template to be used for
 3# new items, that template will be used. If not, the user
 4# will be prompted with the template selection dialog. If a
 5# drawing was created, the name is displayed in the output
 6# toolbox, otherwise an error message is displayed in the output
 7# toolbox.
 8
 9# Create a local variable for the impact impact.gui object
10g = impact.gui
11
12# Create a local variable for the output toolbox
13ot = g.output_toolbox
14
15# Clear the output toolbox
16ot.clear()
17
18# Attempt to create a project
19d = g.tools.create_project()
20
21# Check a project was created
22if not d.isNone():
23
24    ot.add(d.full_name)
25
26else:
27
28    ot.add("A project was not created")