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 FOR RENAME NC PROGRAM

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
855 Views, 3 Replies

MACRO FOR RENAME NC PROGRAM

Good Morning to everyone, 

 

I'm serching a way to do a Macro for renaming NC programs.

Often i work on projects with 50 Nc programs  or more, 1 nc program every 1 toothpath.

I would like to have a macro ask me the "name" of the project and renaming from the first nc program to the last nc program with this form:

 

01_"name"

02_"name"

etc.

 

This is possible? Someone can help me?

 

Thank u in advance!

Cristiano

Labels (1)
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Hi to all, 

 

I have found this macro for renaming all nc programs but don't work if in $jobnumber i write not a number but some number+letters. 

 

example: If i write 8c24t4 the macro rename whit 0 value.

 

Is there a way to have an alphanumeric character written in the $jobnumber?

 

 

INT $jobnumber = INPUT "Input job number."
INT $setupnumber = INPUT "Input setup number"
INT $i = 01

FOREACH $nc IN FOLDER('ncprogram') {
STRING newname = $jobnumber + "-" + "S" + $setupnumber + "-" + $i
IF NOT ENTITY_EXISTS(entity('ncprogram', $newname)) {
RENAME NCPROGRAM $nc $newname
}
$i = $i + 1
}

 

Thanks in advance,

Cristiano

 

 

 

Message 3 of 4
Anonymous
in reply to: Anonymous

SOLVED THANKS!

Message 4 of 4
lee_sanders
in reply to: Anonymous

Hi @Anonymous 

 

try this,

 

//This macro puts the prefix (User input 'ProjectName') after each ncprogram name

STRING $ProjectName = INPUT "Input Project Name"

FOREACH ent IN folder ('ncprogram') {
ACTIVATE ncprogram $ent.Name
STRING TP_NAME = STRING($ent.Name) + '_' + $ProjectName
PRINT $TP_NAME
RENAME ncprogram $ent.Name $TP_NAME
}

 

 

 

Lee


Lee Sanders
Technical Consultant

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report