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

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

Anonymous
Not applicable
959 Views
3 Replies
Message 1 of 4

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

Anonymous
Not applicable

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)
0 Likes
960 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Update: I measured the distance between the rails and the profiles and apparently there is a distance of 0.0000000000000044 mm at each corner. How can this be when I am using the exact same points as input?

0 Likes
Message 3 of 4

kandennti
Mentor
Mentor

Hi @Anonymous .

 

I can not try it because there are no specific values and models.

 

It may be irrelevant, but there have been cases where increasing tolerance in the past has solved it.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/different-height-calculation-for-sweep-and-extrusion/m-p/9112909 
May be worth trying.

 

0 Likes
Message 4 of 4

Anonymous
Not applicable

Thanks for the reply 🙂

 

I tried increasing the tolerance, but that didn't seem to do the trick. 

 

I am creating the lofts in a nested for loop and it works for every loft except the three closest to the center. I just can't understand why it doesn't work for those three specific cases. There is a total of 60*8 lofts, so it takes a while to run the script. If you want to try to run the full script you can send me a private message.

0 Likes