知識社群登入
位置: AutoCAD開放式教學 > 討論區 > 討論
管線 斷開
1樓
的 AutoLISP 程式

; 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
附件
1. BL.LSP (2 KB)