The programming problem - flip ends automatic - is solved in

**TechDrawTools.FCMacro**.

I am no C++ programmer, but if there is anyone who has the knowledge to adopt TechDraw in C++ please contact me. I will explain how the algorithm works.

The whole code in Python is:

Code: Select all

```
def getPoints(View,ObjectList):
'''sort startpoints and endpoints of two lines belonging together'''
def circulation(A,B,C):
'''returns True if circulation ABC is positive'''
M = app.Matrix(A.x, A.y, 1, 0,
B.x, B.y, 1, 0,
C.x, C.y, 1, 0,
0, 0, 0, 1)
if M.determinant() > 0.0: return True
if len(ObjectList) > 1:
Edge1 = View.getEdgeBySelection(ObjectList[0])
Edge2 = View.getEdgeBySelection(ObjectList[1])
if Edge1.Curve.TypeId == 'Part::GeomLine' and Edge2.Curve.TypeId == 'Part::GeomLine':
Start1, Start2 = Edge1.Vertexes[0].Point, Edge2.Vertexes[0].Point
End1, End2 = Edge1.Vertexes[1].Point, Edge2.Vertexes[1].Point
if circulation(Start1,End1,Start2) != circulation(End1,End2,Start2):
Help1, Help2 = Start1, End1
Start1, End1 = Help2, Help1
return (Start1,End1,Start2,End2)
```