Using PathFinder

Using PathFinder
 1# create a local variable for the output toolbox
 2ot = impact.gui.output_toolbox
 3
 4# Clear the output toolbox
 5ot.clear()
 6
 7# Create a local variable for the active drawing
 8ad = impact.active_drawing
 9
10# Check there is an active drawing
11if ad.isNone():
12
13    # Display an error message in the output toolbox
14    ot.add("Unable to continue: no active drawing")
15
16else:
17
18    # Create a local variable for the name of the settings to use
19    settings_name = "Untitled"
20
21    # Attempt to find the settings to use
22    settings = impact.active_database.find_master_tool_setting(settings_name, ipMasterSettingType.mstHoleFinder)
23
24    # Check the settings were found
25    if settings.isNone():
26
27        # Display an error message in the output toolbox
28        ot.add("Unable to continue: can't find settings '" + str(settings_name) + "'")
29
30    else:
31
32        # Create a local variable for the active block
33        ab = ad.active_layer.active_block
34
35        start_entity = ab.entities.item(1)
36        end_entity = ab.entities.item(3)
37        position = start_entity.get_along(1.0)
38
39        # use the path finder method
40        impact.gui.tools.path_finder(start_entity, end_entity, position, ipBoolean.bFalse, ipBoolean.bFalse, ipBoolean.bFalse, settings)
41
42
43
44
45
46
47
48
49