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

29 REPLIES 29
Reply
Message 1 of 30
Anonymous
4581 Views, 29 Replies

Macro Request

Anonymous
Not applicable

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.

0 Likes

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.

29 REPLIES 29
Message 21 of 30

anto_joseph4HH2K
Participant
Participant

Could you explain this bit more,I tried using the macro and it it says variable missing

0 Likes

Could you explain this bit more,I tried using the macro and it it says variable missing

Message 22 of 30
icse
in reply to: anto_joseph4HH2K

icse
Collaborator
Collaborator

If you post your macro i can take a look at it

0 Likes

If you post your macro i can take a look at it

Message 23 of 30
anto_joseph4HH2K
in reply to: Anonymous

anto_joseph4HH2K
Participant
Participant

There you go

0 Likes

There you go

Message 24 of 30
icse
in reply to: anto_joseph4HH2K

icse
Collaborator
Collaborator

I think the problem was that you did not start the macro from the toolpath context menue...

 

try running this maco:

//gets all the toolpaths that are selected in the explorer wich are computed and not empty
entity list $tps = filter(explorer_selected_entities(),'this.RootType == "toolpath" and this.Computed and segments(this) > 0')

//if nothing was selected we exit the macro here
if size($tps) < 1 {
	return
}

dialogs message off

//iterate over all selected toolpaths with the foreach loop
foreach $tp in $tps {

	// activate the next toolpath
	ACTIVATE TOOLPATH ${tp.Name}
	
	//set the parameter for collision check
	EDIT COLLISION TYPE GOUGE
	EDIT COLLISION APPLY
	EDIT COLLISION TYPE COLLISION
	EDIT COLLISION STOCKMODEL_CHECK N
	EDIT COLLISION SPLIT_TOOLPATH N
	EDIT PAR 'Verification.UseVerificationThickness' 0
	EDIT COLLISION SHANK_CLEARANCE "0.0"
	EDIT COLLISION HOLDER_CLEARANCE "0.1"
	EDIT COLLISION ADJUST_TOOL N
	EDIT COLLISION APPLY
}

dialogs message on

 

this runs a collision check over all selected toolpaths selected in the explorer

 

0 Likes

I think the problem was that you did not start the macro from the toolpath context menue...

 

try running this maco:

//gets all the toolpaths that are selected in the explorer wich are computed and not empty
entity list $tps = filter(explorer_selected_entities(),'this.RootType == "toolpath" and this.Computed and segments(this) > 0')

//if nothing was selected we exit the macro here
if size($tps) < 1 {
	return
}

dialogs message off

//iterate over all selected toolpaths with the foreach loop
foreach $tp in $tps {

	// activate the next toolpath
	ACTIVATE TOOLPATH ${tp.Name}
	
	//set the parameter for collision check
	EDIT COLLISION TYPE GOUGE
	EDIT COLLISION APPLY
	EDIT COLLISION TYPE COLLISION
	EDIT COLLISION STOCKMODEL_CHECK N
	EDIT COLLISION SPLIT_TOOLPATH N
	EDIT PAR 'Verification.UseVerificationThickness' 0
	EDIT COLLISION SHANK_CLEARANCE "0.0"
	EDIT COLLISION HOLDER_CLEARANCE "0.1"
	EDIT COLLISION ADJUST_TOOL N
	EDIT COLLISION APPLY
}

dialogs message on

 

this runs a collision check over all selected toolpaths selected in the explorer

 

Message 25 of 30
anto_joseph4HH2K
in reply to: Anonymous

anto_joseph4HH2K
Participant
Participant

Its not working it shows the following error message

Capture.JPG

 Not sure if am missing any plugin or files asociated with the powermill application in order to run the macros

 

0 Likes

Its not working it shows the following error message

Capture.JPG

 Not sure if am missing any plugin or files asociated with the powermill application in order to run the macros

 

Message 26 of 30
icse
in reply to: anto_joseph4HH2K

icse
Collaborator
Collaborator

