Convert .sldprt files to .stl using Fusion360 Python API

Convert .sldprt files to .stl using Fusion360 Python API

Anonymous
Not applicable
5,785 Views
8 Replies
Message 1 of 9

Convert .sldprt files to .stl using Fusion360 Python API

Anonymous
Not applicable

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?

0 Likes
Accepted solutions (1)
5,786 Views
8 Replies
Replies (8)
Message 2 of 9

JesusFreke
Advocate
Advocate

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 9

BrianEkins
Mentor
Mentor

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
0 Likes
Message 4 of 9

JesusFreke
Advocate
Advocate
Accepted solution

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.

0 Likes
Message 5 of 9

BrianEkins
Mentor
Mentor

@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
0 Likes
Message 6 of 9

goyals
Autodesk
Autodesk

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



Shyam Goyal
Sr. Software Dev. Manager
0 Likes
Message 7 of 9

Anonymous
Not applicable

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.

0 Likes
Message 8 of 9

BrianEkins
Mentor
Mentor

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
0 Likes
Message 9 of 9

amirmohammad1
Community Visitor
Community Visitor

Hi Brian,
I was wondering if API now supports importing of .sldprt files or not yet. As I didn't find anything about it.

Best regards,
Amir

0 Likes