Change Color routine too Slow

Discussion in 'AutoCAD' started by MarcelGosselin, Mar 31, 2005.

  1. I found the following in this group. How can I make it work with true colors? I created a lisp routine changecolor253.lsp using command "-layer" but it is too slow with larger layers list.

    (defun lay_col_chg (oldcolor newcolor / layers)
    (vl-load-com)
    (setq layers (vla-get-layers
    (vla-get-activedocument
    (vlax-get-acad-object))))
    (vlax-for x layers
    (if (= oldcolor (vla-get-color x))
    (vla-put-color x newcolor)
    )
    )
    (princ)
    )
     
    MarcelGosselin, Mar 31, 2005
    #1
  2. MarcelGosselin

    Jeff Mishler Guest

    I only work in R2002 so I can't give you specifics, but look into modifying
    the original routine to use the TrueColor property in place of the Color
    property.
     
    Jeff Mishler, Apr 1, 2005
    #2
  3. MarcelGosselin

    LUCAS Guest

    ;;BY LUCAS
    (defun C:IX00 (/ RECORD ENT)
    (while (setq RECORD (tblnext "layer" (null RECORD)))
    (if (= (cdr (assoc 62 RECORD)) 253)
    (progn
    (setq ENT (entget (tblobjname "LAYER" (cdr (assoc 2 RECORD)))))
    (setq ENT (vl-remove (assoc 62 ENT) ENT))
    (setq ENT (append ENT '((62 . 7) (420 . 15921906))))
    (entmod ENT)
    )
    )
    )
    (princ)
    )

    colors? I created a lisp routine changecolor253.lsp using command "-layer"
    but it is too slow with larger layers list.
     
    LUCAS, Apr 1, 2005
    #3
  4. MarcelGosselin

    LUCAS Guest

    ;;By LUCAS
    ;;(LAY_COL_CHG 253 '(242 242 242))
    (defun LAY_COL_CHG (OLDCOLOR NEWCOLOR / COLOROBJ)
    (vl-load-com)
    (setq COLOROBJ (vla-getinterfaceobject
    (vlax-get-acad-object)
    "AutoCAD.AcCmColor.16"
    )
    )
    (vla-setrgb
    COLOROBJ
    (car NEWCOLOR)
    (cadr NEWCOLOR)
    (last NEWCOLOR)
    )
    (vlax-for X (vla-get-layers
    (vla-get-activedocument
    (vlax-get-acad-object)
    )
    )
    (if (= OLDCOLOR (vla-get-color X))
    (vla-put-truecolor X COLOROBJ)
    )
    )
    (vlax-release-object COLOROBJ)
    (princ)
    )

    colors? I created a lisp routine changecolor253.lsp using command "-layer"
    but it is too slow with larger layers list.
     
    LUCAS, Apr 1, 2005
    #4
  5. Thank your very much, I have only tried your second solution and it is great! I will review later and see if I can understand your code. Thanks again
     
    MarcelGosselin, Apr 1, 2005
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.