TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: FELIX on April 13, 2014, 08:11:42 PM

Title: Change color LWPOLYLINE
Post by: FELIX on April 13, 2014, 08:11:42 PM
How modifying the color of a lwpoyline?

assoc 62 does not work.
Title: Re: Change color LWPOLYLINE
Post by: Jeff_M on April 13, 2014, 08:41:42 PM
This works for me:
Code: [Select]
(setq ent (entget (car (entsel))))
(if (assoc 62 ent)
  (entmod (subst '(62 . 256) (assoc 62 ent) ent));;change to bylayer
  (entmod (reverse (cons '(62 . 2) (reverse ent))));;change to yellow
  )
Title: Re: Change color LWPOLYLINE
Post by: FELIX on April 13, 2014, 11:57:07 PM
OK.
Title: Re: Change color LWPOLYLINE
Post by: mailmaverick on April 14, 2014, 12:15:32 AM
Dear Jeff

Why third line (1st entmod) is required ?

Why can't only 2nd entmod be applied directly ?
Title: Re: Change color LWPOLYLINE
Post by: pBe on April 14, 2014, 02:22:51 AM
Why can't only 2nd entmod be applied directly ?

Exactly.

Regardless wether  DXF 62 exist or not  you can just go ahead and use append function

Code: [Select]
(if (and (setq e (car (entsel)))
    (setq ent (entget e))
    )
  (entmod (append ent '((62 . 52)));<<- whatever color
)