How to create an (empty) manufacturing workspace with Python?

How to create an (empty) manufacturing workspace with Python?

maurizio_manzi
Advocate Advocate
226 Views
2 Replies
Message 1 of 3

How to create an (empty) manufacturing workspace with Python?

maurizio_manzi
Advocate
Advocate

Hello,
I open a CAD document over python.
The document hasn't a manufacturing workspace, so that
cam_manager = adsk.cam.CAM.cast(doc.products.itemByProductType("CAMProductType"))
don't works.
How can I create an empty manufacturing workspace in the CAD, so that I have an (empty) CAMProduct?

Best regards

Maurizio

 

0 Likes
Accepted solutions (1)
227 Views
2 Replies
Replies (2)
Message 2 of 3

kandennti
Mentor
Mentor
Accepted solution

Hi @maurizio_manzi -San.

 

Try this one.

    app: core.Application = core.Application.get()
    ui: core.UserInterface = app.userInterface

    camWS: core.Workspace = ui.workspaces.itemById('CAMEnvironment') 
    camWS.activate()


Running it while already in the manufacturing workspace should not cause any problems.

0 Likes
Message 3 of 3

maurizio_manzi
Advocate
Advocate

Thank you very much. It works fine

Best reagards

Maurizio