Macro help Powermill

Macro help Powermill

kingrazz
Community Visitor Community Visitor
129 Views
3 Replies
Message 1 of 4

Macro help Powermill

kingrazz
Community Visitor
Community Visitor

Hi all, 

Hope this is in the correct place. 

I have a small problem, new here so don’t judge .

I want to create a macro that edits the selected program, activates ‘clockwise’ and then calculates.

 

I have tried using the record macro feature but this only works on one toolpath because of its name example;

EDIT TOOLPATH “001” RECYCLE

EDIT DRILL CLOCKWISE ON

EDIT TOOLPATH “001” CALCULATE

 

Then when I try to do this for 002 programs and so on it goes back to 001 obviously.

Ive tried replacing “001” with $selected_toolpath and $tp.name but get error message these toolpaths don’t exist.

 

thanks

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

Sean571
Advocate
Advocate
Accepted solution

Are you trying to do this for each toolpath in an NC program, a toolpath folder, Setup, all toolpaths, or only selected toolpaths? I can help you get this to loop over the toolpaths you want, but depending on which toolpaths you want to loop over the code will look differently.

for example if you want only selected toolpaths you could do something like this:

// loop through selected toolpaths in the explorer
foreach tp in explorer_selected_entities() {

    // Skip toolpaths that don't have the clockwise parameter
    if NOT active($tp.drill.clockwise) {
        continue
    }

    // Skip toolpaths that are already set to clockwise
    if $tp.drill.clockwise == 1 {
        continue
    }

    // Change the parameter and calculate the toolpath
    activate Toolpath $tp.name
    EDIT DRILL CLOCKWISE ON
    EDIT TOOLPATH $tp.name REAPPLYFROMGUI
    EDIT TOOLPATH $tp.name CALCULATE
}

 

Sean Wroblewski
Applications Engineer

Message 3 of 4

CGBenner
Community Manager
Community Manager

@kingrazz 

 

Did the information provided answer your question? If so, please use Accept Solution so that others may find this in the future. Thank you very much!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes
Message 4 of 4

kingrazz
Community Visitor
Community Visitor

Unfortunately I didn’t get round to using/trying it. 
I will try and test it out Monday and report back, thanks for everyone’s time.