Jump to content

Chuyển xref thành no path


(defun c:xrefnopath (/ xrefName ) ;@ketxu 4/6
(vl-load-com)
(vlax-for x (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object)))
(cond ((and
(vlax-property-available-p x 'isxref)
(eq (vla-get-IsXref x) :vlax-true)
)
(vla-put-path
x
(strcat
(vl-filename-base (setq xrefName (vla-get-Path x)))
(vl-filename-extension xrefName)
)
)
(vla-reload x)
)
)
)
)

Tệp .lsp gốc không còn trên máy chủ. Hãy chép mã nguồn bên dưới (lấy từ bài viết gốc) vào một tệp văn bản, lưu với đuôi .lsp.

Cách dùng

  1. Chép mã nguồn, lưu thành tệp 201895_xrefnopath.lsp.
  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 XREFNOPATH để chạy lisp.

Mã nguồn 201895_xrefnopath.lsp (trích từ bài viết gốc)

(defun c:xrefnopath (/ xrefName ) ;@ketxu 4/6
 (vl-load-com)
 (vlax-for x (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object)))
(cond ((and
  (vlax-property-available-p x 'isxref)
  (eq (vla-get-IsXref x) :vlax-true)
  ) 
 (vla-put-path
  x
  (strcat
(vl-filename-base (setq xrefName (vla-get-Path x)))
(vl-filename-extension  xrefName)
  )  
 )
 (vla-reload x)
 )
)
)
)

Thảo luận gốc

Lisp được chia sẻ trong chủ đề [Nhờ giúp đỡ] Chuyển xref thành no path. Xem đúng bài viết #201895 để đọc hướng dẫn và trao đổi thêm.

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