Author Topic: Change color LWPOLYLINE  (Read 1620 times)

0 Members and 1 Guest are viewing this topic.

FELIX

  • Bull Frog
  • Posts: 242
Change color LWPOLYLINE
« on: April 13, 2014, 08:11:42 PM »
How modifying the color of a lwpoyline?

assoc 62 does not work.
OK.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Change color LWPOLYLINE
« Reply #1 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
  )

FELIX

  • Bull Frog
  • Posts: 242
Re: Change color LWPOLYLINE
« Reply #2 on: April 13, 2014, 11:57:07 PM »
OK.
OK.

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Change color LWPOLYLINE
« Reply #3 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 ?

pBe

  • Bull Frog
  • Posts: 402
Re: Change color LWPOLYLINE
« Reply #4 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
)