Inserimento numerazione fogli automatici nel layout
Comments
-
Hello.
First thing to try would be checking whether working with sheet sets is suitable for your project.
If so, you could make use of the sheet set features and use fields to number the sheets.
As a start point, you could check how a default template is made, Sheet-metric.dwt for instance.For more details, see the next article.
If using sheet sets is not an option and the approach of using lisp is chosen, you could consider the next code sequence as a starting template in creating something that suits the requirements.
<pre>
(vl-load-com)
(defun c:layoutsnumbering (/ i n l ss blk_o)
(setq i 0
n (length (layoutlist))
)
(foreach l (layoutlist)
(setq ss (ssget "_x" '((0 . "INSERT") (2 . "Block_Name")))
i (1+ i)
)
; Block_Name is the table block definition name
; this way of selecting works fine is the title block is
; a regular block
; and not a parametric or dynamic one
(if ss
(progn
(setq blk_o (vlax-ename->vla-object (ssname ss 0)))
; The approach above assumes there is a single title block in each layout
(LM:vl-setattributevalue blk_o "tag" (strcat (itoa i) " / " (itoa n)))
; This function is from Lee Mac
; "tag" should be replaced with the real tag name
)
) ; if
) ; foreach
(princ)
)
</pre>
This code should be further adjusted and improved to match your real case scenario.The function to set the attribute value - (LM:vl-setattributevalue) - could be found using the next link:
0 -
There is numerous lisps out there to do updating of layout title blocks. On of the simplest is to use Fields, you can get the layout number and total layouts as fields. so you could get a "Sheet X of Y"
Do a google for updating title blocks, I have around 6 lisps to do different tasks.
0