Copying entities (Python)¶
Copying entities (Python)¶
1# this example creates some geometry, copies it to the
2# clipboard and then pastes it into the drawing
3
4# Store some useful variables
5ad = impact.active_drawing
6ab = ad.active_layer.active_block
7
8# create a rectangle with the bottom left corner at the
9# origin of the active block
10ab.move_ad(0, 0)
11ab.line_ad(100, 0)
12ab.line_ad(100, 100)
13ab.line_ad(0, 100)
14ab.line_ad(0, 0)
15
16# select all visible entities in the active block
17ab.select_all()
18
19# copy the entities from the active drawing into the clipboard
20ad.copy_entities()
21
22# paste the entities into the active block with a scale of 2 and
23# rotation of 45 degrees at the coordinate 100, 100
24ab.paste(100, 100, ipPastePositionMode.ppmBottomLeft, 2, 45, False, False, True)