Retreiving Layout Number with Rtext

Discussion in 'AutoCAD' started by pdiemer, Oct 21, 2004.

  1. pdiemer

    pdiemer Guest

    Using R2002, I am looking for a method to display the number of the layout on the layout itself. I'm trying to do this so that the sheet number will update itself. I've used getvar, CTAB to get the layout name but I need the number of the layout instead.

    Any ideas as to whether or not this is possible?
     
    pdiemer, Oct 21, 2004
    #1
  2. Hi pdiemer,

    Are your Layouts still named as Layout1, Layout2, etc? What we do is rename
    the Layout to the same name as our Drawing (Sheet) Numbers and we have
    programming that puts it in the right place correctly. For Rtext you can
    probably use the following:

    $(getvar,ctab)

    That works if you rename your Layouts to the same name as your Drawing
    Numbers. If your Layouts are still named Layout1, Layout2, etc. then the
    following should work for Rtext:

    $(substr, $(getvar,ctab) , 8)

    If you go to 2005 then you probably want to use Fields.

    Anyway, hope this helps.

    Arnold Williams
     
    Arnold Williams, Oct 21, 2004
    #2
  3. pdiemer

    pdiemer Guest

    Thanks for the idea Arnold.

    I'm really trying to get away from embedding the number of the layout within the layout name. Frequently, we need to add an additional layout early in the drawing set, and this would mean I would have to go back and rename all subsequent layouts before printing to get that "ctab" function to work.

    From what I'm hearing, upgrading to 2005 and using "fields" is my only option, unfortunately...
     
    pdiemer, Oct 22, 2004
    #3
  4. It is possible to get the layout position with
    vlisp, not so sure about doing it with rtext.

    --
    Autodesk Discussion Group Facilitator



    on the layout itself. I'm trying to do this so that the sheet number will
    update itself. I've used getvar, CTAB to get the layout name but I need the
    number of the layout instead.
     
    Jason Piercey, Oct 25, 2004
    #4
  5. pdiemer

    pdiemer Guest

    Thanks for the tip, it's very encouraging, I've had no luck with RTEXT. Could you expand on how I would use VLISP to acquire the layout position? You are writing to a total rookie in this VLISP programming, so any extra detail would be extremely appreciated.
     
    pdiemer, Oct 25, 2004
    #5
  6. pdiemer

    Rick Keller Guest

    Are you talking about the tab name?
    Use Deisel option...

    $(getvar, ctab)

    Rick
     
    Rick Keller, Oct 25, 2004
    #6
  7. Pass this function the current document object and
    a string identifying the layout name and you should
    get what you are after.

    Example:

    (getLayoutPosition
    (vla-get-activedocument
    (vlax-get-acad-object))
    "Model"
    )

    ; retrieve the position of a layout in a document
    ; Arguments:
    ; [document] - vla-object, document object
    ; [layoutName] - string, layout name
    ; returns an integer if successful
    ; Notes:
    ; integer returned is zero based
    (defun getLayoutPosition (document layoutName / result)
    (if
    (vl-catch-all-error-p
    (setq
    result
    (vl-catch-all-apply
    (function
    (lambda ()
    (vla-get-taborder
    (vla-item
    (vla-get-layouts document)
    layoutName)))))))
    (vl-catch-all-error-message result)
    result
    )
    )


    Hope this helps, ask for clarification if it doesn't
    make any (or little) sense.

    --
    Autodesk Discussion Group Facilitator



    Could you expand on how I would use VLISP to acquire the layout position?
    You are writing to a total rookie in this VLISP programming, so any extra
    detail would be extremely appreciated.
     
    Jason Piercey, Oct 25, 2004
    #7
  8. pdiemer

    pdiemer Guest

    No, not the tab name. I'm looking for the tab (layout) position, with respect to the rest of the tabs.

    The reason I can't use CTAB is because the layer state (in layer manager) is directly linked to the name of the layout tab. Within the layer manager, I save a different layer state for each layout, then when I recall a particular layout, that layer state (with the same name) is automatically recalled. Example: For the "storm sewer" layout, I save a layer state called "storm sewer". When I go to print that page, I can skip layer manager and just hit print, as all the layers I need are on and those not needed are turned off or frozen. If I were to try and use CTAB and embed the layout number in the layout name (which changes often), I would have to rename the layer state and layout tab every time there was a page added or deleted...

    So long story short, I'm trying to number my pages(layouts) so that when a page is added early in the drawing set, the layout numbering will adjust accordingly (and automatically).
     
    pdiemer, Oct 25, 2004
    #8
  9. pdiemer

    pdiemer Guest

    Thanks Jason.
    Please excuse my naivety at this LISP stuff but quite honestly, your post is probably crystal clear to most, but Greek to me.

    Here's what i did:
    Clipped the text from your post.
    Saved it in the VLISP editor.
    Loaded that particular file.

    Screen says the load was successful.

    Now what do I do? Can I actually connect the output from this routine to a piece of text?
     
    pdiemer, Oct 25, 2004
    #9
  10. That piece of code was a just partial solution to
    what you are asking. If I understand you correctly,
    you want to link a piece of text with the position of
    a given layout?

    This could be done using object reactors, but I'm
    afraid I don't know enough about that to provide
    any specific examples.
     
    Jason Piercey, Oct 26, 2004
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.