Jump to content

Recommended Posts

Posted

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

Posted

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?

Posted

I would like to add the scale value by command line.

 

something like:

"\nSpecify the scale :"

Posted

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)

  • 5 months later...
Posted

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.

Posted

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))
)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...