![]() (setq edata (append edata (list (cons 62 col)))) (setq edata (subst (cons 62 col) (assoc 62 edata) edata)) (defun change_color (edata col) change color function (defun c:color6 (/ change_color local function The code for changing the color is good but here you got a 'catch', the (entget) function returns the database of an entity (this you already knows) but autolisp does not returns dxf codes that are at default state for example the color if it is still set to bylayer (the same with ltype and lweight) so to change the color of such entity you have to add the dxf code to entity data The (entupd) function is redundant in this case it does noting, it is more used in updating nested entities like attributes. make sure you do not mix data types, at first you set ent variable to an ENAME type (setq ent (ssname ss n)), than you set ent to entity data which is a LIST type. Some remarks to add to what you got so far:ġ. (but IF would be better in this case) (defun c:color6 (/ change_color ent ss n) headerĪttached the fix i gave to your code, now it works. (setq ent (entget (ssname ss (setq n (1- n))))) ![]() (defun change_color (ent col) change color function (defun c:color6 (/ change_color ent ss n ) header (if (setq ss (ssget "x" (list (cons 0 "CIRCLE")))) select circles ![]() (entupd (cdr (assoc -1 ent))) update entity (setq ent (subst (cons 62 col) (assoc 62 ent) ent)) (defun change_color(ent col) change color function I would appreciate you helping me solve this. The error says " error: malformed string on input". Hello, I occured a problem when writing a routine in autolisp, the code should change the colour of already drawn cirles, if the circles have a radius smaller or equal to 5.5 they should turn red and if they have a radius strictly bigger than 5.5 they should turn yellow.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |