Bug when using the cam.GenerateAllToolpaths(False) Function

Bug when using the cam.GenerateAllToolpaths(False) Function

Joshua.mursic
Advocate Advocate
2,374 Views
22 Replies
Message 1 of 23

Bug when using the cam.GenerateAllToolpaths(False) Function

Joshua.mursic
Advocate
Advocate

Hello, when using the function below

 

cam.GenerateAllToolpaths(False)

 

I am getting an issue where all of the toolpaths regenerate, but some of them say that they are invalid. 

Joshuamursic_0-1686842638022.png

 

I tried doing a loop and generating each operation one at a time but the same issue occurred, only worse.

 

cam:adsk.cam.CAM = app.activeDocument.products.itemByProductType('CAMProductType')
        for operation in setup.operations:
            cam.generateToolpath(operation)

 

Joshuamursic_1-1686843134997.png

 

If I do the generate all toolpaths manually by selecting them all and Ctrl+G, this does not happen and they all calculate correctly. Is this a bug? Is there a better way to make sure all of my toolpaths are recalculated?

0 Likes
Accepted solutions (2)
2,375 Views
22 Replies
Replies (22)
Message 21 of 23

kandennti
Mentor
Mentor

@Joshua.mursic -San.

I'm glad you were able to solve the problem.
I forgot to mention that I was able to reproduce the same situation.

 

@jeff.pek -San.
It would be useful if the createFromCAMTemplate method had an optional parameter whether or not to start the calculation automatically.

0 Likes
Message 22 of 23

jeff.pek
Community Manager
Community Manager
Accepted solution

Yes, that would be a good thing to support. We'll get it on the list.

 

I was able to track down exactly why this is happening:

 

When the script calls "generateAllToolpaths", it will try to abort any in-process generations. However, it doesn't wait around for the abort to actually happens, and the subsequent attempt to generate does not happen because one is already in progress.

 

You can get it to correctly process the regeneration by sleeping the script long enough (on my machine, about 7 seconds) before calling generateAllToolpaths, but that's obviously not a good solution.

 

We really need to do something to allow you to only create the operations (from a template or otherwise), and then keep control of when the regeneration happens.

 

Hope you can get by with this option setting for now. Unfortunately, there's no way to set the preference from a script 😞

 

Jeff

Message 23 of 23

Joshua.mursic
Advocate
Advocate

No problem! I have that workaround with the preferences. I appreciate all the help @jeff.pek  and @kandennti