Feature request - Create Setups

Feature request - Create Setups

Joshua.mursic
Advocate Advocate
1,630 Views
13 Replies
Message 1 of 14

Feature request - Create Setups

Joshua.mursic
Advocate
Advocate

Is it possible to update the API to add just simple setup creation. We are currently restricted to using text commands, which I have found can be very buggy. Even just being able to create a setup and select the workplaces and models would be a huge help to me, and I’m sure many others.

0 Likes
Accepted solutions (3)
1,631 Views
13 Replies
Replies (13)
Message 2 of 14

boopathi.sivakumar
Autodesk
Autodesk
Accepted solution

Hi @Joshua.mursic 

Wait for one more week. We have a surprise for you😊


Boopathi Sivakumar
Senior Technology Consultant

Message 3 of 14

Joshua.mursic
Advocate
Advocate
Looking forward to it! Thanks @boopathi.sivakumar
0 Likes
Message 4 of 14

echatzief
Advocate
Advocate
Accepted solution

Hey @Joshua.mursic 

Take a look here:

## bodyCollection refers to an object collection!

occs = rootComp.occurrences
occ = occs[0]
child_component = occ.component
child_bodies = child_component.bRepBodies
in_body = child_bodies[0] # brepBody
cam = adsk.cam.CAM.cast(products.itemByProductType("CAMProductType"))

setup = createSetups(cam, in_body)




def createSetups(cam_, targetBody : adsk.fusion.BRepBody) -> adsk.cam.Setup:
    global bodyCollection
    bodyCollection.add(targetBody)
    existingSetups = cam_._get_setups() # setups
    targetSetup = existingSetups.createInput(adskCam.OperationTypes.MillingOperation) # SetupInput
    newSetup = existingSetups.add(targetSetup) # setup

    newSetup._set_models(bodyCollection)
    bodyCollection.clear()
    return newSetup

Message 5 of 14

Joshua.mursic
Advocate
Advocate

That's awesome! Thanks @echatzief, where did you find these functions in the documentation? Are there more of these? I would also like to be able to set the work coordinate system. Thanks for sharing your knowledge. 

cam_._get_setups()
newSetup._set_models

 

 

0 Likes
Message 6 of 14

echatzief
Advocate
Advocate

You are definitely able to change wcs.

0 Likes
Message 7 of 14

kandennti
Mentor
Mentor

@echatzief .

 

I am amazed. You have created a setup without having to switch to a manufacturing workspace.

0 Likes
Message 8 of 14

Joshua.mursic
Advocate
Advocate

How would I do this? Where did you find the _set_models() and the _get_setups() functions? I do not see them in the documentation.

0 Likes
Message 9 of 14

echatzief
Advocate
Advocate

Hey @kandennti,

I am pleased to amaze you.

* I have already switched to manufacturing😛

Message 10 of 14

kandennti
Mentor
Mentor

@Joshua.mursic .

 

It is not documented in the documentation.

The easiest way to check is to stop at a breakpoint and check the variable.

1.png

The rest you will have to guess and try.

0 Likes
Message 11 of 14

Joshua.mursic
Advocate
Advocate

Is my surprise ready?! @boopathi.sivakumar

0 Likes
Message 12 of 14

anaschat22
Explorer
Explorer

Hi @echatzief , can I have some tips on using thos functions?

Thank you.

0 Likes
Message 13 of 14

boopathi.sivakumar
Autodesk
Autodesk
Accepted solution

There you go 

with the April release now you have more access to the cam api

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-36B1FFB5-5291-4532-8F11-90E912769B34

 


Boopathi Sivakumar
Senior Technology Consultant

Message 14 of 14

Joshua.mursic
Advocate
Advocate

Very exciting! thank you

0 Likes