TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: andrew_nao on April 18, 2011, 03:42:02 PM
-
something simple i can not for the life of me remember
i want to change the color not the layer
the acad help says 62 but that doesnt work
thanks
:ugly:
(setq ent (car (entsel "\nSelect a object to be color change")))
(setq sse (entget ent))
(entmod (subst (cons 8 "6") (assoc 8 sse) sse))
-
eg.
(defun c:test (/ ent data ass)
(if (setq ent (car (entsel)))
(entmod (if (setq ass (assoc 62 (setq data (entget ent))))
(subst '(62 . 6) ass data)
(append data '((62 . 6)))
)
)
)
(princ)
)
-
it is 62?... hmmm
thank sir for your help
-
it is 62?... hmmm
thank sir for your help
Yes and you're welcome.
see:
http://images.autodesk.com/adsk/files/acad_dxf2.pdf
http://docs.autodesk.com/ACD/2011/ENU/filesDXF/WSfacf1429558a55de185c428100849a0ab7-5f35.htm
-
Weirdly, this seems to work whether DXF 62 is present or not:
(if (setq e (car (entsel)))
(entmod (append (entget e) '((62 . 6))))
)
-
Weirdly, this seems to work whether DXF 62 is present or not:
(if (setq e (car (entsel)))
(entmod (append (entget e) '((62 . 6))))
)
I was under the impression that only worked on newer versions (can't test since I only have access to 2009 and 2011).
-
is it possible to set a dxf code as a variable?
-
is it possible to set a dxf code as a variable?
Yes, but we must construct the dotted pair using the list/cons functions, since when using the apostrophe expressions are not evaluated:
([color=blue]setq [/color]colour 30)
([color=blue]setq [/color]newpair ([color=blue]cons [/color]62 colour))
([color=blue]if [/color]([color=blue]setq [/color]entity ([color=blue]car [/color]([color=blue]entsel[/color])))
([color=blue]progn
[/color] ([color=blue]setq [/color]elist ([color=blue]entget [/color]entity))
([color=blue]if [/color]([color=blue]setq [/color]oldpair ([color=blue]assoc [/color]62 elist))
([color=blue]setq [/color]elist ([color=blue]subst [/color]newpair oldpair elist))
([color=blue]setq [/color]elist ([color=blue]append [/color]elist ([color=blue]list [/color]newpair)))
)
([color=blue]entmod [/color]elist)
)
)
-
never mind, im a dope
:ugly:
thanks for youre help Lee.