Message 1 of 4
Loft issue "the selected rail does not touch all of the profiles" (Fusion API)

Not applicable
03-02-2020
05:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am working on a parametric design using the fusion API, and I'm having an issue with the loft function. I have created guide rails using the fusion API sketchFittedSplines from a list of points Point3D.create(). The two profiles are rectangles generated from the first and last set of 3d points in the guide rails. The sketches appear to be correct, but the loft function fails. Lofting also fails when I attempt to do it manually in the Fusion 360 interface (see attached screenshot). Even though the profile is generated from points existing in the rails I get the error message "the selected rail does not touch all of the profiles".
I hope someone can help me resolve this issue.
My code for generating the rails:
sketch1 = rootComp.sketches.add(rootComp.xYConstructionPlane)
sketch2 = rootComp.sketches.add(rootComp.xYConstructionPlane)
sketch3 = rootComp.sketches.add(rootComp.xYConstructionPlane)
sketch4 = rootComp.sketches.add(rootComp.xYConstructionPlane)
sketch5 = rootComp.sketches.add(rootComp.xYConstructionPlane)
sketch6 = rootComp.sketches.add(rootComp.xYConstructionPlane)
g1 = adsk.core.ObjectCollection.create()
g2 = adsk.core.ObjectCollection.create()
g3 = adsk.core.ObjectCollection.create()
g4 = adsk.core.ObjectCollection.create()
for t in range(0,l_tot+1):
fac1(t) #specifics redacted
fac2(t) #specifics redacted
g1.add(adsk.core.Point3D.create(ofsx3_in*fac1+ofsx3_out*fac2, ofsy2_in*fac1+ofsy2_out*fac2, t))
g2.add(adsk.core.Point3D.create(ofsx3_in*fac1+ofsx3_out*fac2, ofsy3_in*fac1+ofsy3_out*fac2, t))
g3.add(adsk.core.Point3D.create(ofsx4_in*fac1+ofsx4_out*fac2, ofsy2_in*fac1+ofsy2_out*fac2, t))
g4.add(adsk.core.Point3D.create(ofsx4_in*fac1+ofsx4_out*fac2, ofsy3_in*fac1+ofsy3_out*fac2, t))
rail1 = sketch1.sketchCurves.sketchFittedSplines.add(g1)
rail2 = sketch2.sketchCurves.sketchFittedSplines.add(g2)
rail3 = sketch3.sketchCurves.sketchFittedSplines.add(g3)
rail4 = sketch4.sketchCurves.sketchFittedSplines.add(g4)
For generating the profiles and lofting:
# Draw the bottom rectangle
lines1 = sketch5.sketchCurves.sketchLines
recLines = lines1.addThreePointRectangle(g1[0], g2[0], g3[0])
# Draw the top rectangle
lines2 = sketch6.sketchCurves.sketchLines
recLines = lines2.addThreePointRectangle(g1[-1], g2[-1], g3[-1])
# Create loft feature input
loftFeats = rootComp.features.loftFeatures
loftInput = loftFeats.createInput(adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
# Loft Sections
loftSectionsObj = loftInput.loftSections
loftSectionsObj.add(sketch5.profiles.item(0))
loftSectionsObj.add(sketch6.profiles.item(0))
# Loft Guides
loftInput.centerLineOrRails.addRail(rail1)
loftInput.centerLineOrRails.addRail(rail2)
loftInput.centerLineOrRails.addRail(rail3)
loftInput.centerLineOrRails.addRail(rail4)
loftInput.isSolid = True
loftInput.operation = 1
# Create loft feature
loftFeats.add(loftInput)