Macro Rename Toolpath again

Macro Rename Toolpath again

gosmann.andreas
Advocate Advocate
894 Views
6 Replies
Message 1 of 7

Macro Rename Toolpath again

gosmann.andreas
Advocate
Advocate

I have a Macro thx to you that renames all toolpath.

What i like to do is that the macro should jump over disc profile finishing strategie. Every other toolpath should be renamed. Is something like that possible.

String $New_Name = ""
Int $Index = 0

FOREACH tp IN FOLDER('toolpath') {
    $Index = $Index + 1
	$New_Name = $Index + " - " + $tp.Strategy + " - " + $tp.Tool.Name
	IF $tp.Strategy == "drill" {
	    $New_Name = $Index + " - " + $tp.Strategy + " - " + $tp.FeatureSet.name + " - " + $tp.Tool.Name
	    RENAME Toolpath $tp.name $New_Name
	} ELSE {
	RENAME Toolpath $tp.name $New_Name
	}
}
Accepted solutions (1)
895 Views
6 Replies
Replies (6)
Message 2 of 7

danmic7JH66
Advocate
Advocate

You could try adding 

IF NOT Strategy == "disk_profile" {
//rest of code
}

so it will only run the stuff between the { } if the strategy is not a disk profile strategy. Might be a simple work around for you.

 

Message 3 of 7

rafael.sansao
Advisor
Advisor
Accepted solution

or:

String $New_Name = ""
Int $Index = 0

FOREACH tp IN FOLDER('toolpath') {
	IF $tp.Strategy == "disc_profile" {
		CONTINUE
	}
    $Index = $Index + 1
	$New_Name = $Index + " - " + $tp.Strategy + " - " + $tp.Tool.Name
	IF $tp.Strategy == "drill" {
	    $New_Name = $Index + " - " + $tp.Strategy + " - " + $tp.FeatureSet.name + " - " + $tp.Tool.Name
	    RENAME Toolpath $tp.name $New_Name
	} ELSE {
		RENAME Toolpath $tp.name $New_Name
	}
}

Rafael Sansão

OptiNC - www.optinc.tech

EESignature

Message 4 of 7

danmic7JH66
Advocate
Advocate

@rafael.sansao wrote:

or:

String $New_Name = ""
Int $Index = 0

FOREACH tp IN FOLDER('toolpath') {
	IF $tp.Strategy == "disc_profile" {
		CONTINUE
	}
    $Index = $Index + 1
	$New_Name = $Index + " - " + $tp.Strategy + " - " + $tp.Tool.Name
	IF $tp.Strategy == "drill" {
	    $New_Name = $Index + " - " + $tp.Strategy + " - " + $tp.FeatureSet.name + " - " + $tp.Tool.Name
	    RENAME Toolpath $tp.name $New_Name
	} ELSE {
		RENAME Toolpath $tp.name $New_Name
	}
}

How does the "CONTINUE" command work? Is that any different then just leaving it blank between the{ }?

0 Likes
Message 5 of 7

rafael.sansao
Advisor
Advisor

Yes. CONTINUE "aborts" the current loop. See the description in the guide:

Capturar.PNG

Rafael Sansão

OptiNC - www.optinc.tech

EESignature

Message 6 of 7

danmic7JH66
Advocate
Advocate

Ah, thanks, surprised I missed that when I read through. Appreciated

Message 7 of 7

gosmann.andreas
Advocate
Advocate

Thank you works fine