Macro WHILE query not working when using 'OR'

Macro WHILE query not working when using 'OR'

siwalker
Enthusiast Enthusiast
314 Views
2 Replies
Message 1 of 3

Macro WHILE query not working when using 'OR'

siwalker
Enthusiast
Enthusiast

I am trying to do a check in my macro that either a radius tool or end mill is selected but I only seem to be able to get it to work when querying one of the two things but when I want it to query both of these things it doesn't seem to work as expected.

 

Code that doesn't work:

 

STRING $Tooltypes = entity('tool','').type

WHILE NOT ($Tooltypes == "tip_radiused") OR ($Tooltypes == "end_mill") {
MESSAGE ERROR 'Wrong tool type selected'
MACRO PAUSE "Please activate suitable slot drill" +CRLF+ "for predrill machining"
$Tooltypes = entity('tool','').type
}

 

Also code that doesn't work:

 

STRING $Tooltypes = entity('tool','').type

WHILE NOT ($Tooltypes == "tip_radiused") OR NOT ($Tooltypes == "end_mill") {
MESSAGE ERROR 'Wrong tool type selected'
MACRO PAUSE "Please activate suitable slot drill" +CRLF+ "for predrill machining"
$Tooltypes = entity('tool','').type
}

 

Code that does work:

 

STRING $Tooltypes = entity('tool','').type

WHILE NOT ($Tooltypes == "tip_radiused") {
MESSAGE ERROR 'Wrong tool type selected'
MACRO PAUSE "Please activate suitable slot drill" +CRLF+ "for predrill machining"
$Tooltypes = entity('tool','').type
}

 

Also code that works:

 

STRING $Tooltypes = entity('tool','').type

WHILE NOT ($Tooltypes == "end_mill") {
MESSAGE ERROR 'Wrong tool type selected'
MACRO PAUSE "Please activate suitable slot drill" +CRLF+ "for predrill machining"
$Tooltypes = entity('tool','').type
}

 

 

If someone can let me know how to fix this or an alternative way of doing this it would be much appreciated. 

0 Likes
Accepted solutions (1)
315 Views
2 Replies
Replies (2)
Message 2 of 3

ondrej.mikulec
Advocate
Advocate
Accepted solution
STRING $Tooltypes = entity('tool','').type

WHILE NOT (($Tooltypes == "tip_radiused") OR ($Tooltypes == "end_mill")) {
MESSAGE ERROR 'Wrong tool type selected'
MACRO PAUSE "Please activate suitable slot drill" +CRLF+ "for predrill machining"
$Tooltypes = entity('tool','').type
}

 

STRING $Tooltypes = entity('tool','').type

WHILE $Tooltypes != "tip_radiused" AND $Tooltypes != "end_mill" {
MESSAGE ERROR 'Wrong tool type selected'
MACRO PAUSE "Please activate suitable slot drill" +CRLF+ "for predrill machining"
$Tooltypes = entity('tool','').type
}
0 Likes
Message 3 of 3

siwalker
Enthusiast
Enthusiast

Thanks. I thought I was missing something simple. Looks like I just needed some additional brackets.

0 Likes