xzklk 发表于 2022-4-15 02:17:29

高手们帮我完善下这个程序,谢谢了!

这是一个移动到目标相对距离的程序,现在有问题需要完善,目前只能处理X方向移动,想X和Y方向都听话。

(defun c:M6(/ pt1 pt3 val an pt4 pt5 pt6 pt7 d)
(command "ucs" w)
(if (not yanchangzhiall_ever) (progn (setq yanchangzhiall_ever 0.5)) (setq d yanchangzhiall_ever))
(setq d (getdist (strcat "\n输入边距<" (rtos yanchangzhiall_ever) ">:")))
(if (not d) (setq d yanchangzhiall_ever) (setq yanchangzhiall_ever d))
(setq jl (strcat (rtos d 2 2) "0,0" ))
(while (setq sel (ssget))
(setq pt1 (getpoint "\n请指定要移动视图的基点:"))给1点
(setq pt3 (getpoint "\n请指定目的点:"));给2点
(command "MOVE" sel ""pt1 pt3)
(command "move" sel "" "non" "0,0,0" "non" jl)
)
)

xj6019 发表于 2022-4-15 07:39:56

       


(defun c:M7(/ pt1 pt3 val an pt4 pt5 pt6 pt7 d)
        (command "ucs" w)
        (if (not yanchangzhiall_ever) (progn (setq yanchangzhiall_ever 0.5)) (setq d yanchangzhiall_ever))
        (setq d (getdist (strcat "\n输入边距<" (rtos yanchangzhiall_ever) ">:")))
        (if (not d) (setq d yanchangzhiall_ever) (setq yanchangzhiall_ever d))
        (setq jl (strcat "0," (rtos d 2 2) ",0" ))
        (while (setq sel (ssget))
                (setq pt1 (getpoint "\n请指定要移动视图的基点:"))给1点
                (setq pt3 (getpoint "\n请指定目的点:"));给2点
                (command "MOVE" sel ""pt1 pt3)
                (command "move" sel "" "non" "0,0,0" "non" jl)
        )
        (princ)
)

xzklk 发表于 2022-4-16 00:43:44

谢谢!这个M7是Y方向,以后就M6和M7结合起来用,要是能把这2个统一起来就太好了
页: [1]
查看完整版本: 高手们帮我完善下这个程序,谢谢了!