Chia trần
- Chia trần theo kích thước các tấm. Các bạn vào bài viết gốc để biết rõ hơn
- Tải lisp
- 131175_df.lsp
Cách dùng
- Tải tệp 131175_df.lsp về máy.
- 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ẽ.
- Gõ lệnh DF để chạy lisp.
Mã nguồn 131175_df.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/34512-nh%E1%BB%9D-vi%E1%BA%BFt-h%E1%BB%99-lisp-chia-tr%E1%BA%A7n-si%C3%AAu-t%E1%BB%91c/?tab=comments#comment-131175
;free lisp from cadviet.com @Tue_NV,ketxu
(defun c:df(/ p kcx kcy dvx dvy cc)
(if (not W) (setq W 610))
(if (not H) (setq H 610))
(setq W1 (getreal (strcat "\nChieu rong < " (rtos W 2 0) " >:")))
(setq H1 (getreal (strcat "\nChieu cao < " (rtos H 2 0) " >:")))
(if W1 (setq W W1))
(if H1 (setq H H1))
(acet-sysvar-set (list "hpname" "_USER" "HPORIGINMODE" 0 "hpdouble" 0 "cmdecho" 0))
(foreach e (acet-ss-to-list (ssget '((0 . "POLYLINE,LWPOLYLINE"))))
(setq p (acet-ent-geomextents e) d1 (car p) d2 (cadr p)
kcx (abs (- (car d1) (car d2)))
kcy (abs (- (cadr d1) (cadr d2)))
dvx (* (/ (- (/ kcx W) (fix (1- (/ kcx W)))) 2) W)
dvy (* (/ (- (/ kcy H) (fix (1- (/ kcy H)))) 2) H)
cc (mapcar '+ d1 (list dvx dvy 0.0))
)
(if (and (> kcx W) (> kcy H))
(progn
(setvar "HPORIGIN" cc)
(setvar "hpang" 0)
(setvar "hpspace" H)
(command "-hatch" cc "")
(setvar "hpang" (/ pi 2))
(setvar "hpspace" W)
(command "-hatch" cc "")
)
(alert "\n Co o tran nho hon kich thuoc tam tran")
)
)
(acet-sysvar-restore)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề Nhờ viết hộ lisp chia trần siêu tốc. Xem đúng bài viết #131175 để đọc hướng dẫn và trao đổi thêm.