Author Topic: Current number of layout as a field autocad not using CTAB  (Read 3259 times)

0 Members and 1 Guest are viewing this topic.

arqcova

  • Mosquito
  • Posts: 3
Current number of layout as a field autocad not using CTAB
« on: February 04, 2020, 03:43:06 PM »
Hello to all, 1st post here.

I don't know anything about this Lisp unvierse 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 don't 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

X / 16 ------> 1 / 16
X / 16 --------> 2 / 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!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

arqcova

  • Mosquito
  • Posts: 3
Re: Current number of layout as a field autocad not using CTAB
« Reply #2 on: February 04, 2020, 05:14:43 PM »
thank you CAB, but this Lisp is for sorting layouts, I need something that adds just the number of the position of the layout.

see attachment for reference

57gmc

  • Bull Frog
  • Posts: 366
Re: Current number of layout as a field autocad not using CTAB
« Reply #3 on: February 04, 2020, 05:59:13 PM »
If its part of a sheetset, you can use the CurrentSheetNumber field.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Current number of layout as a field autocad not using CTAB
« Reply #4 on: February 04, 2020, 06:04:09 PM »
Perhaps something like this?

arqcova

  • Mosquito
  • Posts: 3
Re: Current number of layout as a field autocad not using CTAB
« Reply #5 on: February 04, 2020, 07:54:24 PM »
Thanks, @Lee Mac! it's almost what I need!

Actually I found that link of yours (thank you) and I tried that lisp, it works if the text or attribute is outside the block (my title block has fields and text inside it) but as soon as I made the same process inside the block to an attribute or mtext or text it only displays a zero and does not regen any information when I'm outside the block, is there a way of using the totallayouts lisp to edit it to show me the current # of sheet?

screen-share video of my problem

https://www.loom.com/share/1ac556a7e73340ac8c4c07e9f478bebb


AutoCAD lisp:


;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)))