- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I am still learning the API so please be kind 🙂
I am trying to write a script which generates pathing information and I have come across a problem joining two lines in a consistent way. If we take two lines and put a spline between them then I get something like this:
Now, in the GUI I would grab the handles of these two points and make them colinear with the incoming and outgoing lines like this:
Which results in a lovely curving path:
However, when I try and do this via the API using this code:
def makeSpline(sketch : adsk.fusion.Sketch,startPoint : adsk.fusion.SketchPoint, endPoint : adsk.fusion.SketchPoint, startLine : adsk.fusion.SketchLine, endLine : adsk.fusion.SketchLine) :
points = adsk.core.ObjectCollection.create()
points.add(startPoint)
points.add(endPoint)
splines = sketch.sketchCurves.sketchFittedSplines
spline = splines.add(points)
handle = spline.activateCurvatureHandle(startPoint)
sketch.geometricConstraints.addCollinear(startLine, handle)
handle = spline.activateCurvatureHandle(endPoint)
sketch.geometricConstraints.addCollinear(endLine, handle)
return spline
I get an error:
What am I doing wrong here?
TIA
Andy
Solved! Go to Solution.