Automatic dimensioning

Automatic dimensioning
 1# this example creates 2 lines and dimensions them
 2
 3# check there is an active drawing
 4if impact.active_drawing.isNone():
 5
 6    # display a message in the output toolbox
 7    impact.gui.output_toolbox.add("Unable to continue: there is no active drawing")
 8
 9else:
10
11    # create a local variable for the active block
12    ab = impact.active_drawing.active_layer.active_block
13
14    # move to the origin
15    ab.move_ad(0, 0)
16
17    # create a line
18    ab.line_ad(100, 0)
19
20    # move to the position 200, 0
21    ab.move_ad(200, 0)
22
23    # create a line
24    ab.line_ad(200, 100)
25
26    # select all visible entities in the active block
27    ab.select_all()
28
29    # dimension the entities
30    ab.dimension_automatic(True, True, ipAutoDimensionPosition.adpHigh, ipAutoDimensionPosition.adpHigh)
31
32    # view the extents
33    impact.gui.active_window.view_extents()
34
35
36
37
38