Checked the methods which can be applied on an Edge ... There are dozens ...
Which is used best to get the information if an edge is straight and if it is straight which is it's direction?
The last one could just be done by subtracting the point vectors, AFAIK.
bernd
is an Edges straight, get the direction
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: is an Edges straight, get the direction
transform it to a nurbs and check whether all poles ar collinear.
Re: is an Edges straight, get the direction
Here my proposal (considering edge is stored in "myEdge" variable) :
HTH
Code: Select all
myEdgeVector = myEdge.lastVertex().Point-myEdge.firstVertex().Point
myEdgeDirection = (myEdgeVector + App.Vector()).normalize()
myEdgeIsStraight = ( sum([a**2 for a in myEdgeVector]) == myEdge.Length**2 )
Re: is an Edges straight, get the direction
Code: Select all
p = Part.read("path")
e = Part.Edges[0]
if type(e.Curve) == Part.Line:
print("Edge is a line!")
FreeCAD rookie