明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 768|回复: 2

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

[复制链接]
发表于 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)
)
)

发表于 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)
)
 楼主| 发表于 2022-4-16 00:43:44 | 显示全部楼层
谢谢!这个M7是Y方向,以后就M6和M7结合起来用,要是能把这2个统一起来就太好了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 10:02 , Processed in 0.166526 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表