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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Path from Spline? - How to get a Path, or maybe BRepFace/Profile from a SketchFittedSpline object?

Message 1 of 3
170 Views, 2 Replies

Path from Spline? - How to get a Path, or maybe BRepFace/Profile from a SketchFittedSpline object?

I'm trying to surface-loft non-flat splines, but the loftSections.add() method wants different input.
It works fine manually in the UI.
I've created two non-planar sections like this:-  





They look like this in debug:
<adsk.fusion.SketchFittedSpline; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::fusion::SketchFittedSpline > *' at 0x1a6426d50> >
I'm attempting to do something like this:- 


loftInput = loftFeats.createInput(adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
loftSectionsObj = loftInput.loftSections



RuntimeError: 3 : Invalid entity type: entities the a BRepFace, Profile, Path, SketchPoint, ConstructionPoint, or an ObjectCollection containing a contiguous set of Profile objects that defines the section.
I tried browsing the object (no obvious things in there) and I tried foilobj._get_geometry() (same problem).
From the above, it looks like I need either Path or maybe BRepFace (The *Point options aren't relevant, and Profile probably expects something flat, which these are not, and I'd rather not patch them all into faces if I can avoid that).
Does anyone know how I go from my "foilobj" (sketch.sketchCurves.sketchFittedSplines.add(points)) to a Path or similar?
Here's my input (also showing the rails I need):-
Screen Shot 2021-02-01 at 4.30.31 pm.png
And what that looks like manually "Patched":
Screen Shot 2021-02-01 at 4.31.02 pm.pngScreen Shot 2021-02-01 at 4.31.29 pm.png

Labels (1)
Message 2 of 3
in reply to: OceanHydroAU

I wondered if the path wasn't automatically created from the spline, and so I tried this:


adsk.fusion.Path.create(foilobj, 0) 


which got me a step further - that might turn out to be the answer? (if yes, I'll report back)

Message 3 of 3
in reply to: OceanHydroAU

OK - yep - the above worked:-

loftSectionsObj.add( adsk.fusion.Path.create(foilobj, 0) )​


Posting this here for future users, since google found me nothing...

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