loudy000 Posted November 27, 2016 Posted November 27, 2016 Hi all, ive been trying to create simple lisp that do the following 1. Select objects (lines, polylines, circle, arc etc.) 2. prompt the user to put desired linetype scale but unfortunately my code is not working the way i wanted, any help is highly appreciated. Thank you. (defun c:TEST (/ SSET ) (setq sset (ssget)) (command "_.CHANGE" SSET "_P" "LTSCALE" )) Quote
Grrr Posted November 27, 2016 Posted November 27, 2016 (defun C:test ( / n SS i e enx ) (and vlax-get-acad-object (not (initget (+ 2 4))) (or (setq n (getreal "\nSpecify new LTSCALE value < 1 >: ")) (setq n 1)) (setq SS (ssget "_:L")) (repeat (setq i (sslength SS)) (setq e (ssname SS (setq i (1- i)))) (vla-put-LinetypeScale (vlax-ename->vla-object e) n) ); repeat ); and (princ) ) (vl-load-com) (princ) Quote
loudy000 Posted November 27, 2016 Author Posted November 27, 2016 (defun C:test ( / n SS i e enx ) (and vlax-get-acad-object (not (initget (+ 2 4))) (or (setq n (getreal "\nSpecify new LTSCALE value < 1 >: ")) (setq n 1)) (setq SS (ssget "_:L")) (repeat (setq i (sslength SS)) (setq e (ssname SS (setq i (1- i)))) (vla-put-LinetypeScale (vlax-ename->vla-object e) n) ); repeat ); and (princ) ) (vl-load-com) (princ) thank you very much Grrr. Cheers! Quote
Grrr Posted November 27, 2016 Posted November 27, 2016 (edited) thank you very much Grrr. Cheers! I also tried with Vanilla: (defun C:test ( / n SS i e enx ) (and (not (initget (+ 2 4))) (or (setq n (getreal "\nSpecify new LTSCALE value < 1 >: ")) (setq n 1)) (setq SS (ssget "_:L")) (repeat (setq i (sslength SS)) (setq e (ssname SS (setq i (1- i)))) (setq enx (entget e)) (cond ( (assoc 48 enx) (setq enx (subst (cons 48 n) (assoc 48 enx) enx)) ) ( (not (assoc 48 enx)) (setq enx (append (list (cons 48 n)) enx)) ) ); cond (entmod enx) (entupd (cdr (assoc -1 enx))) ); repeat ); and (princ) ) Seems to work now, it failed the first time so I gave up and used VLISP ( forgot to remove the enx variable from the first code ). Still doesn't work. EDIT: oh, and I just had to use (not (initget 4)) instead of (not (initget (+ 2 4))) Edited November 27, 2016 by Grrr Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.