Simple Release

Simple Release
 1db = impact.active_database
 2
 3impact.gui.output_toolbox.clear()
 4
 5drawing = db.create_item(ipDrawingType.dtProject, "")
 6
 7if drawing is not None:
 8    impact.gui.output_toolbox.add("Created new project")
 9
10    drawing.customer = db.customers.find_by_code("(DEFAULT)")
11
12    impact.gui.output_toolbox.add("Finding folder r'\\COMTests'")
13    folder = db.projects.find("COMTests")
14
15    if drawing.save_as("", "COM Update Test", "", folder, True):
16        impact.gui.output_toolbox.add("Successfully saved project")
17
18        db_item = drawing.database_item
19
20        # You can optionally call drawing.close() but db_item.close_and_release() will
21        # automatically close the drawing if it is already open
22
23        # If the project has been modified CloseAndRelease will update the project
24        # otherwise it will discard the project.
25
26        if db_item.close_and_release():
27            impact.gui.output_toolbox.add("Successfully closed and released the project")
28        else:
29            impact.gui.output_toolbox.add("Error: Unable to release the project")
30
31    else:
32        impact.gui.output_toolbox.add("Error: Unable to save the project")
33
34else:
35    impact.gui.output_toolbox.add("Error: Unable to create new project")
36
37
38
39
40
41
42
43