whosa Posted November 25, 2019 Share Posted November 25, 2019 (edited) Hi, I would like to add to this lisp a "variable" scale value. Now is 1.00 but sometime I need to scale it down. It could work like this: 1.00 by default Ask me if I want to change the scale value Keep the new value until I close the DWG. Can someone help me on this? Thanks, Santo (defun c:CRD (/ sp p) (command "UCS" "world") (setq sp (vlax-get (vla-get-activelayout (vla-get-ActiveDocument (vlax-get-acad-object))) 'Block) ) (if (tblsearch "BLOCK" "STREET2" ) (while (setq p (getpoint "\nSpecify point :")) (vla-put-textstring (car (vlax-invoke (vla-insertblock sp (vlax-3d-point p) "STREET2" 1.0 1.0 1.0 0.0) 'getattributes)) (rtos (/ (caddr p) 1000.) 2 2) ) ) ) (princ) (command "UCS" "_p") )(vl-load-com) Edited November 25, 2019 by whosa Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 25, 2019 Share Posted November 25, 2019 (edited) You could try something like this - (defun c:crd ( / ang att blk ins obj scl spc ) (setq blk "street2") (if (tblsearch "block" blk) (progn (if (null crd:scl) (setq crd:scl 1.0) ) (initget 6) (if (setq scl (getreal (strcat "\nSpecify scale <" (rtos crd:scl 2) ">: "))) (setq crd:scl scl) (setq scl crd:scl) ) (setq ang (angle '(0 0) (trans (getvar 'ucsxdir) 0 (trans '(0 0 1) 1 0 t) t)) spc (vlax-get-property (vla-get-activedocument (vlax-get-acad-object)) (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace) ) ) (while (setq ins (getpoint "\nSpecify insertion point <exit>: ")) (if (setq obj (vla-insertblock spc (vlax-3D-point (trans ins 1 0)) blk scl scl scl ang) att (car (vlax-invoke obj 'getattributes)) ) (vla-put-textstring att (rtos (/ (caddr (trans ins 1 0)) 1000.0) 2 2)) ) ) ) (princ (strcat "\nBlock " blk " is not defined in the active drawing.")) ) (princ) ) (vl-load-com) (princ) Edited November 25, 2019 by Lee Mac 1 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 25, 2019 Share Posted November 25, 2019 (if (and (or (tblsearch "BLOCK" "STREET2") (alert "Block < STREET2 > was not found <!>") ) (or *sclval* (setq *sclval* 1.0)) (setq *sclval* (cond ((getdist (strcat "\nSpecify the scale value < " (vl-princ-to-string *sclval*) " > : " ) ) ) (*sclval*) ) ) ) (while (setq p (getpoint "\nSpecify point :")) (vla-put-textstring (car (vlax-invoke (vla-insertblock sp (vlax-3d-point p) "STREET2" *sclval* *sclval* *sclval* 0.0 ) 'getattributes ) ) (rtos (/ (caddr p) 1000.) 2 2) ) ) ) 1 Quote Link to comment Share on other sites More sharing options...
whosa Posted November 25, 2019 Author Share Posted November 25, 2019 Many thanks @Lee Mac and @Tharwat Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 27, 2019 Share Posted November 27, 2019 A couple of choices rather than initget (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (if (= but nil)(setq but 1)) (setq ans (atof (nth 0 (ah:butts but "v" '("Choose 1: " "1" "0.75" "0.5" "0.25" "0.1" ))))) remembers last picked. Another by lee-mac (if (not LM:LISTBOX)(LOAD "ListBoxV1-2.lsp") (setq lst (list "1" "0.75" "0.5" "0.25" "0.1" )) (LM:LISTBOX "choose" lst 2) 1 Quote Link to comment Share on other sites More sharing options...
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.