GetEntityExtentsInBox example (Python)¶
GetEntityExtentsInBox example (Python)¶
1# This example returns the extents of the entities partially or wholly enclosed by the given rectangle
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 ad = impact.active_drawing
12 al = ad.active_layer
13 ab = al.active_block
14 r = None
15 try:
16 r = impact.creator.rect( -150, -150, 50, 50 )
17 except Exception as exc:
18 pass
19 impact.gui.output_toolbox.add(f"Failed to create object via impact.creator.rect(): {exc}")
20 extents = ab.get_entity_extents_in_box( r )
21 impact.gui.output_toolbox.add(extents.to_string())