whosa Posted April 10, 2017 Posted April 10, 2017 Hi, I would like to pass the "scale x-y-z" values by command line in this lisp. Those values are the same. (defun c:spd (/ sp p) ;; Tharwat 15.Feb.2016 ;; (setq sp (vlax-get (vla-get-activelayout (vla-get-ActiveDocument (vlax-get-acad-object))) 'Block) ) (if (tblsearch "BLOCK" "spotd") (while (setq p (getpoint "\nSpecify point :")) (vla-put-textstring (car (vlax-invoke (vla-insertblock sp (vlax-3d-point p) "spotd" [color="red"] 0.8 0.8 0.8[/color] 0.0) 'getattributes)) (rtos (/ (cadr p) 1000.) 2 2) ) ) ) (princ) )(vl-load-com) Thanks Quote
Tharwat Posted April 10, 2017 Posted April 10, 2017 Hi, I am not sure if you are aware is that the value you have modified ( 0.8 ) is belong to the scale of the block ( XYZ ) and not the value you are planning to write to the block! Can you please show the outcome of the program you are looking forward? Quote
whosa Posted April 10, 2017 Author Posted April 10, 2017 I would like to add the scale value by command line. something like: "\nSpecify the scale :" Quote
Tharwat Posted April 10, 2017 Posted April 10, 2017 Something like this? (defun c:spd (/ sp p sc) ;; Tharwat 15.Feb.2016 ;; (setq sp (vlax-get (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)) ) 'block ) ) (if (tblsearch "BLOCK" "spotd") (if (setq sc (getreal "\nSpecy scale of block :")) (while (setq p (getpoint "\nSpecify point :")) (vla-put-textstring (car (vlax-invoke (vla-insertblock sp (vlax-3d-point p) "spotd" sc sc sc 0.0 ) 'getattributes ) ) (rtos (/ (cadr p) 1000.) 2 2) ) ) ) (princ "\nBock name 'spotd' os not found in current drawing <!>" ) ) (princ) )(vl-load-com) Quote
whosa Posted September 18, 2017 Author Posted September 18, 2017 Thanks this lisp works well but: 1. it is possible to set the default value of "sc" to 1 and change it if necessary? 2. it is possible to save the value of "sc"? Right now each time I use this lisp I need to specify the scale. Quote
BIGAL Posted September 18, 2017 Posted September 18, 2017 Have a look at this may be usefull I am sure others will offer suggestions. (if (= horiz nil) (progn (setq horiz 100) (prompt "\nEnter Horizontal scale <-ve to reset> :<") (prin1 horiz) (prompt ">:") (setq newhoriz (getint)) (cond ((= newhoriz nil)(PRINC "\N")) ((< newhoriz 0)(setq horiz nil)(alert "do xfp again values have been reset")(exit)) ((/= newhoriz nil)(setq horiz newhoriz)) ) 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.