Jump to content

Đánh số thứ tự bản vẽ tự động?


- Đánh số bản vẽ - Ver của bác Tuệ

Cách dùng

  1. Tải tệp 129218_shbv.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 SHBV để chạy lisp.

Mã nguồn 129218_shbv.lsp

;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/11637-lisp-%C4%91%C3%A1nh-s%E1%BB%91-th%E1%BB%A9-t%E1%BB%B1-b%E1%BA%A3n-v%E1%BA%BD-t%E1%BB%B1-%C4%91%E1%BB%99ng/
;; free lisp from cadviet.com : ketxu update from @Tue_NV
(defun c:shbv(/ dau tong po po1 ent i pre sotong)
(prompt "\n Danh so hieu ban ve dang n/m ")
(setvar "cmdecho" 0)
(setq pre ": ")
(wtxt pre '(0 0 0))
(command "ddedit" (entlast) "") 
(setq pre (cdr(assoc 1 (entget(entlast)))))
;(setq pre (strcat pre ": "))
(entdel (entlast))
(setq dau (getint "\n Danh so bat dau (n):"))
(setq tong (getint "\n Danh so tong (m):") i 1)
(if ((setq po (getpoint 
(strcat "\n Cho diem chen cua so: " (if ((wtxt (strcat (if (
(Repeat (- tong dau)
(setq po1 (getpoint po 
(strcat "\n Cho diem chen cua so: " (if (
(command "copy" "L" "" po po1) 
(setq ent (entget(entlast)))
(setq ent 
(subst 
(cons 1 (strcat (if ((entmod ent)
(setq i (1+ i))
(setq po po1)
)
(princ)
)
;
(defun wtxt(txt p / sty d h1 h2 wf h) ;;;Write txt on graphic screen at p
(setq    sty (getvar "textstyle")    
d (tblsearch "style" sty)    
h1 (cdr (assoc 40 d))    
h2 (cdr (assoc 42 d))    
wf (cdr (assoc 41 d)))
(if (> h1 0) (setq h h1) (setq h h2))
(entmake (list (cons 0 "TEXT") (cons 7 sty) (cons 40 h) (cons 41 wf)(cons 72 4)(cons 11 p) (cons 1 txt) (cons 10 p))))

Thảo luận gốc

Lisp được chia sẻ trong chủ đề Lisp đánh số thứ tự bản vẽ tự động?. Xem đúng bài viết #129218 để đọc hướng dẫn và trao đổi thêm.

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