TINDANG Posted December 27, 2021 Posted December 27, 2021 I am creating a lisp to scale a rectangle by the preset length size. It is currently crashing when I try to set values for variables S1, S2 (Ex: S1=200, S2=500,...) (defun C:scc ( / ss pt1 pt2 dist size mat) (setq ss (ssget)) (setq pt1 (getpoint "Point 1 :" )) (setq pt2 (getpoint "Point 2 :" pt1)) (setq dist (distance pt1 pt2)) (cond ((eq "S1" mat) 200) ((eq "S2" mat) 400) (T nil) ) (progn (initget "S1 S2") (setq size (getdist "\nSize scale: [S1/S2]" )) (command "scale" ss "" pt1 "R" dist size) ) Quote
ronjonp Posted December 28, 2021 Posted December 28, 2021 (edited) (defun c:scc (/ ss pt1 pt2 dist size mat) (setq ss (ssget)) (setq pt1 (getpoint "Point 1 :")) (setq pt2 (getpoint "Point 2 :" pt1)) (setq dist (distance pt1 pt2)) ;; Where is "mat' set ?? (cond ((eq "S1" mat) 200) ((eq "S2" mat) 400) (t nil) ) (progn (initget "S1 S2") (setq size (getdist "\nSize scale: [S1/S2]")) (command "scale" ss "" pt1 "R" dist size) ) ) ; <- you were missing this ?? (defun c:scc_fix (/ dist pt1 pt2 size ss) (if ;; Check that selection AND pt1 AND pt2 are valid (and (setq ss (ssget)) (setq pt1 (getpoint "Point 1 :")) (setq pt2 (getpoint "Point 2 :" pt1))) (progn (setq dist (distance pt1 pt2)) (initget "S1 S2") (setq size (getdist "\nSize scale: [S1/S2]")) (command "scale" ss "" pt1 "R" dist (if (= "S1" size) 200 400 ) ) ) ) (princ) ) Edited December 28, 2021 by ronjonp 2 Quote
BIGAL Posted December 29, 2021 Posted December 29, 2021 The other alternative is to rework out the 4 pts and redraw. If you use the rectang command its always drawn in a certain order. Using VL you can put-coordinates for a Pline. So my take the existing size is shown just enter new values. 1 Quote
TINDANG Posted December 29, 2021 Author Posted December 29, 2021 thanks ronjonp! I tried your method and it worked great. Quote
TINDANG Posted December 29, 2021 Author Posted December 29, 2021 I modified ronjonp's lisp so it can scale to more size. I use it to resize an A3 drawing frame with different scales. Scc _ Scale object with reference.lsp Quote
BIGAL Posted December 29, 2021 Posted December 29, 2021 (edited) "I use it to resize an A3 drawing frame with different scales." Are you doing all your A3 title as multiples in modelspace if so then I and soooo many others will say start using layouts, title block is fixed true size, just set the mview scale to suit so much easier. That is why layouts were created. Edited December 29, 2021 by BIGAL 1 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.