wich PM version do you use?

 

you could try this:


entity list $tps = explorer_selected_entities()

//if nothing was selected we exit the macro here
if size($tps) < 1 {
	return
}

dialogs message off

//iterate over all selected toolpaths with the foreach loop
foreach $tp in $tps {

	// activate the next toolpath
	ACTIVATE TOOLPATH ${tp.Name}
	
	//set the parameter for collision check
	EDIT COLLISION TYPE GOUGE
	EDIT COLLISION APPLY
	EDIT COLLISION TYPE COLLISION
	EDIT COLLISION STOCKMODEL_CHECK N
	EDIT COLLISION SPLIT_TOOLPATH N
	EDIT PAR 'Verification.UseVerificationThickness' 0
	EDIT COLLISION SHANK_CLEARANCE "0.0"
	EDIT COLLISION HOLDER_CLEARANCE "0.1"
	EDIT COLLISION ADJUST_TOOL N
	EDIT COLLISION APPLY
}

dialogs message on
0 Likes

wich PM version do you use?

 

you could try this:


entity list $tps = explorer_selected_entities()

//if nothing was selected we exit the macro here
if size($tps) < 1 {
	return
}

dialogs message off

//iterate over all selected toolpaths with the foreach loop
foreach $tp in $tps {

	// activate the next toolpath
	ACTIVATE TOOLPATH ${tp.Name}
	
	//set the parameter for collision check
	EDIT COLLISION TYPE GOUGE
	EDIT COLLISION APPLY
	EDIT COLLISION TYPE COLLISION
	EDIT COLLISION STOCKMODEL_CHECK N
	EDIT COLLISION SPLIT_TOOLPATH N
	EDIT PAR 'Verification.UseVerificationThickness' 0
	EDIT COLLISION SHANK_CLEARANCE "0.0"
	EDIT COLLISION HOLDER_CLEARANCE "0.1"
	EDIT COLLISION ADJUST_TOOL N
	EDIT COLLISION APPLY
}

dialogs message on
Message 27 of 30
anto_joseph4HH2K
in reply to: Anonymous

anto_joseph4HH2K
Participant
Participant

Still not working,I use 2022 version

0 Likes

Still not working,I use 2022 version

Message 28 of 30
icse
in reply to: anto_joseph4HH2K

icse
Collaborator
Collaborator

how do you run the macro?

0 Likes

how do you run the macro?

Message 29 of 30
anto_joseph4HH2K
in reply to: Anonymous

anto_joseph4HH2K
Participant
Participant

Capture.JPG

0 Likes

Capture.JPG

Message 30 of 30
evo80
in reply to: Anonymous

evo80
Collaborator
Collaborator

Good Day,

The only things I find with this function structure is I'm unable to debug, you get the 'variable missing' error when you try to debug??

Do you guys find this?

FUNCTION Main(
    STRING $Selected_tool
    ) 
    {
    ACTIVATE TOOL $Selected_tool     
    EDIT TOOLSTOCKMATERIAL SPECIFIED_TOOL $Selected_tool FORM SETSTOCKMATTOOL        
    EDIT TOOLSTOCKMATERIAL MATERIAL "A36-(P)"
    FORM APPLY SETSTOCKMATTOOL
    FORM ACCEPT SETSTOCKMATTOOL
    return
}
0 Likes

Good Day,

The only things I find with this function structure is I'm unable to debug, you get the 'variable missing' error when you try to debug??

Do you guys find this?

FUNCTION Main(
    STRING $Selected_tool
    ) 
    {
    ACTIVATE TOOL $Selected_tool     
    EDIT TOOLSTOCKMATERIAL SPECIFIED_TOOL $Selected_tool FORM SETSTOCKMATTOOL        
    EDIT TOOLSTOCKMATERIAL MATERIAL "A36-(P)"
    FORM APPLY SETSTOCKMATTOOL
    FORM ACCEPT SETSTOCKMATTOOL
    return
}

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

Post to forums  

Autodesk Design & Make Report