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: 

Create and loft NURBS curves through API

5 REPLIES 5
Reply
Message 1 of 6
john.martinP7T4M
542 Views, 5 Replies

Create and loft NURBS curves through API

Hi. I am working on a script for Autodesk Fusion in which I am attempting to read a csv file containing NURBS curve information (wing profiles with open trailing edge), create these curves, close off the open end by a curve between the end points and loft the resulting closed profiles into a solid body. Everything works well except the last step, where Fusion in what is seemingly a random selection of the created curves, refuses to acknowledge the combination of two open splines with common end points as a closed-off profile. This naturally makes it impossible to add the profile to a list of loft section objects, and leads to an error message.

 

As a test I attempted to manually repeat the behavior of the script in the GUI, creating a sketch in the plane of the open spline, projecting the open spline into the sketch and closing it off with a spline between the two end points. Also in this case Fusion does not recognize the resulting two-part curve as a closed profile.

 

If anyone has experienced similar behavior when attempting to close off spline curves in sketches in Fusion, and have any idea on how to fix this issue, it would be great to get to know about it.

 

As a backup plan I migth go to the Patch environment, loft the imported open curves manually, loft the open end and stitch the surfaces together, but this involves an unpleasant amount of manual clicking on lines as the geometry in question consists of some 50 cross-section lines. I have attempted to find information on how to implement this procedure in a script, but I cannot seem to find any way of lofting open curves through the API. If anyone has tips on this part that would also be great!

 

I am attaching my script and a sample file of NURBS control points, in case that might clarify my issue (I had to change the file extension on the python script in order to be allowed to upload it). On line 39 of the script a variable is defined, dictating the number of curves from the input file that shall be included in the import. The first 8 work well, but after this some of the curves are seemingly not possible to use in a closed profile. Increasing the variable to a number larger than 8 and running the script gives an error message.

5 REPLIES 5
Message 2 of 6

Hello,

 

I played your script and found it worked well. Could you explain more about the issue you mentioned? It would be better if you can provide some snapshot to demo the issue.

 

"Everything works well except the last step, where Fusion in what is seemingly a random selection of the created curves, refuses to acknowledge the combination of two open splines with common end points as a closed-off profile. This naturally makes it impossible to add the profile to a list of loft section objects, and leads to an error message."

 

Thanks,

Marshal



Marshal Tu
Fusion 360 Developer
Autodesk, Inc.

Message 3 of 6

Thanks for the quick reply! Did you try changing the number of imported splines on line 39 as explained in the last part of my question? I set the number to 8 in the uploaded file so that it would run and demonstrate what I am trying to achieve. If you increase this number to somewhere between 8 and 15 (I only included 15 sections in the sample input file) Fusion throws an error message. In the attachments below you can find both a screenshot of the error message and a new version of the script where I have changed the number of input splines to 12.

 

The error message seems to tell us that Fusion cannot find a profile when looking for it in a given sketch. This makes sense when manually inspecting the import results, where it is evident that the combination of two splines into a closed loop on the 9th imported spline (will be sketch 10 when running the script in a blank document) is not recognized as a closed profile. So from my perspective the problem here seems to be that the closed-loop curves in some of the sketches are not recognized as closed. This, however, I have no idea how to solve.

Message 4 of 6

Hello,

 

Thank you for explanation. I can reproduce the issue and log it as UP-37976 in our internal system.

 

Unfortunately I didn't find easy way for you to work it around yet.

 

Thanks,

Marshal



Marshal Tu
Fusion 360 Developer
Autodesk, Inc.

Message 5 of 6

Thanks for your reply! I am looking forward to hearing about any potential fixes.

 

One potential way of working aroung the problem is to loft via the Patch modeling mode. In the GUI this allows for lofting open splines into a surface. One might thereafter loft the open edge and patch the ends so that the resulting object becomes a solid body. I have however not found any way of doing this through a script. Is there any implementation of this functionality in the API?

Message 6 of 6

Hello,

 

You can probably patch those open edges into a surface and stitch them into a solid body. We do provide API to create patch and stitch feature. I didn't try in your case. Please have a try.

 

Patch: http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-d8c3e02e-158e-11e6-a9a3-3417ebd41e19

Stitch: http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-69e5b3fa-e3c2-4a44-ae4b-0b48f2ebc918

 

Thanks,

Marshal



Marshal Tu
Fusion 360 Developer
Autodesk, Inc.

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