如何将图形对象旋转复制水平
如何将上面的图一快速的旋转复制水平(如图二)
;复制旋转对象
(defun c:KJ_CR ( / ent1 ent pnt )
(PRINC "\n【開心工具箱】---复制旋转功能")(PRINC)
(setq ent (ssget))
(setq pnt (getpoint "\n-->请选择基点:"))
(setq ent1 (entlast))
(setvar "cmdecho" 0)
(command "copy" ent "" pnt "@" )
(setq ss (ssadd ))
(while (setq ent1 (entnext ent1)) (ssadd ent1 ss) )
(command "rotate" ss "" pnt)
(setvar "cmdecho" 1)
(princ "\n-->请指定旋转角度:")
(command pause)
(princ "\n★★★欢迎使用--《開金工具箱》--★★★ 所选地方-->复制旋转完成!")(princ))
这是【開心工具箱】里的,请问要怎么修改才能实现图二的,请大家指点,谢谢
;复制旋转对象
(defun c:TT (/ ENT PNT PNT1 a pt1 pt2 pt3);
(setvar "CMDECHO" 0)
(setq ent (ssget))
(setq pnt (getpoint "\n第一点"))
(setq pnt1 (getpoint "\n第二点:"))
(command "copy" ent "" "NON" pnt "NON" PNT1 )
(setq a (ENTLAST))
(setq pt1 (getpoint "\n 第一点:"))
(setq pt2 (getpoint pt1 "\n 第二点:"))
(setq pt3 (polar pt1 0 300))
(command "_rotate" a "" "non" pt1"r" "non" pt1 "non" pt2"non" pt3)
(setvar "CMDECHO" 1)
(princ)
) (defun c:BZ (/ ang en pt pt1 roang s1 ss)
(setvar "CMDECHO" 0)
(prompt "\n框选文件")
(setq ss (ssget":s"))
(setq s1 (entsel "\n选择一条边: "))
(setq en (car s1) pt (cadr s1))
(setq ang (angle pt (setq pt1 (osnap pt "nea"))))
(if (> ang pi) (setq ang (- ang pi)))
(setq roang (rtos (- 90 (/ (* ang 180) pi)) 2 3))
(command "_.ROTATE" ss "" pt1 roang)
(princ)
) (defun c:RH (/ a pt1 pt2 pt3);
(setvar "CMDECHO" 0)
(prompt "\n★★★ RH 回转水平 ★★★")
(setq a (ssget))
(setq pt1 (getpoint "\n 第一点:"))
(setq pt2 (getpoint pt1 "\n 第二点:"))
(setq pt3 (polar pt1 0 300))
(command "_rotate" a "" "non" pt1"r" "non" pt1 "non" pt2"non" pt3)
(setvar "CMDECHO" 1)
(princ)
)
;旋转垂直
(defun c:RS (/ a pt1 pt2 pt3)
(setvar "CMDECHO" 0)
(prompt "\n★★★ RS 回转垂直 ★★★")
(setq a (ssget))
(setq pt1 (getpoint "\n 第一点:"))
(setq pt2 (getpoint pt1 "\n 第二点:"))
(setq pt3 (polar pt1 (* pi 0.5) 300))
(command "_rotate" a "" "non"pt1"r""non" pt1 "non" pt2 "non" pt3)
(setvar "CMDECHO" 1)
(princ)
) 谢谢大家…… 群英荟萃,方法真多 感觉结合高飞鸟的求极值函数,可以实现自动归平。
判断条件就是令选择集的竖向投影长度最小。 htlaser 发表于 2022-4-27 08:52
(defun c:BZ (/ ang en pt pt1 roang s1 ss)
(setvar "CMDECHO" 0)
(prompt "\n框选文件")
命令: AP
APPLOAD 已成功加载 BZ.lsp。
命令: ; 错误: 输入的字符串有缺陷
清水白粥 发表于 2023-10-28 09:24
命令: AP
APPLOAD 已成功加载 BZ.lsp。
命令: ; 错误: 输入的字符串有缺陷
上传了 htlaser 发表于 2023-10-29 09:00
上传了
谢谢大哥。可以了……
页:
[1]