I have a macro renaming all toolpaths by an index number and tool name.is it possible to rename ncprograms based on
new toolpaths name?
Solved! Go to Solution.
Solved by icse. Go to Solution.
Ok. This machine has no tool change, so each nc prog even if has multiple toolpaths, use only one unique tool.
assume toolpaths:
1_EM8
4_EM10
5_EM10
one Nc has both 4_EM10 and 5_EM10, So renaming Ncs should be something like:
1_EM8
4_And_5_EM10
can you try this:
entity list $ncs = input entity multiple ncprogram 'select nc programs wich should be renamed:'
if size($ncs) < 1 {
return
}
foreach $nc in $ncs {
if size(components($nc)) < 1 {
continue
}
string list $tpsuffixes = {}
foreach $tp in components($nc) {
int $i = add_last($tpsuffixes, tokens($tp.Name,'_')[0])
}
string $newNcName = join($tpsuffixes,'_And_') + '_' + components($nc)[0].Tool.Name
if $nc.Name == $newNcName {
continue
}
if entity_exists('ncprogram',$newNcName) {
$newNcName = new_entity_name('ncprogram',$newNcName)
}
rename ncprogram ${nc.Name} ${newNcName}
}
Can't find what you're looking for? Ask the community or share your knowledge.