TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: w64bit on July 31, 2022, 06:58:59 AM

Title: Change color - weird behaviour
Post by: w64bit on July 31, 2022, 06:58:59 AM
I noticed that if I use in a script file:
Code: [Select]
(if (setq clr1 (ssget "X" (list '(-4 . "&=") '(62 . 250) (cons 410 "Model")))) (command "CHPROP" clr1 "" "C" 251 ""))
(if (setq clr2 (ssget "X" (list '(-4 . "&=") '(62 . 254) (cons 410 "Model")))) (command "CHPROP" clr2 "" "C" 253 ""))
The last line is changing the color to 251 instead 253. Why?
If I switch the lines, all it's OK.
Title: Re: Change color - weird behaviour
Post by: Lee Mac on July 31, 2022, 05:05:47 PM
DXF group 62 is not bit-coded and so you shouldn't use the bitwise operator in the ssget filter list - try:
Code - Auto/Visual Lisp: [Select]
  1. (if (setq clr1 (ssget "X" '((62 . 250) (410 . "Model")))) (command "_.CHPROP" clr1 "" "_C" 251 ""))
  2. (if (setq clr2 (ssget "X" '((62 . 254) (410 . "Model")))) (command "_.CHPROP" clr2 "" "_C" 253 ""))
Title: Re: Change color - weird behaviour
Post by: w64bit on August 01, 2022, 03:59:04 AM
Thank you very much.