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 with incremental number and letter

1 REPLY 1
Reply
Message 1 of 2
evo80
110 Views, 1 Reply

Rename with incremental number and letter

Good Day,

So I have a renaming macro which will numerically number each selected toolpath,

but instead of numbering numerically I'd like to be able to number selected toolpaths thus,

1a,1b,1c and so on.

 

 FOREACH $tp IN explorer_selected_entities() {

	  If $tp.Strategy == 'drill' AND $tp.drill.type == 'single_peck' {
        
          
RENAME TOOLPATH $tp.Name ${ i + tp.Strategy + tp.drill.type + tp.Tool.name + "-T" + tp.tool.number  }

$i = $i + 1

 

 Just a wee snippet of the numbering code, what would I have to change to output the incremental number and incremental letter? 

Regards

 

 

Labels (1)
1 REPLY 1
Message 2 of 2
icse
in reply to: evo80

you could do it like this:

string list $abc = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}
int $index = 0
foreach $tp in $explorer_selected_entities() {
	string $newname = $tp.Name + $abc[$index]
	if entity_exists('toolpath',$newname) {
		$newname = new_entity_name('toolpath',$newname)
	}
	rename toolpath ${tp.Name} ${newname}
	$index = $index + 1
	if $index > 25 {
		$index = 0
	}
}

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

Post to forums  

Autodesk Design & Make Report