Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How would you extract expanded points from a spline?

1 REPLY 1
Reply
Message 1 of 2
OceanHydroAU
205 Views, 1 Reply

How would you extract expanded points from a spline?

Lets say I have a spline made up of 10 points.  Can you think of a (preferably fast*) way to get 100+ points out of that?

 

I'm needing to convert any arbitrary input spline from fit-point to control-point.

 

I figure the "easiest" way would be to start by drawing the fit-point spline, then (using a subset (or superset) copy of the original (e.g. 10) input points) draw the control-point spline, and finally run some iterative code (hence needing fast*) to move the second set of points around until the two splines match one-another within some sensible tolerance.

 

Hence my question - is there some way to "rasterize" a spline, or some process that's not too slow that might let me get at those points that you can think of?  Or some other idea perhaps?

 

I did try asking the Fusion team for the exact spline code they're using, but they did not reply, and they've got some proprietary point weight adjustment going on that is not a pure cubic bspline - not to mention that bsplines don't specifically define end point behaviour anyhow.  This post of theirs comes tantalizingly close: https://www.autodesk.com/products/fusion-360/blog/sketch-control-point-splines-faq/ - but stops short of spelling out the detail we need.  (don't bother posting on that - it accepts comments, but they go to /dev/null)

1 REPLY 1
Message 2 of 2
JesusFreke
in reply to: OceanHydroAU

If you have the sketch object, e.g. a SketchFittedSpline, the geometry field contains the NurbsCurve3D object that defines its geometry. And then you can use NurbsCurve3D.evaluator to "query" the geometry.

 

e.g. something like  (note: untested code :))

 

evaluator = spline.geometry.evaluator
start, end = evaluator.getParameterExtents()
step = (end-start)/100

points = []
param= start
while param < end:
    points.append(evaluator.getPointAtParameter(param))
    param += step

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report