Community
PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Macro Request

28 REPLIES 28
Reply
Message 1 of 29
Anonymous
4153 Views, 28 Replies

Macro Request

You guys are so good at Macros, maybe you can help me with these two.

 

1) I would like to be able to invalidate all toolpaths, then calculate them all. 

I have tried "queuing", but that takes forever. I just want everything calculated without having to click 90 times.

 

2) Gouge check and collision check for all toolpaths. (no split toolpath, 0.0 verification thickness, calculate collision depth, but do not adjust tool)

I use automatic verification on new programs, but we have a lot of old programs where automatic verification was not used.

28 REPLIES 28
Message 2 of 29
stdpattern
in reply to: Anonymous

I don't use macros as I should, so I don;t have one to give you, but I think you can solve this easily.  

 

Request 1

 

On the right click menu of the tool path tab in explorer are two commands.  Invalidate All and Batch Process.  I believe these will do what you want.

 

So RMB on the MACROS tab, record, then use those two toolpath commands, then stop recording.  This will give you a macro with those commands, in it.  Edit the file as needed, and I think you will have what you want.

 

Here is the macro result I got from doing that:

 

INVALIDATE TOOLPATH ALL
Yes
BATCH PROCESS

 

Request 2

 

This is a little more involved, so I will defer so someone that does verification by macro.

 

Hope that helped a little

 

Steve

Message 3 of 29
rui_rita
in reply to: stdpattern

@Anonymous

 

$$invalidate all toolpaths

 

INVALIDATE TOOLPATH ALL YES

 

$$ Calculate all

 

BATCH PROCESS

 

 

 

For collision/gouge  checking, we use this plugin http://autode.sk/2p5CUJm  

(we are thinking of selling this in the near future ...)



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
Message 4 of 29
iamcdn79
in reply to: rui_rita

Thats a nice looking plugin, did you create it yourself?


Intel Core i9 13900KF CPU
128 GB Kingston Beast DDR4 SDRAM
PNY RTX A2000 6GB Video Card
WD 1 TB SSD Hard Drive
Windows 11 Pro

Message 5 of 29
Anonymous
in reply to: iamcdn79

For verification we add some custome code to explorer.ppm file.

 

 

<button command='ACTIVATE Toolpath "%s" DIALOGS MESSAGE OFF FORM COLLISION EDIT COLLISION TYPE COLLISION EDIT COLLISION SHANK_CLEARANCE "0" EDIT COLLISION HOLDER_CLEARANCE "0.5" EDIT COLLISION ADJUST_TOOL N EDIT COLLISION SPLIT_TOOLPATH N EDIT COLLISION APPLY EDIT COLLISION TYPE GOUGE EDIT COLLISION APPLY COLLISION ACCEPT DIALOGS MESSAGE ON'
label="Verification"
multiple_selection="only"
/>
	  
<button
command='ACTIVATE Toolpath "%s" DIALOGS MESSAGE OFF FORM COLLISION EDIT COLLISION TYPE COLLISION EDIT COLLISION SHANK_CLEARANCE "0" EDIT COLLISION HOLDER_CLEARANCE "0.5" EDIT COLLISION ADJUST_TOOL N EDIT COLLISION SPLIT_TOOLPATH N EDIT COLLISION APPLY EDIT COLLISION TYPE GOUGE EDIT COLLISION APPLY COLLISION ACCEPT DIALOGS MESSAGE ON'
label="Verification"
/> 

 

This adds "Verification" option to toolpath right click menu.

 

You should add this code in "<!-- Toolpath Child Node Menu Start -->" (form me is line 2864)

 

 

Message 6 of 29
rui_rita
in reply to: iamcdn79

@iamcdn79

 

thx 😉

yes , this a plugin that I create.



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
Message 7 of 29
rui_rita
in reply to: Anonymous

@Anonymous

 

you can have you one toolpah menu

 

if you add toolpath.xml to your pmill4 folder, you can find some examples here in the forum.

 

note, you cand have all those comands in a macro, and call the macro from the menu, is easier to edit, in the menu it's bit confuse...

 



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
Message 8 of 29
Anonymous
in reply to: Anonymous

Multiselect toolpaths with calculate and project save is the safest method. When you batch calculate and Powermill crashes, you may lose some work. This applies to queing as well. If you do it this way, you will have your project saved before the toolpath that caused the issue. You can put in verification too if want. That is up to you.
Message 9 of 29
stdpattern
in reply to: Anonymous


@Anonymous wrote:
Multiselect toolpaths with calculate and project save is the safest method.

Can you elaborate on this a bit, or give an example?

 

Thanks 

 

Steve

Message 10 of 29
LasseFred
in reply to: stdpattern

Verification macro :

 

Function Main(
STRING $Selected_Toolpath
)
{
ACTIVATE TOOLPATH $Selected_Toolpath

DIALOGS MESSAGE OFF


EDIT COLLISION TYPE GOUGE
EDIT COLLISION SPLIT_TOOLPATH N
EDIT PAR 'Verification.UseVerificationThickness' 0
EDIT COLLISION APPLY
EDIT COLLISION HOLDER_CLEARANCE "0,5"

EDIT COLLISION SHANK_CLEARANCE "0"
EDIT COLLISION TYPE COLLISION
EDIT COLLISION SPLIT_TOOLPATH N
EDIT COLLISION DEPTH N
EDIT COLLISION ADJUST_TOOL N
EDIT PAR 'Verification.UseVerificationThickness' 0
EDIT COLLISION STOCKMODEL_CHECK N
EDIT COLLISION SCOPE ALL
EDIT COLLISION APPLY

DIALOGS MESSAGE ON
}

 

 

