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: 

rename Ncprograms macro

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
hrh46
312 Views, 4 Replies

rename Ncprograms macro

I have a macro renaming all toolpaths by an index number and tool name.is it possible to rename ncprograms based on

new toolpaths name?

4 REPLIES 4
Message 2 of 5
icse
in reply to: hrh46

I think so...

But i need more information about how you whant to rename the nc program.

 

Can you give me an example?

Message 3 of 5
hrh46
in reply to: icse

Ok. This machine has no tool change, so each nc prog even if has multiple toolpaths, use only one unique tool.

assume toolpaths:

1_EM8

4_EM10

5_EM10   

one Nc has both 4_EM10 and 5_EM10, So renaming Ncs should be something like:

1_EM8

4_And_5_EM10

Message 4 of 5
icse
in reply to: hrh46

can you try this:

entity list $ncs = input entity multiple ncprogram 'select nc programs wich should be renamed:'

if size($ncs) < 1 {
	return
}


foreach $nc in $ncs {

	if size(components($nc)) < 1 {
		continue
	}
	
	string list $tpsuffixes = {}
	
	foreach $tp in components($nc) {
		int $i = add_last($tpsuffixes, tokens($tp.Name,'_')[0])
	}
	string $newNcName = join($tpsuffixes,'_And_') + '_' + components($nc)[0].Tool.Name
	
	if $nc.Name == $newNcName {
		continue
	}
	
	if entity_exists('ncprogram',$newNcName) {
		$newNcName = new_entity_name('ncprogram',$newNcName)
	}
	
	rename ncprogram ${nc.Name} ${newNcName}
}
Message 5 of 5
hrh46
in reply to: icse

Many Thanks. that was what I need.

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

Post to forums  

Autodesk Design & Make Report