AbdRF Posted April 25, 2020 Posted April 25, 2020 Hi, I want to select text that is both on the layer "notes" and the color 3 using XOR operator. (ssget '( (0 . "text") (-4 . "<xor") (-4 . "<and") (8 . "notes") (62 . 3) (-4 . "and>") (-4 . "xor>") )) But why I am getting "nil" as return value? What is wrong with the above piece of code? Thanks Quote
Lee Mac Posted April 25, 2020 Posted April 25, 2020 You don't need the XOR operator (i.e. exclusive OR) to obtain the desired result - you actually don't need any logical operators at all in this instance, as all of the elements of the filter list are applied with an implicit AND logic, and so the code can become: (ssget '((0 . "TEXT") (8 . "notes") (62 . 3))) Quote
AbdRF Posted April 25, 2020 Author Posted April 25, 2020 (edited) 5 hours ago, Lee Mac said: You don't need the XOR operator (i.e. exclusive OR) to obtain the desired result - you actually don't need any logical operators at all in this instance, as all of the elements of the filter list are applied with an implicit AND logic, and so the code can become: (ssget '((0 . "TEXT") (8 . "notes") (62 . 3))) I am learning how to use conditional operators with ssget function.I am aware that it can be done with above method.Just for learning purpose ,I wanted to try using XOR .But got nil with XOR method Thanks Edited April 25, 2020 by AbdRF Quote
Jonathan Handojo Posted April 26, 2020 Posted April 26, 2020 1 hour ago, AbdRF said: I am learning how to use conditional operators with ssget function.I am aware that it can be done with above method.Just for learning purpose ,I wanted to try using XOR .But got nil with XOR method Thanks XOR means that it matches any one of the conditions set, but not all of it. You'll have to use the AND operator as Lee stated if you'd want to use conditional operators: 1 Quote
Lee Mac Posted April 26, 2020 Posted April 26, 2020 22 hours ago, AbdRF said: I am learning how to use conditional operators with ssget function.I am aware that it can be done with above method.Just for learning purpose ,I wanted to try using XOR .But got nil with XOR method The XOR operator is not suited to your task, as you are specifically looking to select text objects with "layer 'notes' and the color 3" whereas, if you were to use the XOR operator in the following way: (ssget '((0 . "TEXT") (-4 . "<XOR") (8 . "notes") (62 . 3) (-4 . "XOR>"))) The user would be able to select text on the "notes" layer or set to colour 3, but not both. Quote
AbdRF Posted April 28, 2020 Author Posted April 28, 2020 On 4/27/2020 at 3:23 AM, Lee Mac said: The XOR operator is not suited to your task, as you are specifically looking to select text objects with "layer 'notes' and the color 3" whereas, if you were to use the XOR operator in the following way: (ssget '((0 . "TEXT") (-4 . "<XOR") (8 . "notes") (62 . 3) (-4 . "XOR>"))) The user would be able to select text on the "notes" layer or set to colour 3, but not both. I got it @Lee Mac.Thanks for clearing it out. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.