Author Topic: Change color - weird behaviour  (Read 488 times)

0 Members and 1 Guest are viewing this topic.

w64bit

  • Newt
  • Posts: 74
Change color - weird behaviour
« 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.

Lee Mac

  • Seagull
  • Posts: 12726
  • London, England
Re: Change color - weird behaviour
« Reply #1 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 ""))

w64bit

  • Newt
  • Posts: 74
Re: Change color - weird behaviour
« Reply #2 on: August 01, 2022, 03:59:04 AM »
Thank you very much.