Attributes

Discussion in 'AutoCAD' started by The Cad Man, Oct 5, 2004.

  1. The Cad Man

    The Cad Man Guest

    Anyone know how I can extract a series of attributes from a block and have
    them updated?
     
    The Cad Man, Oct 5, 2004
    #1
  2. You need to describe your goals in greater detail.
     
    Tony Tanzillo, Oct 5, 2004
    #2
  3. Hi,

    Yes. At a minimum everybody who has read the help files.

    --

    Regards


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, Oct 5, 2004
    #3
  4. The Cad Man

    The Cad Man Guest

    I have a title block that I created a routine to automatically set the date,
    file name, and project attributes. But if that title block is ever moved to
    a different path and I want to update the print date, it has to be done
    manually. I am trying to write a routine to update the date, project path,
    and project while keeping the routine as simple as possible.

    I need to know if attibutes are set like a variable or something in a
    drawing, I want to change them by changing that setting.

    Thanks.

    Brian
     
    The Cad Man, Oct 5, 2004
    #4
  5. The Cad Man

    jclaidler Guest

    Pre-AutoCAD 2005, use RTEXT.
    AutoCAD 2005 use RTEXT or Fields.
     
    jclaidler, Oct 5, 2004
    #5
  6. The Cad Man

    The Cad Man Guest

    I don't have RTEXT. I am using LDD3.
     
    The Cad Man, Oct 5, 2004
    #6
  7. The Cad Man

    Doug Broad Guest

    As you may already know:
    Attributes are entities within the drawing associated with blocks
    that contain editable text values. Using Legacy lisp / DXF
    techniques, the attributes are entities that follow the associated
    insert. They can be changed by using the entnext, entget, subst,
    and entmod functions.

    Using vlisp techniques, the attributes are accessible by using
    the getattributes method related to the AcDbBlockReferernce.

    Do you need instructions for vlisp or legacy lisp (dxf) techniques
    for changing them?

    Since you know how to write some code, show us what you've
    tried so far.

    Regards,
    Doug
     
    Doug Broad, Oct 5, 2004
    #7
  8. The Cad Man

    The Cad Man Guest

    I can't get past setting up the variables

    (defun c:sheetup ()
    (prompt "\nSelect Title Block and Press Enter Please")
    (setq sheet (entsel))
    (setq scle (getvar "dimscale"))
    (setq dnme (getvar "DWGNAME"))
    (setq dpth (getvar "DWGPREFIX"))
    (setq fnme (strcat dpth dnme))
    (setq acadObj (vlax-get-acad-object)aecApp (vla-getinterfaceobject acadObj
    "Aecc.Application") aecProj (vlax-get aecApp "ActiveProject")aecProjName
    (vlax-get aecProj "name"))
    (setq date (itoa (fix (getvar "cdate"))))(setq date1(strcat(substr date 5
    2)"/"(substr date 7 2)"/"(substr date 1 4)))

    and I don't know what to do next to modify the block. I want to simply run
    through the attedit command, but I am not sure how its command line
    structure works. It asks "Edit Attribute one at a time? [Yes/No] <Y>: " and
    on and on and on. I am not sure how it works.

    I just need to know if there is a quicker method than having to figure out
    exactly how editing attributes through the command line works.
     
    The Cad Man, Oct 5, 2004
    #8
  9. The Cad Man

    Doug Broad Guest

    If you want to have the attributes update automatically, then
    attedit is out of the question. Instead you must do the changes
    using entmod or by using vlisp to change the attributes themselves.
    You can skip the aec stuff if you are just working with blocks
    and attributes. If you have ADT, however, I'm curious. Why
    not use attributes with fields? (Below code examples are not tested)

    After you pick the block with entsel, the legacy method is
    to
    (setq attrib (entnext (car (entsel))) ;assuming that you really have a block with
    attributes

    That is easy enough to check.

    (setq attinfo (entget attrib)) ; should give you an idea of what to change.

    An automated program should be looking for attributes with specific
    tag names (like DATE and SHTNO and DWG).

    To change the attribute

    (entmod (subst (cons # newval) (assoc # attinfo) attinfo)

    Vlisp techniques are a lot different.


     
    Doug Broad, Oct 5, 2004
    #9
  10. The Cad Man

    The Cad Man Guest

    THANKS A MILL! THAT HELPS A BUNCH!!!!

     
    The Cad Man, Oct 5, 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.