GetEntityExtentsInBox example

GetEntityExtentsInBox example
 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    ad = impact.active_drawing
11    al = ad.active_layer
12    ab = al.active_block
13    r = impact.creator.rect(-150, -150, 50, 50)
14    extents = ab.get_entity_extents_in_box(r)
15    impact.gui.output_toolbox.add(extents.to_string())
16
17