Rubber Band Example (Python)¶
Rubber Band Example (Python)¶
1# Allow user to keep picking entities, displaying a rubber band cursor, until they choose to cancel the picking tool
2impact.gui.output_toolbox.clear()
3basePoint = None
4try:
5 basePoint = impact.creator.vector( 10.0, 20.0 )
6except Exception as exc:
7 impact.gui.output_toolbox.add(f"Failed to create object via impact.creator.vector(): {exc}")
8pickInfo = impact.gui.picker.get_rubber_band_point( "Pick an entity", basePoint )
9# A None value will be returned if the user has cancelled
10while not ((pickInfo.isNone())):
11 impact.gui.output_tool_box.add( "Point was: " + pickInfo.point.to_string() )
12 lastPoint = pickInfo.point
13 pickInfo = impact.gui.picker.get_rubber_band_point( "Pick an entity", lastPoint )
14
15 impact.gui.output_tool_box.add( "Finished" )