Skip to content

Instantly share code, notes, and snippets.

Created April 4, 2012 03:29
What would you like to do?
get a tangent vector from an edge in FreeCAD
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)
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