[心得] 把直線截斷的 AutoCAD AutoLISP 程式

看板Cad_Cae (電腦輔助設計)作者 (sjgau)時間18年前 (2008/04/10 11:10), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
管線的 key- plan 圖 經常會需要把 相交的 管線的其中一條截斷 以下的 LISP 程式 執行 SET-BW 指令, 以設定 截斷的半寬 執行 BL 指令, 先選擇 某一條 直線 再正確選擇 截斷點 程式即可正確執行 提供大家參考 祝學習愉快 ; file: bl.lsp (defun c:set-bw( / ) (graphscr) (setq bw2 (getdist "\nGet a distance for BL command: ")) (princ (strcat "\nBreak- width set to: " (rtos bw2 2) "\n")) (princ) ); end of set-bw() ; ----------------------------------------------- (defun c:bl( / L1 L1-name L1-list P1 P2 P3 P4 t1 t2 P5 P6) ; get Line- 1, by P1 (setq L1 (entsel "\n Select a Line by 1- pick: ")) ; get P2 (setq p2 (getpoint "\n Pick a point for break: ")) ; --------------------------------------------- (setq L1-name (car L1) P1 (cadr L1)) (setq p1 (osnap p1 "nea")); p1 is OK (setq L1-list (entget L1-name)) (setq p3 (cdr (assoc '10 l1-list)) p4 (cdr (assoc '11 l1-list))); p3, p3 OK (setq t1 (angle p2 p3) t2 (angle p2 p4)) (setq p5 (polar p2 t1 bw2) p6 (polar p2 t2 bw2)) (princ "\n") (entdel l1-name) (command "line" p4 p6 "") (command "line" p5 p3 "") (princ) ); end of bl() ; ----------------------------------------------- (textscr) (princ "\n\nTo load a LISP- file: (LOAD \"BL.LSP\") [Enter]\n") (princ "\ndo \"SET-BW [Enter] \" to set break- width\n") (princ "\ndo \"BL [Enter] \" to break a line from a point by break- width\n") (princ) ; end of file -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.231.38.15
文章代碼(AID): #17_OKGnw (Cad_Cae)
文章代碼(AID): #17_OKGnw (Cad_Cae)