本帖最后由 229096767 于 2022-10-14 15:08 编辑
不知道是不是如图所示:
- (defun c:tt()
- (prompt "\n请选择两条直线:")
- (setq ss (ssget))
- (if (>= (sslength ss) 2)
- (progn
- (setq ent1 (entget (ssname ss 0)))
- (setq ent2 (entget (ssname ss 1)))
-
- (setq pt11 (cdr (assoc 10 ent1)))
- (setq pt12 (cdr (assoc 11 ent1)))
-
- (setq pt21 (cdr (assoc 10 ent2)))
- (setq pt22 (cdr (assoc 11 ent2)))
-
- (setq pt13 (mapcar '(lambda(x y)(/ (+ x y) 2.0)) pt11 pt12));中点
- (setq pt23 (mapcar '(lambda(x y)(/ (+ x y) 2.0)) pt21 pt22));中点
-
- (command "line" pt13 pt23 "");中点连线
-
- (setq pt33 (mapcar '(lambda(x y)(/ (+ x y) 2.0)) pt13 pt23));中点连线的中点
- (setq ang1 (angle pt13 pt23));中点连线的角度
-
- (setq L (/ (distance pt13 pt23) 2.0))
-
- (setq pt31 (polar pt33 (- ang1 (/ pi 2)) L))
- (command "line" pt33 pt31 "")
-
- (setq pt32 (polar pt33 (+ ang1 (/ pi 2)) L))
- (command "line" pt33 pt32 "")
-
- )
- )
- )
|