Point On Side (Python)¶
Point On Side (Python)¶
1# select all visible entities
2impact.active_block.select_all() # delete the selected entities
3impact.active_block.delete_selected() # move to position 0,0
4impact.active_block.move_ad(100, 0)
5
6# draw a horizontal line
7line1 = impact.active_block.line_ad( 0, 0 )
8
9# create a vector
10point = None
11try:
12 point = impact.creator.vector(50,-1)
13except Exception as exc:
14 impact.gui.output_toolbox.add(f"Failed to create object via impact.creator.vector(): {exc}")
15
16# determine the side of the vector in relation
17# to the line
18entitySide = line1.point_on_side(point)
19
20# output the result to the output tool box
21if entitySide == ipEntitySide.esLeft:
22 impact.gui.output_tool_box.add( "ipEntitySide.esLeft" )
23elif entitySide == ipEntitySide.esRight:
24 impact.gui.output_tool_box.add( "ipEntitySide.esRight" )
25else:
26 impact.gui.output_tool_box.add( "ipEntitySide.esUndefined" )