Rebridging

Rebridging
 1# This example rebridges all entities in the active block
 2# using a defined style
 3
 4# Create a local variable for the output toolbox
 5ot = impact.gui.output_toolbox
 6
 7# Clear the output toolbox
 8ot.clear()
 9
10# Create a local variable for the active drawing
11ad = impact.active_drawing
12
13# Check there is an active drawing
14if ad.isNone():
15
16    # Add an error message to the output toolbox
17    ot.add("unable to continute: no active drawing")
18
19else:
20
21    # Create a local variable for the active block
22    ab = ad.active_layer.active_block
23
24    # Create some options
25    options = impact.creator.rebridge_options()
26
27    # Define the options
28    options.rebridge_mode = ipRebridgeMode.rmUserDefined
29    options.user_defined_style = "Carton"
30
31    # Select all visible entities in the active block
32    ab.select_all()
33
34    # Rebridge the entities using the defined options
35    ab.rebridge(options)