File Conversion from native(.prt) to step file using python

File Conversion from native(.prt) to step file using python

s.chand6RXFT
Explorer Explorer
3,245 Views
8 Replies
Message 1 of 9

File Conversion from native(.prt) to step file using python

s.chand6RXFT
Explorer
Explorer

I want to convert the  native cad file (.prt ) to step file using fusion 360  in python.In fusion API, i couldnot find import for the .prt file but have only few files. Could  you guide me how can I translate the .prt file  programtically using python with the help cloud API?

 

Many thanks

0 Likes
3,246 Views
8 Replies
Replies (8)
Message 2 of 9

kandennti
Mentor
Mentor

Hi @s.chand6RXFT .

 

There are not many formats that can be directly converted by the Fusion360 API.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-GUID-DA509909-1E13-48F1-8235-744BA6B94CBA 

 

Therefore, you must upload your data to the cloud, open the document, and then export it.

 

I have not tried this, but @BrianEkins  has created a sample.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/set-up-fusion360-python-apis/m-p/8776267#M... 

 

This year, the Application.dataFileComplete event was added, so it may be a little easier to tackle.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-049CC6A8-10A5-47AD-B5DE-10B29721548A 

 

However, I think it would be difficult to get the timing of when the document is finished opening and ready for export.

 

 

0 Likes
Message 3 of 9

s.chand6RXFT
Explorer
Explorer

Thanks for your support. I have tried  the code mentioned in the link

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/set-up-fusion360-python-apis/m-p/8776267#M...

But.  I am new in fusion360  and i uploaded file in the file . But , i am not familiar with  how to export  to step  file after translation  completion in the cloud.

schand6RXFT_0-1659091867971.png

 

could you guide me after this steps for the export work. It would be highly appreciated if you provide some code snippets.

Many Thanks

0 Likes
Message 4 of 9

Jorge_Jaramillo
Collaborator
Collaborator
Hi,
What kind of Fusion 360 license do you have?
The Personal license doesn't allow to open .PRT filetypes, which is required to export it then to other format.
Check this first, before you invest some more time in the script development.

Regards,
Jorge
0 Likes
Message 5 of 9

kandennti
Mentor
Mentor

@s.chand6RXFT .

 

I have created a sample add-in and have attached it.

Since we do not have the SLDPRT file at hand, we borrowed it from here.

https://grabcad.com/library/dowel-pin-din-7-1 

 

When the add-in is executed, it performs the following processes
・Upload file
・Open document
・Export with Step file
・Close document
・Delete from data panel
・Closing the add-in

 

The Step file is created in the same folder as the SLDPRT file with the same file name.

Message 6 of 9

s.chand6RXFT
Explorer
Explorer

Thanks alot. i will do .

I want to run the script from Pycharm IDE and  do the translation for my application. I want to do auotomatic process for passing the  public key  without opening fusion 360 api each time.How can i do the automatic process.Please guide me .

 

Many Thanks

0 Likes
Message 7 of 9

kandennti
Mentor
Mentor

@s.chand6RXFT .

 

I do not know how to do that.

You should consider installing conversion software.

0 Likes
Message 8 of 9

s.chand6RXFT
Explorer
Explorer

Due to the  automatic process require my program, i choose the model derivative api  for file translation prt file to step file. I am following the following tutorial.

https://github.com/Autodesk-Forge/forge-tutorial-postman/blob/master/ModelDerivative_01/instructions...

I can get token,create the bucket and upload the file in the cloud. But, when i tried to do translation work i am getting the error.

my source file is  827-9999-906.prt which i download from interne
The code is as shown below:

schand6RXFT_0-1659619577615.png

 

 

But i am getting error :

schand6RXFT_1-1659619625291.png

 

 

Does Modelderivative Api doesnot support step derivative format??

how can i achieve the step file from prt file ?  Waiting for your reply.

 

Many Thanks

0 Likes
Message 9 of 9

BrianEkins
Mentor
Mentor

I think you'll have better luck asking your question on the Forge forum on Stack Overflow.

 

https://stackoverflow.com/questions/ask?tags=autodesk-forge

 

What you're trying to do now has nothing to do with the Fusion API.

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