SelectExpression example

SelectExpression example
 1if impact.active_drawing.isNone():
 2    impact.gui.output_toolbox.add("Unable to continue: there is no active drawing")
 3else:
 4    ab = impact.active_drawing.active_layer.active_block
 5
 6    # Ensure no entities are selected
 7    ab.select_none()
 8
 9    # First we want to select all line entities
10    expression = "(Type == Line)"
11
12    # Perform the select operation
13    ab.select_expression(expression, ipSelectExpressionMode.smAdd)
14
15    # Now deselect any entity which uses the Crease palette;
16    # Note that we have to use two sets of double-quotes around the
17    # palette name, in order to make this a valid VBScript string
18    expression = "(Palette == ""Crease"")"
19    ab.select_expression(expression, ipSelectExpressionMode.smSubtract)