Jump to content

Lisp lệnh BAO trong chủ đề “Nhờ chỉnh sửa lisp tạo đường bao”

Mình tìm thấy lisp này trên diễn đàn,

Lisp dùng khá ok nhưng lại tạo đường bo ở dạng Region,

Mình muốn đường bo thành dạng polyline, Bác nào sửa giúp mình với ạ

Thank

(defun c:bao()
  (setq p (getpoint "pick diem :"))
  (command "._boundary" "A" "O" "R" "" p "")
  (Command "._region" "L" "")
  (setq el (entlast)) (redraw el 3)
  (while (setq p (getpoint "pick diem :"))
      (command "._boundary" p "")
      (Command "._region" "L" "")
    (command "._union" el "L" "")
    (setq el (entlast))
    (redraw el 3)
  )
)

 

Cách dùng

  1. Tải tệp 457599_bao.lsp về máy.
  2. Trong AutoCAD gõ lệnh APPLOAD, chọn tệp vừa tải rồi bấm Load. Cũng có thể kéo thả tệp .lsp vào cửa sổ bản vẽ.
  3. Gõ lệnh BAO để chạy lisp.

Mã nguồn 457599_bao.lsp

;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/187836-nh%E1%BB%9D-ch%E1%BB%89nh-s%E1%BB%ADa-lisp-t%E1%BA%A1o-%C4%91%C6%B0%E1%BB%9Dng-bao/
(defun c:bao()
  (setq p (getpoint "pick diem :"))
  (command "._boundary" "A" "O" "R" "" p "")
  (Command "._region" "L" "")
  (setq el (entlast)) (redraw el 3)
  (while (setq p (getpoint "pick diem :"))
      (command "._boundary" p "")
      (Command "._region" "L" "")
    (command "._union" el "L" "")
    (setq el (entlast))
    (redraw el 3)
  )
)

Thảo luận gốc

Lisp được chia sẻ trong chủ đề Nhờ chỉnh sửa lisp tạo đường bao. Xem đúng bài viết #457599 để đọc hướng dẫn và trao đổi thêm.

Về Thư viện AutoLisp (trang 320)