MACRO : Serial Number in toolpath.

MACRO : Serial Number in toolpath.

Anonymous
Not applicable
2,106 Views
9 Replies
Message 1 of 10

MACRO : Serial Number in toolpath.

Anonymous
Not applicable

Hi,

Is there any macro available for put value/ alphabets before or after toolpath name?

Its should be in serial/sequence wise. Like below image.

 

 

tppl name.PNG

 

 

 

regards,

 

 Krupal vala

0 Likes
Accepted solutions (1)
2,107 Views
9 Replies
Replies (9)
Message 2 of 10

5axes
Advisor
Advisor
Accepted solution

like this one ?

 

// Permet de renuméroter les parcours 
// avec X) nom du parcours

GRAPHICS LOCK
//RAZ TPNUM
INT $TPNUM = 0
STRING $TPNUMS = ""

FOREACH tp IN folder ('TOOLPATH') {
$TPNUM = $TPNUM + 1
IF $TPNUM < 10 {
	$TPNUMS = "0" + STRING($TPNUM)
} ELSE {
	$TPNUMS = STRING($TPNUM)
}

STRING $NEWNAME = ""
REAL $CharSep = 0
ACTIVATE TOOLPATH $tp.Name
//
$CharSep = position($tp.Name, ")")
// Test if ')' is present in the name or if it's present but after a theoretical XXX) position
IF $CharSep == -1 OR $CharSep >4 {
   STRING $ADDUNDER = ") " + $tp.Name
   RENAME TOOLPATH ; $ADDUNDER
   }
$CharSep = position($tp.Name, ") ")
$CharSep = $CharSep + 1 
//
STRING $DEL = substring($tp.Name , 0, $CharSep) 
PRINT $DEL
$NEWNAME = replace(tp.Name, $DEL, $TPNUMS + ')') 
RENAME TOOLPATH ; $NEWNAME
}
GRAPHICS UNLOCK
MESSAGE INFO "END OF PROCESS"
Message 3 of 10

Anonymous
Not applicable

thanx @5axes

 

result.PNGSmiley Happy

Message 4 of 10

Pradipio
Autodesk Support
Autodesk Support

hi @5axes,

 

Your Macro for Rename is working fine for First trail, But If i select 2nd time by mistake it will again regenerate Sequence no. with old one.

Please find attached image for your reference.

 

also i attached one Rename toolpath utilities, but unfortunately it was working till 2017 version only. 

If you have any Utility / Macro please share.

 

#PM


-------------------------------------------------
THANKS
Pradip Mistry

”Community
0 Likes
Message 5 of 10

Anonymous
Not applicable

hi @Pradipio

 

it try & same thing happen.

 

@5axes is any solution available  if we make  this type of mistake ?

 

 

regards,

 

Krupal vala

0 Likes
Message 6 of 10

5axes
Advisor
Advisor
Normaly should be ok, Works fine for me. Even if y launch the macro several Times
0 Likes
Message 7 of 10

Anonymous
Not applicable

hi @Pradipio & @5axes

 

I try this macro in diff. diff project. some time powermill show this type of error "Powermill has stopped working" but it may due to load or other perpetrates.

 

even if I put 01) value before toolpath now it's not repeating & giving right sequences 01) 02) 03)...n.

 

@Pradipio if possible can you upload any project video what is happening??? 

 

 

regards,

krupal vala

 

 

 

0 Likes
Message 8 of 10

5axes
Advisor
Advisor
Try to change :
$CharSep = position($tp.Name, ") ")
By
$CharSep = position($tp.Name, ")")


Message 9 of 10

Pradipio
Autodesk Support
Autodesk Support

hi @5axes,

not is works perfect,

Thanks for editing.

Cheers,

#PM


-------------------------------------------------
THANKS
Pradip Mistry

”Community
Message 10 of 10

O.C.
Enthusiast
Enthusiast

Is it possible to have the macro add 00 to toolpaths 1-9, 0 to toolpaths 10-99, and no zero to toolpaths 100 and up?

 

0 Likes