calc macro:

 

Function Main(
STRING $Selected_Toolpath
)
{
EDIT PREFERENCE AUTOSAVE NO
DIALOGS MESSAGE OFF
ACTIVATE TOOLPATH $Selected_Toolpath
INVALIDATE TOOLPATH $Selected_Toolpath
BATCH PROCESS
DIALOGS MESSAGE ON
EDIT PREFERENCE AUTOSAVE YES

 

______________________
Lasse F.
Message 11 of 29
Anonymous
in reply to: Anonymous

What I use is rather simple but works for me. Invalidate macro.        

 

INVALIDATE TOOLPATH ALL

 

Yes

 

Then I just run my collision check macro. Collision checking macro will calculate all un-calculated toolpaths then collision check.

 

DIALOGS MESSAGE OFF

 

FOREACH tp IN folder('Toolpath\ACTIVATED FOLDER') {
 IF NOT tp.Computed {
  ACTIVATE TOOLPATH $tp.Name
  EDIT TOOLPATH $tp.Name CALCULATE
 }
}

 

FOREACH tp IN folder('Toolpath\SELECTED FOLDER') {
 IF NOT (tp.Verification.CollisionChecked AND tp.Verification.GougeChecked) {

}


 ACTIVATE TOOLPATH $tp.Name
 EDIT COLLISION TYPE GOUGE
 EDIT COLLISION SPLIT_TOOLPATH N
 EDIT COLLISION APPLY
 EDIT COLLISION TYPE COLLISION
 EDIT COLLISION SHANK_CLEARANCE "0.0005"
 EDIT COLLISION HOLDER_CLEARANCE "0.03"
 EDIT COLLISION SPLIT_TOOLPATH N
 EDIT COLLISION DEPTH Y
 EDIT COLLISION ADJUST_TOOL N
 EDIT COLLISION APPLY
}
DIALOGS MESSAGE ON

Message 12 of 29
stdpattern
in reply to: LasseFred

I am missing something fundamental here.  I created two .mac files but both of them give me an error of variable missing.

 

I am sure it is something very basic, but I have not jumped into macros, so I am kind of at a loss on where to even start.

 

Any help or direction would be appreciated.

 

Steve

 

 

Message 13 of 29
rui_rita
in reply to: stdpattern

add the macros so we can check it...

 

if you are using @LasseFred macros, you have to call the macro from the usermenu or toolpath menu...



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
Message 14 of 29
stdpattern
in reply to: rui_rita

Here you go @rui_rita, calculate.mac.  just what @LasseFred had posted.  

 

Like I said, I am most likely just missing a fundamental understanding of something in the process.

 

Thanks 

 

Steve

Message 15 of 29
rui_rita
in reply to: stdpattern

@stdpattern

 

are you calling the macro from the menu? only work if called by the menu



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
Message 16 of 29
LasseFred
in reply to: stdpattern

if you use my macro you need to go to the folder pmill2 paste the code below in the toolpath.xml

 

 

<?xml version="1.0" ?>
<menupage>
<menupage label="name" multiple_selection="allowed">
<button command='macro W:\MACRO path.mac "%s"' label="name?" multiple_selection="allowed" />
</menupage>
</menupage>

______________________
Lasse F.
Message 17 of 29
stdpattern
in reply to: LasseFred

@LasseFred@rui_rita , OK, I just need to start from scratch to learn about how powermill works with macros.  I am not clear on the whole process.

 

Thanks for the info, it gives me a few things to research. 


Steve

 

 

 

Message 18 of 29
rui_rita
in reply to: stdpattern

@stdpattern

 

you can have this in your macro

 

Function Main {
 //some powermill commands
}

 

and it will run normaly like any macro.

 

but you also can have this

 

Function Main( REAL $myvariable) {

// some powermill commans and the use of the variable $myvariable
}

 

and you will called like this macro mymacro.mac 0.2

 

then the variable in the macro will have the value 0.2

 

in @LasseFred macro the incoming value is the selected toolpath

 

in this case, the menu toolpath.xml will call the macro :  mymacro.mac %s

 

macro mymacro.mac 1st_selected_toolpath

macro mymacro.mac 2nd_selected_toolpath

macro mymacro.mac 3rd_selected_toolpath

...

macro mymacro.mac last_selected_toolpath

 

 

I hope this will help you 



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
Message 19 of 29
LasseFred
in reply to: stdpattern

Here you go. 

 

this is a macro programming guide also locate on the drive where powermill is.

or you can find it in powermill, in the top toolbar, help -> dokumentation -> Macro Programming Guide.

 

"C:\Program Files\Autodesk\PowerMill 21.0.30\lib\locale\C\DOC\MacroProgrammingGuide.pdf"

 

and the forum is a good place to ask questions if you have a little macro understanding.

______________________
Lasse F.
Message 20 of 29
keven.beaudoin
in reply to: Anonymous

here are some Macros that could help you.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report