AutoCAD 作分角線的 AutoLISP 程式分享

看板Cad_Cae (電腦輔助設計)作者 (sjgau)時間17年前 (2009/04/06 21:43), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
; file: div-ang.LSP (defun mid-point(p1 p2 / x1 y1 x2 y2) (setq x1 (car p1) y1 (cadr p1) x2 (car p2) y2 (cadr p2)) (list (/ (+ x1 x2) 2.0) (/ (+ y1 y2) 2.0)) ); end of mid-point() ; ----------------------------------------------- (defun c:div-ang( / e1 e2 p1 p2 pm1 p1a pm2 p2a p3 t1 t2 s1 s2 ss pm) (setq e1 (entsel "\n Pick the 1st LINE: ") e2 (entsel "\n Pick the 2nd LINE: ")) (setq p1 (cadr e1) p2 (cadr e2)) (setq p1 (osnap p1 "nea") p2 (osnap p2 "nea")) (setq pm1 (osnap p1 "mid") p1a (osnap p1 "end")) (setq pm2 (osnap p2 "mid") p2a (osnap p2 "end")) (setq p3 (inters pm1 p1a pm2 p2a nil)) (setq t1 (angle p3 p1) t2 (angle p3 p2) s1 (distance p3 p1) s2 (distance p3 p2)) (setq ss (+ s1 s2)) (setq p1 (polar p3 t1 ss) p2 (polar p3 t2 ss)) (setq pm (mid-point p1 p2)) (command "LINE" p3 pm "") ); end of c:div-ang() (princ "\n Do the new command of: DIV-ANG ") (princ) ; end of file -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.231.65.35
文章代碼(AID): #19sWSIgT (Cad_Cae)
文章代碼(AID): #19sWSIgT (Cad_Cae)