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: 

Help with IF Statement

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Beta_Librae
303 Views, 6 Replies

Help with IF Statement

Salutations All,

 

Thought this one was gonna be easy for me, I was wrong.

 

Would greatly appreciate if anyone would tell me what's wrong with this code?

 

IF $Pattern == "CLAMP POCKET" {
RENAME Pattern "CLAMP POCKET" "CLAMP POCKET_1"


Kind Regards,
Not cnc, you can call me Peabrain
6 REPLIES 6
Message 2 of 7

STRING $CP = "CLAMP POCKET"
 IF ENTITY_EXISTS('pattern', CP) {
 RENAME Pattern $CP "CLAMP POCKET_1"
 }
Message 3 of 7

Thank you kindly, much appreciated.

 

I'm guessing that I can follow the same format for a toolpath?


Kind Regards,
Not cnc, you can call me Peabrain
Message 4 of 7
rafael.sansao
in reply to: Beta_Librae

You can also use the new_entity_name() command.

With this approach you will never get an error when running the macro.

 

STRING $CP = "CLAMP POCKET"
IF ENTITY_EXISTS("Pattern", $CP) {
	RENAME Pattern $CP ${new_entity_name("Pattern", $CP)}
}

 

STRING $TP = "TOOLPATH NAME"
IF ENTITY_EXISTS("Toolpath", $TP) {
	RENAME Toolpath $TP ${new_entity_name("Toolpath", $TP)}
}

 

Rafael Sansão

EESignature

Message 5 of 7
Beta_Librae
in reply to: rafael.sansao

Thanks Rafael,

 

Really appreciate your input. Always glad to know more ways than one.


Kind Regards,
Not cnc, you can call me Peabrain
Message 6 of 7
dan_mickle
in reply to: rafael.sansao

Does new_entity_name capture the name of the newly created entity automatically? How does it work?
Message 7 of 7
rafael.sansao
in reply to: dan_mickle

rafaelsansao_0-1720470838488.png

 

Rafael Sansão

EESignature

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report