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

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
p.valente
544 Views, 2 Replies

Rename NcPrograms

Hi,

I have a macro to rename all NCPROGRAMS in tree.

 

 

Reset localvars


//Deseja alterar todos os nome dos NCPROGRAMS ?

 

string yesorno = "Clica SIM, para renomear os Ncprograms" + crlf + "Clica NAO, para cancelar a macro"
bool yes = 0
$yes = QUERY $yesorno

IF yes {


STRING $nombre = ""

INT $COUNT = INPUT "Introduz numero do primeiro programa"


// Nomear todos os Ncprograms ou só os selecionados

 

string allorno = "Click SIM, para renomear os Ncprograms" + crlf + "Clica NAO, outras opcoes"
bool yes = 0
$yes = QUERY $allorno

 

IF $yes == 1 {

 

// Numerar todos os Ncprograms

 

FOREACH Ncp IN folder ('NCProgram') {
ACTIVATE NCPROGRAM $Ncp.name
STRING NewName = ($nombre + $COUNT)
$COUNT = $COUNT + 1

RENAME NCPROGRAM ; $NewName
}

 


}

 

 

 

The problem is: this macro rename all programs inside NCPROGRAM tree.

Is it possible rename the programs only inside ACTIVE FORDER ? (Red Arrow)

 

 

red arrow.png

 

Thanks in advance 

With best regards

Pedro Valente

2 REPLIES 2
Message 2 of 3
Cobra.007
in reply to: p.valente

Try the following

 

 

STRING NewName = ""

STRING Fold = ACTIVE_FOLDER()

 

FOREACH Ncp IN folder ($Fold) {
ACTIVATE NCPROGRAM $Ncp.name
$NewName = ($nombre + $COUNT)
$COUNT = $COUNT + 1

RENAME NCPROGRAM ; $NewName

Message 3 of 3
p.valente
in reply to: p.valente

All Perfect..

Thank you Thank you

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

Post to forums  

Autodesk Design & Make Report