Rotate selected entities

Rotate selected entities
 1# This script rotates any selected entities by 90 degress
 2# (270 degress Counter-Clockwise) around their centre position
 3
 4# check there is an active drawing
 5if impact.active_drawing.isNone():
 6
 7    # display a message in the output toolbox
 8    impact.gui.output_toolbox.add("Unable to continue: there is no active drawing")
 9
10else:
11
12    # create a local variable for the active block
13    ab = impact.active_drawing.active_layer.active_block
14
15    # get the selected entity extents
16    rect = ab.get_selected_extents()
17
18    # create some local variables for the Angle, Position, Retain
19    # and NumCopies options
20    position =  rect.centre
21    retain = 0
22    angle = 270
23    num_copies = 1
24
25    # rotate the selected entities
26    ab.rotate(angle, position, retain, num_copies)
27
28    # repaint all entities in this window
29    impact.active_drawing.active_window.repaint()
30
31    # deselect entities
32    ab.select_none()