Skrypt pozwala na szybcie opisanie arkuszy ich aktualnymi numerami. Wystarczy wstawić odpowiedni blok do każdego arkusza, a po wczytaniu skryptu LISP i użyciu odpowiedniego polecenia, wszystkie arkusze zostaną ponumerowane.
Należy pobrać oba pliki, nastepnie wypakować Numer Arkusza. Następnie można go wstawić w formie bloku poprzez polecenie WSTAW do dowolnego arkusza, a skrypt LISP zaktualizuje jego numer do obecnego przy użyciu.
Pobierz LISP Numerowanie Arkuszy (2 KB) Pobierz Numer Arkusza (11 KB)
Polecenie do uruchomienia skryptu LISP: NUMERUJARKUSZE
Kod źródłowy z opisem
(princ (strcat "
Dostępne polecenia:
NumerujArkusze - automatyczne numerowanie arkuszy w bloku Numer Arkusza wstawionym w arkuszu
") )
(defun c:NumerujArkusze ( / doc layouts layoutList count idx)
(defun getLayoutsSortedByTabOrder ( / layoutCollection layoutList layoutObj tabOrderList )
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq layoutCollection (vla-get-Layouts doc))
(setq layoutList '())
(vlax-for layout layoutCollection
(if (not (equal (strcase (vla-get-Name layout)) "MODEL"))
(setq layoutList
(cons (cons (vla-get-Name layout) (vla-get-TabOrder layout)) layoutList))
)
)
(mapcar 'car
(vl-sort layoutList
(function (lambda (a b) (< (cdr a) (cdr b))))
)
)
)
(defun updateBlockAttributes (layoutName current total / ss i ent entData tag)
(if (setq ss (ssget "x" (list (cons 0 "INSERT") (cons 2 "Numer Arkusza") (cons 410 layoutName))))
(progn
(setq i 0)
(while (< i (sslength ss))
(setq ent (ssname ss i))
(setq entData (entget ent))
(if (= (cdr (assoc 66 entData)) 1)
(progn
(setq ent (entnext ent))
(while (and ent (/= (cdr (assoc 0 (entget ent))) "SEQEND"))
(setq tag (strcase (cdr (assoc 2 (entget ent)))))
(cond
((= tag "AKTUALNYARKUSZ")
(entmod (subst (cons 1 (itoa current)) (assoc 1 (entget ent)) (entget ent)))
)
((= tag "WSZYSTKIEARKUSZE")
(entmod (subst (cons 1 (itoa total)) (assoc 1 (entget ent)) (entget ent)))
)
)
(entupd ent)
(setq ent (entnext ent))
)
)
)
(setq i (1+ i))
)
)
)
)
(setq layoutList (getLayoutsSortedByTabOrder))
(setq count (length layoutList))
(setq idx 1)
(foreach layout layoutList
(updateBlockAttributes layout idx count)
(setq idx (1+ idx))
)
(princ "\nBloki 'Numer Arkusza' zostały zaktualizowane.")
(princ)
)
Wykonanie w ZWCADzie 2026