求一个lisp小程序CAD2次开发
1,按下命令快捷键XXX2,执行命令rectang3,自己给P1和P2,2个点,鼠标点4,OFFSET向内偏移20mm5,连接4个角6,最好转成块放到给的点处。就这些,不...
1,按下命令快捷键XXX
2,执行命令rectang
3,自己给P1和P2,2个点,鼠标点
4,OFFSET向内偏移20mm
5,连接4个角
6,最好转成块放到给的点处。
就这些,不胜感激,。 展开
2,执行命令rectang
3,自己给P1和P2,2个点,鼠标点
4,OFFSET向内偏移20mm
5,连接4个角
6,最好转成块放到给的点处。
就这些,不胜感激,。 展开
1个回答
展开全部
(defun c:sjx()
(vl-load-com)
(setq cm (getvar "cmdecho")) (setvar "cmdecho" 0)
(setq os (getvar "osmode")) (setvar "osmode" 0)
(command "_undo" "be")
(if (setq p1 (getpoint "\np1:"))
(if (setq p2 (getcorner p1 "\np2:"))
(progn
(setq pm (mapcar '* '(0.5 0.5) (mapcar '+ p1 p2)))
(command "_rectang" p1 p2)
(setq ent1 (entlast))
(setq pts1 (mapcar 'cdr (vl-remove-if-not '(lambda(x)(= (car x) 10)) (entget ent1))))
(if (or (< (distance (car pts1) (cadr pts1)) 20.0)
(< (distance (car pts1) (last pts1)) 20.0)
)
(princ "所画矩形无法偏移向内偏移20mm")
(progn
(command "_offset" 20 ent1 pm "")
(setq ent2 (entlast))
(setq pts2 (mapcar 'cdr (vl-remove-if-not '(lambda(x)(= (car x) 10)) (entget ent2))))
(setq i 0)
(repeat 4
(command "_line" (nth i pts1) (nth i pts2) "")
(setq i (1+ i))
)
)
)
)
)
)
(command "_undo" "e")
(setvar "osmode" 0) (setvar "cmdecho" 0)
(princ)
)
(vl-load-com)
(setq cm (getvar "cmdecho")) (setvar "cmdecho" 0)
(setq os (getvar "osmode")) (setvar "osmode" 0)
(command "_undo" "be")
(if (setq p1 (getpoint "\np1:"))
(if (setq p2 (getcorner p1 "\np2:"))
(progn
(setq pm (mapcar '* '(0.5 0.5) (mapcar '+ p1 p2)))
(command "_rectang" p1 p2)
(setq ent1 (entlast))
(setq pts1 (mapcar 'cdr (vl-remove-if-not '(lambda(x)(= (car x) 10)) (entget ent1))))
(if (or (< (distance (car pts1) (cadr pts1)) 20.0)
(< (distance (car pts1) (last pts1)) 20.0)
)
(princ "所画矩形无法偏移向内偏移20mm")
(progn
(command "_offset" 20 ent1 pm "")
(setq ent2 (entlast))
(setq pts2 (mapcar 'cdr (vl-remove-if-not '(lambda(x)(= (car x) 10)) (entget ent2))))
(setq i 0)
(repeat 4
(command "_line" (nth i pts1) (nth i pts2) "")
(setq i (1+ i))
)
)
)
)
)
)
(command "_undo" "e")
(setvar "osmode" 0) (setvar "cmdecho" 0)
(princ)
)
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询