Saqib_theleo Posted January 16, 2017 Posted January 16, 2017 Hello to all, I found this Block Size Lisp from somewhere and it works fine. After running this Lisp it asks for Select Objects then hit enter for scale factor and give it the value for scale factor then hit enter and it scales selected blocks. But I want this Lisp work in this way that after running this Lisp it asks for select objects and when you hit enter it automatically select the Scale Factor and the value of "0.02". If someone can help me I'll be thankfull for that. (defun C:SIZE (/ sngScaleFactor ssSelections strScaleOption ) (princ "\nSelect items to size individually by their own insertion point: ") (setq ssSelections (ssget (list (cons 0 "ATTDEF,INSERT,MTEXT,TEXT")))) (initget "I F") (setq strScaleOption (getkword "\n[i]nsertion Scale or Scale [F]actor: ")) (initget 6) (setq sngScaleFactor (getdist "\nEnter Scale Factor: ")) (vlax-for objItem (vla-get-activeselectionSet (vla-get-activedocument (vlax-get-acad-object))) (if (wcmatch (vla-get-objectname objItem) "AcDbBlockReference,AcDbMInsertBlock") (if (= strScaleOption "F") (progn (vlax-put objItem "xscalefactor" (* sngScaleFactor (vlax-get objItem "xscalefactor"))) (vlax-put objItem "yscalefactor" (* sngScaleFactor (vlax-get objItem "yscalefactor"))) (vlax-put objItem "zscalefactor" (* sngScaleFactor (vlax-get objItem "zscalefactor"))) ) (progn (vlax-put objItem "xscalefactor" sngScaleFactor) (vlax-put objItem "yscalefactor" sngScaleFactor) (vlax-put objItem "zscalefactor" sngScaleFactor) ) ) (if (= strScaleOption "F") (vlax-put objItem "height" (* sngScaleFactor (vlax-get objItem "height"))) (vlax-put objItem "height" sngScaleFactor) ) ) ) (prin1) ) Quote
gS7 Posted January 16, 2017 Posted January 16, 2017 (defun C:SIZE (/ sngScaleFactor ssSelections strScaleOption ) (princ "\nSelect items to size individually by their own insertion point: ") (setq ssSelections (ssget (list (cons 0 "ATTDEF,INSERT,MTEXT,TEXT")))) [color="royalblue"] ;(initget "I F") ;(setq strScaleOption (getkword "\n[i]nsertion Scale or Scale [F]actor: ")) ;(initget 6)[/color] (setq sngScaleFactor [color="red"]0.02[/color]) ; [color="red"]scale value[/color] (vlax-for objItem (vla-get-activeselectionSet (vla-get-activedocument (vlax-get-acad-object))) (if (wcmatch (vla-get-objectname objItem) "AcDbBlockReference,AcDbMInsertBlock") (if (= strScaleOption "F") (progn (vlax-put objItem "xscalefactor" (* sngScaleFactor (vlax-get objItem "xscalefactor"))) (vlax-put objItem "yscalefactor" (* sngScaleFactor (vlax-get objItem "yscalefactor"))) (vlax-put objItem "zscalefactor" (* sngScaleFactor (vlax-get objItem "zscalefactor"))) ) (progn (vlax-put objItem "xscalefactor" sngScaleFactor) (vlax-put objItem "yscalefactor" sngScaleFactor) (vlax-put objItem "zscalefactor" sngScaleFactor) ) ) (if (= strScaleOption "F") (vlax-put objItem "height" (* sngScaleFactor (vlax-get objItem "height"))) (vlax-put objItem "height" sngScaleFactor) ) ) ) (prin1) ) Blocked codes in blue color try this lisp Quote
BIGAL Posted January 17, 2017 Posted January 17, 2017 A slight variation (defun SIZE ( sngScaleFactor / ; (setq sngScaleFactor [color=red]0.02[/color]) ; [color=red]scale value[/color] Then to call type (size 0.2) can change size this way Quote
Aftertouch Posted January 17, 2017 Posted January 17, 2017 A slight variation (defun SIZE ( sngScaleFactor / ; (setq sngScaleFactor [color=red]0.02[/color]) ; [color=red]scale value[/color] Then to call type (size 0.2) can change size this way Hey BIGAL, Dont get me wrong. But why would you choose this solution, instead of just setting 'setq' to a forced number? Quote
halam Posted January 17, 2017 Posted January 17, 2017 I tried this on annotative text.. somehow it put height at in it .. 'sngScaleFactor/annoscale' Would be nice if could be worked out for annotative text. Quote
BIGAL Posted January 18, 2017 Posted January 18, 2017 Aftertouch You are correct the post was for 0.2 only. When you start reading many posts the first thing is that another requester asks "Can you add 0.2 or 0.4 as an option" "can I just have this added". Hence a more generic possibility for perhaps some one else that may read the post. 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.