Select a collection of entities

Select a collection of entities
 1ab = impact.active_drawing.active_layer.active_block
 2
 3# Put various entities into an array
 4ents_array = []
 5ents_count = 0
 6for ent in ab.entities:
 7    if ent.geometric:
 8        if ent.palette.palette_type == ipPaletteType.ptCut:
 9
10            # Redim (resize the list as needed)
11            ents_array[ents_count] = ent
12            ents_count = ents_count +1
13
14impact.gui.output_toolbox.add("Found " + str(ents_count) + " matching entities")
15
16# Now convert the array to a collection and perform the selection on the collection
17if ents_count > 0:
18    ents_coll = impact.creator.entities(ents_array)
19    ab.select(ents_coll, ipBoolean.bTrue)
20
21
22