get a tangent vector from an edge in FreeCAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getTangent(edge): | |
"Returns a tangent vector from an edge in FreeCAD" | |
if isinstance(edge.Curve,Part.Line): | |
vec = edge.Vertexes[-1].Point.sub(edge.Vertexes[0].Point) | |
elif isinstance(edge.Curve,Part.Circle): | |
v1 = edge.Vertexes[-1].sub(edge.Curve.Center) | |
v2 = edge.Curve.Axis | |
vec = v1.cross(v2) | |
else: | |
print "not supported" | |
vec = None | |
return vec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment