Starting the application and logging in

Starting the application and logging in
 1from impact.Impact import *
 2from impact.ImpactCAD import *
 3
 4# This example is intended to be run from Windows, not
 5# from the impact Script Toolbox. It creates the impact
 6# object (which will start impact if it is not already
 7# running) and attempts to connect to a database.
 8# If the connection was successful a new drawing is created.
 9
10# Create the impact object
11my_impact = Application()
12
13# ensure the impact object was created successfully
14if not my_impact.isNone():
15
16    # attempt to get a database
17    db = my_impact.databases.item("Test Database")
18
19    # ensure the database was obtained successfully
20    if not db.isNone():
21
22        # disconnect from the database
23        # db.disconnect()
24
25        # connect to the database
26        connected = db.connect("ALBERT", "MYPASSWORD")
27
28        # ensure the connection was successful
29        if connected:
30
31            # define a drawing type constant
32            # ipDrawingType.dtProject = 0  (already defined by the wrapper enum)
33
34            # create a new drawing
35            my_impact.active_database.create_item(ipDrawingType.dtProject, "")
36        else:
37            print("Unable to connect")
38    else:
39        print("Unable to find specified database connection")
40else:
41    print("Unable to communicate with Impact")
42