Jump to content

Recommended Posts

Posted

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.

Screenshot2023-05-18215459.thumb.jpg.098e76c3cc6142f58daa41b3751bea0c.jpg

 

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......

Posted

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

 

Posted

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.

image.png.49eb0496f1ae43e5d82d2dd89ba2b137.png

Posted

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.

 

 

 

 

Posted

With your example:

(length (member "01" (layoutlist)))

Will return the total.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...