Current number of layout as a field autocad not using CTAB

Current number of layout as a field autocad not using CTAB

Anonymous
Not applicable
3,049 Views
3 Replies
Message 1 of 4

Current number of layout as a field autocad not using CTAB

Anonymous
Not applicable

Hello to all, 1st post here.

 

 I don't know anything about this Lisp universe and knowledge, I managed to put a list code using APPLOAD to add a field for the total number of sheets in my drawing, I used this tutorial:

 

 https://www.cadforum.cz/cadforum_en/total-number-of-layouts-as-a-field-tip11171

 

 very helpfull

 

 Everything worked fine and now I need something similar for the current number of the layout not the total, I dont want to use CTAB field because I use code in every name of my sheets so I need the number of the sheet, by example

 

 / 16 ------>  / 16

/ 16 --------> / 16

 

See the link/image for reference:

 

 https://imgur.com/a/W0rANB3

 

the Lisp code I used for the total number is this one:

 

 

;Sets totalLayouts automatically - then use Field: %<\AcVar.17.0 Lisp.totallayouts>%

;CAD Studio, 2016

(defun _totalLayoutsReactor (a r)

 (setq totalLayouts (length (layoutlist)))

)

(vlr-command-reactor nil '((:vlr-commandWillStart . _totalLayoutsReactor)))

 

Any help would be appreciated, thank you!

0 Likes
3,050 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
I was trying to edit this one because i need the total number of layouts but decreased by one, Do you know what to change? I tried (setq totalLayouts (lenght (layoutlist)))
0 Likes
Message 3 of 4

ronjonp
Mentor
Mentor

@Anonymous wrote:
I was trying to edit this one because i need the total number of layouts but decreased by one, Do you know what to change? I tried (setq totalLayouts (lenght (layoutlist)))

Try this

(setq totalLayouts (1- (length (layoutlist))))

 

Message 4 of 4

vladimir_michl
Advisor
Advisor

The function "1-" can help you. But there is a better way - the PageOf utility - see:

https://www.cadforum.cz/en/total-number-of-layouts-as-a-field-tip11171

 

Vladimir Michl, www.arkance-systems.cz - www.cadforum.cz