Wizzidd Posted May 18, 2023 Posted May 18, 2023 Hi, can some please help with adding a function to exclude a range of layout tabs. I want the Lisp routine to start calculating the page no from tab 01, refer to image. The LISP for adding the total number of pages is as follow, ;Sets totalLayouts automatically - then use Field: %<\AcVar.17.0 Lisp.totallayouts>% (defun _totalLayoutsReactor (a r) (setq totalLayouts (length (layoutlist))) ) (vlr-command-reactor nil '((:vlr-commandWillStart . _totalLayoutsReactor))) Thank you in advance...... Quote
mhupp Posted May 18, 2023 Posted May 18, 2023 If this is for something in the title block? I would use text fields. %<\AcVar CTAB \f "%tc1">% this would equal "01" on tab 01 Else this will create a list. (setq Layerlst (layoutlist)) ("Model" "Cover" "Rev LOG" .... "09") Use vl-position to find where "01" is in the list. (setq pos (vl-position "01" Layerlst)) = 8 This is because the first position is always 0 now all you need to do is subtract the remaining strings from the position of "01" (setq total (- (length Layerlst) pos)) total = (- (17) 8)) total = (- 17 8)) total = 9 Quote
Wizzidd Posted May 19, 2023 Author Posted May 19, 2023 Thank you for your response. I am using this, "%<\AcVar CTAB \f "%tc1">% this would equal "01" on tab 01" for the page number yes. But iI'm looking for a solution will keep the total page number at the end the same. Quote
BIGAL Posted May 20, 2023 Posted May 20, 2023 I would look at a slightly different approach, and that is rather than trying to do auto updates just run a lisp and update the two attributes, the total would be a case of whether a layout name is a number only, and then just count those up for the total. So A01 would be accepted or not is up to you. Mhupp has provided a look for "01" code and work out total. Quote
ronjonp Posted May 23, 2023 Posted May 23, 2023 With your example: (length (member "01" (layoutlist))) Will return the total. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.