Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to find the angle between two lines.
The lines are in different sketches and on different planes that are perpendicular to each other.
This is the code I have been working with.
sketch2 = sketches.addWithoutEdges(plane)
recCenter = sketch2.modelToSketchSpace(endPoint)
centerPoint = lineX.endSketchPoint.worldGeometry
point1 = sketch2.modelToSketchSpace(centerPoint)
lines = sketch2.sketchCurves.sketchLines
lineEndPoint = adsk.core.Point3D.create(point1.x + .5, point1.y, point.z)
lineY = lines.addByTwoPoints(point1, lineEndPoint)
vector1: adsk.core.Vector3D = lineX.geometry.asInfiniteLine().direction
vector2: adsk.core.Vector3D = lineY.geometry.asInfiniteLine().direction
newAng = math.degrees(vector1.angleTo(vector2))
newAngStr = "%.16f" % float(newAng)
The lineX and lineY appear to be 90 degrees apart, but in Debugging I get this.
newAng = Radians
newAngStr = Degrees
This is the screen capture I am referring to.
LineX is created higher in the code.
The selected surface plane is what the user clicks on to create the sketch that contains lineX.
LineY is in a sketch on a construction plane perpendicular to the Selected surface plane.
Any and all help appreciated.
Thank you.
Brad Bylls
Solved! Go to Solution.