Jump to content

Lisp lệnh DLW trong chủ đề “Làm sao để chuyển line weight trong block thành bylayer?”

Thì sài như hướng dẫn ở trên. Cứ copy/paste vào command line thôi. Nếu muốn thành file Lisp thì dùng cái này:

(defun C:DLW()
  (vl-load-com)
  (command "UNDO" "BE")
  (vlax-for for-item (vla-get-blocks(vla-get-activedocument(vlax-get-acad-object)))
    (vlax-for item for-item
      (vla-put-Lineweight item -1)
      )
    )
  (command "UNDO" "END")
  (princ)
  )

Cách dùng

  1. Tải tệp 239832_dlw.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 DLW để chạy lisp.

Mã nguồn 239832_dlw.lsp

;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/72965-l%C3%A0m-sao-%C4%91%E1%BB%83-chuy%E1%BB%83n-line-weight-trong-block-th%C3%A0nh-bylayer/
(defun C:DLW()
  (vl-load-com)
  (command "UNDO" "BE")
  (vlax-for for-item (vla-get-blocks(vla-get-activedocument(vlax-get-acad-object)))
    (vlax-for item for-item
      (vla-put-Lineweight item -1)
      )
    )
  (command "UNDO" "END")
  (princ)
  )

Thảo luận gốc

Lisp được chia sẻ trong chủ đề Làm sao để chuyển line weight trong block thành bylayer?. Xem đúng bài viết #239832 để đọc hướng dẫn và trao đổi thêm.

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