Xin lisp chuyển layer của các đối tượng trong block về cùng layer của block
Chi bằng ta đổi tất cả các đối tượng trong block thành layer 0 màu bylayer như vậy nó sẽ tự thành như ý nhỉ.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;sua ma dxf block ;;;Cu phap su dung (duy:block_s_dxf block mdxf thanh) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun block_s_dxf (blk mdxf thanh / e el name ob lname name mdxf thanh) (setq name (cdr (assoc 2 (entget blk)))) (if (not (member name lname)) (progn (setq lname (append lname (list name))) (setq e (cdr (assoc -2 (tblsearch "BLOCK" name)))) (while e (setq el (entget e)) (cond ((wcmatch (cdr (assoc 0 el)) "INSERT") (block_s_dxf e mdxf thanh) ) ) (setq Ent (subst (cons mdxf thanh) (assoc mdxf el) el)) (entmod ent) (setq e (entnext e)) );while );progn );if (command ".move" (ssget "x" (list (cons 0 "INSERT")(cons 2 name))) "" (list 0 0 0) (list 0 0 0)) ) (DEFUN C:dlb () (setq dttd (car(entsel "Chon BLOCK!"))) (block_s_dxf dttd 8 "0") (block_s_dxf dttd 62 256) )@Pham Quoc DuyCái này ngon rồi nhưng bạn có thể edit lại tý xíu phần select object như trong cad không...ví dụ chọn đối tượng theo p, c, w, l, cp, wp...thk so much
- Tải lisp
- 319026_dlb.lsp
Cách dùng
- Tải tệp 319026_dlb.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 DLB để chạy lisp.
Mã nguồn 319026_dlb.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/68553-y%C3%AAu-c%E1%BA%A7u-xin-lisp-chuy%E1%BB%83n-layer-c%E1%BB%A7a-c%C3%A1c-%C4%91%E1%BB%91i-t%C6%B0%E1%BB%A3ng-trong-block-v%E1%BB%81-c%C3%B9ng-layer-c%E1%BB%A7a-block/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;sua ma dxf block
;;;Cu phap su dung (duy:block_s_dxf block mdxf thanh)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun block_s_dxf (blk mdxf thanh / e el name ob lname name mdxf thanh)
(setq name (cdr (assoc 2 (entget blk))))
(if (not (member name lname))
(progn
(setq lname (append lname (list name)))
(setq e (cdr (assoc -2 (tblsearch "BLOCK" name))))
(while e
(setq el (entget e))
(cond
((wcmatch (cdr (assoc 0 el)) "INSERT") (block_s_dxf e mdxf thanh) )
)
(setq Ent (subst (cons mdxf thanh) (assoc mdxf el) el))
(entmod ent)
(setq e (entnext e))
);while
);progn
);if
(command ".move" (ssget "x" (list (cons 0 "INSERT")(cons 2 name))) "" (list 0 0 0) (list 0 0 0))
)
(DEFUN C:dlb ()
(setq dttd (car(entsel "Chon BLOCK!")))
(block_s_dxf dttd 8 "0")
(block_s_dxf dttd 62 256)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề [YÊU CẦU] Xin lisp chuyển layer của các đối tượng trong block về cùng layer của block. Xem đúng bài viết #319026 để đọc hướng dẫn và trao đổi thêm.