ycpyxl 发表于 2024-9-30 13:39:38

菜鸟请教取值问题

(defun c:tt ( / d obj )
(setq d (getdist "\n偏移距离: "))
(while (setq obj (vlax-ename->vla-object (car(entsel))))
    (progn
      (vl-catch-all-apply 'vla-offset (list obj (- d)))
      (vl-catch-all-apply 'vla-offset (list obj d))
      (vl-Catch-All-Apply 'vlax-put-property (list obj 'color 1))
    )
)
)


这两行里面的d值怎么取上面d的0.5倍。((setq d (getdist "\n偏移距离: ")))
(vl-catch-all-apply 'vla-offset (list obj (- d)))
      (vl-catch-all-apply 'vla-offset (list obj d))

ssyfeng 发表于 2024-9-30 13:42:26

直接(* 0.5 d)不行吗

hubeiwdlue 发表于 2024-9-30 13:42:43

(defun c:tt ( / d obj )
(setq d (getdist "\n偏移距离: "))
        (setq d (* 0.5 d))
(while (setq obj (vlax-ename->vla-object (car(entsel))))
    (progn
      (vl-catch-all-apply 'vla-offset (list obj (- d)))
      (vl-catch-all-apply 'vla-offset (list obj d))
      (vl-Catch-All-Apply 'vlax-put-property (list obj 'color 1))
    )
)
)

sbwdx 发表于 2024-9-30 13:49:14

(defun c:tt ( / d obj )
(setq d (getdist "\n偏移距离: "))
(while (setq obj (vlax-ename->vla-object (car(entsel))))
    (progn
      (vl-catch-all-apply 'vla-offset (list obj (* -0.5 d)))
      (vl-catch-all-apply 'vla-offset (list obj (* 0.5 d)))
      (vl-catch-all-apply 'vlax-put-property (list obj 'color 1))
    )
)
)

ycpyxl 发表于 2024-10-8 20:05:57

谢谢各位大佬指点
页: [1]
查看完整版本: 菜鸟请教取值问题