How to access Post Process > Safe Retracts from python.

How to access Post Process > Safe Retracts from python.

nicholas.rodie
Participant Participant
424 Views
4 Replies
Message 1 of 5

How to access Post Process > Safe Retracts from python.

nicholas.rodie
Participant
Participant

Hello,

I've recently purchased a CNC mill and want to use the UGS_Fusion add-in.

 

I am using the Fusion Grbl post process. The way I like to set up the machine is to position the spindle at a point, zero XY, and Probe Z. This means I want to use the Safe Retracts = Clearance Height option in post process. 

 

When I generate the NC file with Actions > Post Process all is good. The G28 lines are removed from the nc code.

 

The problem is when I use the UGS_Fusion plugin. The add-in doesn't recognize the Safe Retracts option and exports the nc code with the G28 line included.

 

Can anyone guide me on how to get the Safe Retracts recognized in the python code?

0 Likes
Accepted solutions (1)
425 Views
4 Replies
Replies (4)
Message 2 of 5

boopathi.sivakumar
Autodesk
Autodesk
Accepted solution

Hi @nicholas.rodie 

Here is an example how you can do that 

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-BF31EB56-B612-44C8-8F07-0C183036C803


look for this lines

postParams: adsk.cam.CAMParameters = ncProgram.postParameters

then you can do something like this 

safeRetracts: adsk.cam.ChoiceParameterValue = postParams.itemByName('safePositionMethod')
if safeRetracts:
   safeRetracts.value.value = str('clearanceHeight')
else:
   Print("skipping.... safe position method property not found")

ncProgram.updatePostParameters(postParams)

 

 


Boopathi Sivakumar
Senior Technology Consultant

Message 3 of 5

nicholas.rodie
Participant
Participant

Thank you, that's really helpful.

I had started to get close by myself but I'm struggling because I don't know how to find all the available parameters. Is there some way to iterate the postParams to see what it holds? I can only get the object definitions out, don't know how to turn them into key value pairs.

 

0 Likes
Message 4 of 5

boopathi.sivakumar
Autodesk
Autodesk

Yeah you can iterate through the postParameters to find

postProperties = ncProgram.postParameters
for i in postProperties:
   print(i.name, i.value.value)

Also if you open the post processor you can also see all the properties in the top

boopathisivakumar_0-1748950920664.png

 


Boopathi Sivakumar
Senior Technology Consultant

Message 5 of 5

nicholas.rodie
Participant
Participant

Aw jeez it's easy when you know how 😀

 

I was just missing the second value from value.value

and yeah they all at the top of the file 🙄

 

Thanks for your help.

 

0 Likes