DimensionRadius example

DimensionRadius example
 1# this example creates an arc and a radius dimension
 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 of the active block
15    ab.move_ad(0, 0)
16
17    # create a local variable for the radius
18    radius = 10
19
20    # create a vector for the offset
21    offset = impact.creator.vector(radius,radius)
22
23    # create a clockwise large arc
24    arc1 = ab.arc(offset, radius, 0, 0)
25
26    # create local variables for the point on the arc and text mode
27    mid_point = arc1.get_along(0.5)
28    text_mode = ipDimensionTextMode.dtmOutside
29
30    # create a radius dimension
31    ab.dimension_radius(arc1, mid_point, text_mode)