可以帮忙等分吗
本帖最后由 13672599520 于 2024-3-1 08:57 编辑(defun c:tes( / en xfx pt1 pt2 zljl sl)
(setvar 'cmdecho 0)
(setq en (car(entsel "\n选择对象:")))
(setq xfx (car(apply 'mapcar(cons '- (bwh en)))))
(setq pt1 (getpoint "\n指定第一点:"))
(setq pt2 (getpoint "\n指定第二点:"))
(setq zljl (- (distance pt1 pt2) (abs xfx) ) )
(setq sl (getint "输入间隔数<2>:") )
(if (not sl) (setq sl 2))
(command "-array" en "" "r" 1 sl (/ zljl (float sl)))
(setvar 'cmdecho 1)
(princ)
)
(defun bwh (en / p1 p2)
(setq p1 (vlax-safearray->list p1)
p2 (vlax-safearray->list p2)
)
(list p1 p2)
) 本帖最后由 13672599520 于 2024-3-1 09:00 编辑
htlaser 发表于 2024-2-29 09:47
(defun c:tes3( / en xfx pt1 pt2 zljl sl)
(setvar 'cmdecho 0)
(setq en (car(entsel "\n选择对象:") ...
这是间距平分。比如300平分不够会大于300或少于300的,用接近300平分。
如这样,这个不能选择对象,用是辅助线,我要是对象平分呢
(defun c:TG (/ ang1 d m n p0 p1 p2)
(setq p1 (getpoint "\n点取第一点:"))
(setq p2 (getpoint p1 "\n点取第二点:"))
(setq ang1 (angle p1 p2))
(setq d (getint "\n输入等分距离:"))
(if (null d)(setq d 100))
(setq p0 (polar p1 ang1 (/ (distance p1 p2) (setq n (fix (+ 0.5 (/ (distance p1 p2) d)))))))
(command "xline" "b" "non" p0 "non" p1 "non" p2 "")
(setq p0 (polar p0 ang1 (/ (distance p1 p2) n)))
)
)
清水白粥 发表于 2024-2-28 14:51
你看看这个是不是你想要的
如这样,这个不能选择对象
(defun c:TG (/ ang1 d m n p0 p1 p2)
(setq p1 (getpoint "\n点取第一点:"))
(setq p2 (getpoint p1 "\n点取第二点:"))
(setq ang1 (angle p1 p2))
(setq d (getint "\n输入等分距离:"))
(if (null d)(setq d 100))
(setq p0 (polar p1 ang1 (/ (distance p1 p2) (setq n (fix (+ 0.5 (/ (distance p1 p2) d)))))))
(repeat (- n 1)
(command "xline" "b" "non" p0 "non" p1 "non" p2 "")
(setq p0 (polar p0 ang1 (/ (distance p1 p2) n)))
)
) (defun c:tes3( / en xfx pt1 pt2 zljl sl)
(setvar 'cmdecho 0)
(setq en (car(entsel "\n选择对象:")))
(setq xfx (car(apply 'mapcar(cons '- (bwh en)))))
(setq pt1 (getpoint "\n指定第一点:"))
(setq pt2 (getpoint "\n指定第二点:"))
(setq zljl (- (distance pt1 pt2) (abs xfx) ) )
(setq sl (getreal "\n输入间距:"))
(command "-array" en "" "r" 1(fix (/ zljl (+ sl (abs xfx)))) sl )
(setvar 'cmdecho 1)
(princ)
)
你看看这个是不是你想要的 清水白粥 发表于 2024-2-28 14:51
你看看这个是不是你想要的
不是的,是间隔数改距离 ;两点阵列 在论坛中收集的
(defun c:tes ( / en xfx pt1 pt2 zljl s1)
(setvar "CMDECHO" 0)
(princ "\n选择对象: ")
(setq ss (ssget))
(setq pt1 (getpoint "\n指定第一点:"))
(setq pt2 (getpoint pt1 "\n指定第二点:"))
(setq ang (angle pt1 pt2))
(setq s1 (1- (getint "输入间隔数<2>:")))
(setq zljl (/ (distance pt1 pt2) s1))
(setq i zljl)
(repeat s1 (command "copy" ss "" pt1 (polar pt1 ang i))(setq i (+ i zljl)))
(setvar "CMDECHO" 1)
(princ)
) htlaser 发表于 2024-2-28 18:48
;两点阵列 在论坛中收集的
(defun c:tes ( / en xfx pt1 pt2 zljl s1)
(setvar "CMDECHO" 0)
是两点等分哦 htlaser 发表于 2024-2-28 18:48
;两点阵列 在论坛中收集的
(defun c:tes ( / en xfx pt1 pt2 zljl s1)
(setvar "CMDECHO" 0)
不是隔数哦 measure和divide命令
页:
[1]
2