MACRO DEBUG

MACRO DEBUG

Anonymous
Not applicable
1,309 Views
5 Replies
Message 1 of 6

MACRO DEBUG

Anonymous
Not applicable

This macro is not acting like i hoped it would, and I am out of ideas on what to change. This macro is intended to change the Speed and Feed in each toolpath so long as the tool meets the criteria in the macro options. If the tool does not meet the criteria in the macro, I would like the macro to add a suffix to the existing toolpath name of "_SPEED AND FEED NOT SET".

 

The way the macro is, none of the speeds and feeds get updated and none of the names get changed.

 

Thank you in advance,

Bruce

 

FOREACH $ent IN folder('TOOLPATH') {

ACTIVATE TOOLPATH $ENT.name

REAL $Dia = $tool.diameter
REAL $Thick = $toolpath.thickness

STRING $Name = $toolpath.Name
STRING $Suffix = "_SPEED AND FEED NOT SET"
STRING $NewName = $Name + $Suffix


// ############### 1.0" TOOL ###############
IF ($Dia > 0.999 AND $Dia < 1.001) {
		IF $Thick == 0 {
		EDIT RPM "100"
		EDIT FRATE "100"
		} ELSE {
		EDIT RPM "200"
		EDIT FRATE "200"
		}
	} 
	
// ############### .750" TOOL ###############
IF ($Dia > 0.749 AND $Dia < 0.751) {
		IF $Thick == 0 {
		EDIT RPM "300"
		EDIT FRATE "300"
		} ELSE {
		EDIT RPM "400"
		EDIT FRATE "400"
		}
	} 
	
// ############### .500" TOOL ###############
IF ($Dia > 0.499 AND $Dia < 0.501) {
		IF $Thick == 0 {
		EDIT RPM "500"
		EDIT FRATE "500"
		} ELSE {
		EDIT RPM "600"
		EDIT FRATE "600"
		}
	}
		} ELSE {
		RENAME TOOLPATH ; $NewName
		}

 

0 Likes
Accepted solutions (1)
1,310 Views
5 Replies
Replies (5)
Message 2 of 6

rui_rita
Advocate
Advocate
Accepted solution
hi try this REAL $Dia = 0 REAL $Thick = 0 STRING $Name = "" STRING $Suffix = "" STRING $NewName = "" FOREACH $ent IN folder('TOOLPATH') { ACTIVATE TOOLPATH $ent.name $Dia = $tool.diameter $Thick = $toolpath.thickness $Name = $toolpath.Name $Suffix = "_SPEED AND FEED NOT SET" $NewName = $Name + $Suffix // ############### 1.0" TOOL ############### IF ($Dia > 0.999 AND $Dia < 0.001) { IF $Thick == 0 { EDIT RPM "100" EDIT FRATE "100" RESET TOOLPATH FEEDRATE } ELSE { EDIT RPM "200" EDIT FRATE "200" RESET TOOLPATH FEEDRATE } // ############### .750" TOOL ############### } ELSEIF ($Dia > 0.749 AND $Dia < 0.751) { IF $Thick == 0 { EDIT RPM "300" EDIT FRATE "300" RESET TOOLPATH FEEDRATE } ELSE { EDIT RPM "400" EDIT FRATE "400" RESET TOOLPATH FEEDRATE } // ############### .500" TOOL ############### } ELSEIF ($Dia > 0.499 AND $Dia < 0.501) { IF $Thick == 0 { EDIT RPM "500" EDIT FRATE "500" RESET TOOLPATH FEEDRATE } ELSE { EDIT RPM "600" EDIT FRATE "600" RESET TOOLPATH FEEDRATE } } ELSE { RENAME TOOLPATH ; $NewName } }


Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
Message 3 of 6

rui_rita
Advocate
Advocate

don't know what happen, but the text was a mess, I hope you can see correctly in the next post

 



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
0 Likes
Message 4 of 6

rui_rita
Advocate
Advocate

REAL $Dia = 0
REAL $Thick = 0

STRING $Name = ""
STRING $Suffix = ""
STRING $NewName = ""

FOREACH $ent IN folder('TOOLPATH') {

ACTIVATE TOOLPATH $ent.name

$Dia = $tool.diameter
$Thick = $toolpath.thickness

$Name = $toolpath.Name
$Suffix = "_SPEED AND FEED NOT SET"
$NewName = $Name + $Suffix


// ############### 1.0" TOOL ###############
IF ($Dia > 0.999 AND $Dia < 0.001) {
IF $Thick == 0 {
EDIT RPM "100"
EDIT FRATE "100"
RESET TOOLPATH FEEDRATE
} ELSE {
EDIT RPM "200"
EDIT FRATE "200"
RESET TOOLPATH FEEDRATE
}

// ############### .750" TOOL ###############
} ELSEIF ($Dia > 0.749 AND $Dia < 0.751) {
IF $Thick == 0 {
EDIT RPM "300"
EDIT FRATE "300"
RESET TOOLPATH FEEDRATE
} ELSE {
EDIT RPM "400"
EDIT FRATE "400"
RESET TOOLPATH FEEDRATE
}

// ############### .500" TOOL ###############
} ELSEIF ($Dia > 0.499 AND $Dia < 0.501) {
IF $Thick == 0 {
EDIT RPM "500"
EDIT FRATE "500"
RESET TOOLPATH FEEDRATE
} ELSE {
EDIT RPM "600"
EDIT FRATE "600"
RESET TOOLPATH FEEDRATE
}
} ELSE {
RENAME TOOLPATH ; $NewName
}
}



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
0 Likes
Message 5 of 6

Anonymous
Not applicable
Thank you rui.rita! I was struggling with that for a long time. I had never used an ELSEIF statement. Thank you again! Bruce
0 Likes
Message 6 of 6

rui_rita
Advocate
Advocate

just for the record, the points I change:

 

1. declare the variables before the foreach cycle...

     avoids error that the variable already existe

 

2 add the command "RESET TOOLPATH FEEDRATE" to apply the changes.

 

3 some missing { } in the code.

 

glad I help 



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
0 Likes