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: 

Convert .sldprt files to .stl using Fusion360 Python API

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
m.umardastgir
3459 Views, 7 Replies

Convert .sldprt files to .stl using Fusion360 Python API

Hello everyone,

 

I am a beginner working on an assignment in which I have to convert an input .sldprt file to an output .stl file format. I believe Fusion 360 has a Python API that can import and export files. However, in the examples, I do not see any reference to importing a .sldprt file or exporting a .stl file. Can anyone point me how to import .sldprt and export .stl file?

Tags (3)
7 REPLIES 7
Message 2 of 8
JesusFreke
in reply to: m.umardastgir

See http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ECA8A484-7EDD-427D-B1E3-BD59A646F4FA for exporting an STL. I'm not familiar with sdlprt files, and don't see anything offhand in the api for importing them.

Message 3 of 8
BrianEkins
in reply to: JesusFreke

Support for Solid Works translation directly within Fusion was just recently added and unfortunately, the API has not been updated to support it.  I don't know of any workaround.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 4 of 8
JesusFreke
in reply to: JesusFreke

I think the autodesk cloud storage thing may support .sldprt files. If so, you may be able to use something like Data.activeProject.rootFolder.uploadAssembly() (or uploadFile?) to upload the .sldprt, and then Application.get().documents.open() to open the uploaded file.

 

I have no idea if that will actually work or not, but that would be what I try at least.

Message 5 of 8
BrianEkins
in reply to: JesusFreke

@JesusFreke is correct.  I should have thought about that because that was the only way to do it in the past using Fusion.  It will just take a lot longer than being able to translate the file locally because it will have to upload the file, do the translation and then you'll need to open it, which requires it to download the translated file.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 6 of 8
goyals
in reply to: BrianEkins

That is precisely how it works as described by @JesusFreke.



Shyam Goyal
Sr. Software Dev. Manager
Message 7 of 8
m.umardastgir
in reply to: JesusFreke

Thanks for your answer @JesusFreke . I have posted another question on how to get started with Python APIs and how to set up the environment and was wondering if you could guide me how to proceed with that too. I did not post it under this thread because it is a different question.

Message 8 of 8
BrianEkins
in reply to: BrianEkins

I need to correct this statement.  When I saw that the Open command now supports additional file formats, including SLDPRT, I assumed this meant the translations would happen locally.  However, I've since found out this is not true.  When you open a file that doesn't have a local processor, like SLDPRT, it uploads the file to Fusion Team to do the translation and then will open that translated file once it's completed the translation.  So the Open command is just providing a more streamlined interface than what the previous workflow required.  Using the API you'll need to go through the steps one-by-one; upload the file, wait for the translation, and then open it in Fusion 360.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com

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