Search the Community
Showing results for tags 'entmod'.
-
I'm working on a new Lisp that i want as little input as possible to put together, but i am stuck as to why my code is not working. I have chosen an Entity1, "SetQ 1" a certain DXF Group code Assoc Value then i chose a Entity2 and "SetQ 2" its same Assoc Value now i try to modify Entity1's Assoc Value by using (Setq Change (subst AssocV2 AssocV Change)) (Entmod Change) but the Entity does not change, i don't get errors just no action. What would be a good way of changing an entity's Assoc value? I don't post my code cuz i don't want the solution, i just want to be steered in the right direction. Thanks
-
I'm found a lisp to change a point Z coord by entmod, but I also want to change the color number. I tried this code: (defun c:ELEVAZIONE (/ ss i sn pts txt d di e ent) ;;; ==-- Author : Tharwat Al Shoufi --== ;;; ;;; Entmod the Z value of Points according ;;; ;;; to the nearest text's value ;;; (if (setq ss (ssget '((0 . "POINT,*TEXT")))) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (if (eq (cdr (assoc 0 (entget sn))) "POINT") (setq pts (cons (list (cdr (assoc 10 (entget sn))) sn) pts)) (setq txt (cons (list (cdr (assoc 10 (entget sn))) sn) txt)) ) ) ) (foreach p pts (foreach x txt (if (not d) (setq d (distance (car p) (car x)) e (cadr x) ) (if (< (setq di (distance (car p) (car x))) d) (setq d di e (cadr x) ) ) ) ) (setq d nil) (if (numberp (read (cdr (assoc 1 (entget e))))) (progn (entmod (subst (cons 10 (list (car (cdr (assoc 10 (setq ent (entget (cadr p)))))) (cadr (cdr (assoc 10 ent))) (read (cdr (assoc 1 (entget e)))) ) ) (assoc 10 ent) ent ) ) (entmod (subst (cons 62 1) (assoc 62 ent) ent)) ; this is my code )) ) (princ "\n Written by Tharwat Al Shoufi") (princ) ) but doesn't work. Can someone help me?
-
Hello everybody, I have written a short LISP code to do some tasks of MATCHPROP command. Here is the function: (defun MatchProp (oldobj newobj key / oldobjlist newobjlist oldassoc newassoc) (setq oldobjlist (entget oldobj)) (setq newobjlist (entget newobj)) (setq newassoc (assoc key newobjlist)) (if (setq oldassoc (assoc key oldobjlist)) (progn (if newassoc (progn (setq newobjlist (subst oldassoc newassoc newobjlist)) ) (progn; it is bylayer (setq newobjlist (append newobjlist (list oldassoc))) ) ) ) (progn; set it to bylayer (if newassoc (progn (setq newobjlist (vl-remove newassoc newobjlist)) ) ) ) ) (entmod newobjlist) ) And this is an example showing how it is called: (defun c:go() (setq oldobj (car (entsel))) (setq newobj (car (entsel))) (MatchProp oldobj newobj [color=darkslateblue][b]8[/b][/color]); [color=magenta]layer[/color] (MatchProp oldobj newobj [color=darkslateblue][b]62[/b][/color]); [color=magenta]color[/color] (MatchProp oldobj newobj [color=darkslateblue][b]420[/b][/color]); [color=magenta]color RGB[/color] (MatchProp oldobj newobj [color=darkslateblue][b]430[/b][/color]); [color=magenta]color name[/color] (MatchProp oldobj newobj [color=darkslateblue][b]6[/b][/color]); [color=magenta]linetype[/color] (MatchProp oldobj newobj [color=darkslateblue][b]48[/b][/color]); [color=magenta]linetype scale[/color] (MatchProp oldobj newobj [color=darkslateblue][b]370[/b][/color]); [color=magenta]lineweight[/color] (MatchProp oldobj newobj [color=darkslateblue][b]440[/b][/color]); [color=magenta]tranparency[/color] (MatchProp oldobj newobj [color=darkslateblue][b]390[/b][/color]); [color=magenta]plot style[/color] ) It works nice when I select an object with named color, linetype, etc. (not Bylayer), but not works vice versa at all. Could anyone checks it and show what is wrong with my program or entmod function? Thanks in advance:).