Results 1 to 9 of 9

Thread: Custom Field - Sheet 1 of 31, Sheet 2 of 31, etc

  1. #1
    Member
    Join Date
    2004-05
    Location
    Falcon, Co/Hobbs, Nm
    Posts
    17
    Login to Give a bone
    0

    Question Custom Field - Sheet 1 of 31, Sheet 2 of 31, etc

    I have searched and searched for a topic on Customizing Fields. I want to make a custom field that is Sheet 1 of 31 and it populates with the sheet it is and how many sheets total for that set. Can anybody point me in the right direction?

  2. #2
    AUGI Addict Glenn Pope's Avatar
    Join Date
    2001-05
    Location
    Austin, TX USA
    Posts
    2,201
    Login to Give a bone
    0

    Default Re: Custom Field - Sheet 1 of 31, Sheet 2 of 31, etc

    The easiest way of doing this is with using the sheet set manager. You would make 2 attributes; one for the page number and the other for the set number. "Sheet" & "of" would be just plan text. The attribute for page number will have a field linked to the page number property the the ssm gives. The set number will be a custom field that you would add to the ssm properties.

    Check out these threads for working with the sheet set manager.

    How do I get fields working with SSM?

    Setting up a Sheet Set
    Last edited by Glenn Pope; 2005-07-13 at 01:24 PM.

  3. #3
    Woo! Hoo! my 1st post
    Join Date
    2008-12
    Posts
    1
    Login to Give a bone
    0

    Default Re: Custom Field - Sheet 1 of 31, Sheet 2 of 31, etc

    I have tackled this without sheet sets.
    I figured that every sheet (layout) has a separate title block and that the number of title blocks = the number of sheets. (If this is not the case for you then this solution will not work).
    I then used some lisp code that was suggested on the Autodesk discussion site
    http://discussion.autodesk.com/forum...sageID=5902018
    -----------------------------------------------------------------------------------------------------------------------
    (defun C:THINGCOUNT ()
    (setvar "cmdecho" 0)
    (setq sa (ssget "x" (list (cons 0 "INSERT")(cons 2 "THING"))))
    (setq thingcount (sslength sa))
    (princ)
    )
    ---------------------------------------------------------------------------------------------------------------------
    ###NOTE : REPLACE THE WORD "THING" WITH THE NAME OF YOUR TITLE BLOCK
    ---------------------------------------------------------------------------------------------------------------------
    I added this code to the end of a LISP that I use regularly for other drawing parameters to be set up for plotting, but you could just run it on the default start-up lisp that runs when AutoCad opens. The advantage that I gained by adding it to a lisp that I had assigned to a button was that, using the CUI, I called up the function and added a regen as well (this will ensure that the field value updates whenever I push the button).

    Finally just follow the instruction as explained on the link;
    ---------------------------------------------------------------------------------------------------------------------
    now use the FIELD command (or right click over TEXT/MTEXT to insert FIELD behavior to it), use Category 'Other', Fieldname LispVariable and select thingcount (the routine var). the field will pull that count value.
    --------------------------------------------------------------------------------------------------------------------

    It's not perfect for everyone's scenarios, but it does work.

  4. #4
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Custom Field - Sheet 1 of 31, Sheet 2 of 31, etc

    Congrats on your 1st post ... and that being an answer instead of a question ... nice one. Your idea is good, I like the ease of use ... however ....

    The problem here is that the LSP file needs to be loaded, otherwise there is no thingcountlisp variable to link to. So if someone else opens the DWG the field will display #####.

    If you don't want to use Sheet Sets, place that sheet count into your Drawing Properties. You can create a custom property ... call it SheetCount ... or whatever takes your fancy. Then change you code to look something like this (changes marked in red):
    Code:
    (defun C:THINGCOUNT (/ sa thingcount doc si)
      (setvar "cmdecho" 0)
      (setq sa (ssget "x" (list (cons 0 "INSERT") (cons 2 "THING"))))
      (setq thingcount (sslength sa))
      (vl-load-com)
      (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) ;Get vla-object of current doc
      (setq si (vla-get-SummaryInfo doc)) ;Get vla-object of summary info of doc
      (if (vla-GetCustomByKey si "SheetCount")
        (vla-SetCustomByKey si "SheetCount" (itoa thingcount))
        (vla-AddCustomInfo si "SheetCount" (itoa thingcount))
      )
      (princ)
    )
    Now there should be a SheetCount property under the Document category for fields. The nice thing here is you can open the DWG without needing to load & run your code every time since it's loading the sheet count from something that's saved inside the DWG itself ... not simply a volatile global variable.

  5. #5
    Member danielbritt's Avatar
    Join Date
    2004-09
    Location
    CENTRAL FLORIDA
    Posts
    9
    Login to Give a bone
    0

    Default Re: Custom Field - Sheet 1 of 31, Sheet 2 of 31, etc

    I added 2 attributes in my title block (ex: page XX of YY)

    The XX variable is a field that AutoCAD provides (SheetNumber) and I created a sheet set custom field called total pages so I manually count the sheets and populate the total sheets field in the top level sheet set.

  6. #6
    All AUGI, all the time Capt. Computer Crasher's Avatar
    Join Date
    2006-12
    Location
    South of North & East of West
    Posts
    786
    Login to Give a bone
    0

    Default Re: Custom Field - Sheet 1 of 31, Sheet 2 of 31, etc

    Here is a link to a thread where a solution was derived to a single file with multiple layout tabs each containing a title block.

    http://forums.augi.com/showthread.php?t=95873

  7. #7
    Member
    Join Date
    2006-07
    Posts
    14
    Login to Give a bone
    0

    Default Re: Custom Field - Sheet 1 of 31, Sheet 2 of 31, etc

    irneb:

    I am a little confused as to where the code is placed? I made a new Document Field called Total Sheets with a default value of #### but how do I associate the code you modified with the Total Sheets field?

    Thank you

    eptownie1988

  8. #8
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,825
    Login to Give a bone
    0

    Default Re: Custom Field - Sheet 1 of 31, Sheet 2 of 31, etc

    Quote Originally Posted by eptownie1988 View Post
    I am a little confused as to where the code is placed?

    The code can be in any .lsp file. It needs to be loaded in order for it to execute.
    IOW - the lisp code populates the drawing property, which in turn is read by the field.

    So the code can live anywhere, just make sure the function is loaded into memory before trying to call the "THINGCOUNT" function.
    R.K. McSwain | CAD Panacea |

  9. #9
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,685
    Login to Give a bone
    0

    Default Re: Custom Field - Sheet 1 of 31, Sheet 2 of 31, etc

    Lee Mac has lisp for this as well: http://www.lee-mac.com/layoutfield.html

Similar Threads

  1. Replies: 1
    Last Post: 2014-11-20, 12:27 AM
  2. Current Sheet (Set) Custom in Sheet Set Manager
    By Havoc501 in forum AutoCAD Fields
    Replies: 5
    Last Post: 2012-10-04, 03:41 PM
  3. Sheet set / Sheet custom properties data validation
    By tawfik72 in forum CAD Management - General
    Replies: 1
    Last Post: 2010-11-22, 11:54 AM
  4. Replies: 3
    Last Post: 2006-04-26, 02:35 PM
  5. Populate Field value to custom sheet value
    By hugho in forum AutoCAD Fields
    Replies: 2
    Last Post: 2006-01-03, 06:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •