whosa 发表于 2022-7-5 16:01:26

按命令行“缩放X-Y-Z”

你好
 
我想在这个lisp中通过命令行传递“缩放x-y-z”值。
 
这些值是相同的。
 
(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"
                0.8
                0.8
                0.8
                0.0)
            'getattributes))
      
(rtos (/ (cadr p) 1000.) 2 2)
       )
   )
   )
(princ)
)(vl-load-com)
 
谢谢

Tharwat 发表于 2022-7-5 16:19:01

你好
 
我不确定您是否知道您修改的值(0.8)属于块的比例(XYZ),而不是您计划写入块的值!
 
你能展示一下你期待的项目结果吗?

whosa 发表于 2022-7-5 16:27:48

我想通过命令行添加比例值。
 
类似于:

"\nSpecify the scale :"

Tharwat 发表于 2022-7-5 16:45:55

像这样的?
 

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

whosa 发表于 2022-7-5 16:57:45

谢谢
 
这个lisp很好用,但是:
 
1.是否可以将“sc”的默认值设置为1,并在必要时进行更改?
 
2、“sc”的值是否可以保存?现在,每次我使用这个lisp,我都需要指定比例。

BIGAL 发表于 2022-7-5 17:07:44

看看这可能是有用的,我相信其他人会提供建议。
 

(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))
)
页: [1]
查看完整版本: 按命令行“缩放X-Y-Z”