Get the specified attribute?

Discussion in 'AutoCAD' started by RDI, Sep 11, 2003.

  1. RDI

    RDI Guest

    I wrote a lisp routine that searches through a specified block's atttributes
    (loops through a specified number of times) and changes the value of that
    attribute.

    I tried to expand on it to look for the attribute based on the prompts.
    However the prompts aren't stored with the attribute--they seem to be stored
    as part of the block to which they belong. I thought about searching based
    on the tags--but there is know way for the general user to know for sure
    what the proper tag is.

    Anyone have any thoughts?
     
    RDI, Sep 11, 2003
    #1
  2. RDI

    Michel Guest

    Look at the block definition using (Tblobjname....,entnext, entget...etc

    (setq theblock (tblobjname "BLOCK" "is name here"))
    (setq firstAtt (entnext a))

    Michel

    RDI a écrit :
     
    Michel, Sep 11, 2003
    #2
  3. RDI

    RDI Guest

    I AM using entnext to step through. Following is the code as it stands now.
    (you have know in what position the attribute is).

    (defun c:tbu ()
    (setq ent(ssget "x" '((0 . "INSERT")(2 . "NJT2000-DBL"))))
    (setq cnt 0)
    (if ent(progn
    (repeat (sslength ent)
    (setq edata (entget(ssname ent cnt)))
    (setq edata (entget (entnext (dxf -1 edata))))
    (emod 1 edata "CLIFTON STATION PARK & RIDE EXPANSION");Change the
    Title
    (repeat 2
    (setq edata (entget (entnext (dxf -1 edata))))
    )

    (if(wcmatch (strcase (getvar "dwgprefix"))(strcase
    "P:\\PROJECT\\02111\\DWG\\SECPlans\\*"))
    (emod 1 edata "9/2/03") ;Change the SUbmission Date
    (emod 1 edata "7/28/03") ;Change the SUbmission Date
    )
    (repeat 6
    (setq edata (entget (entnext (dxf -1 edata))))
    )
    (if(wcmatch (strcase (getvar "dwgprefix"))(strcase
    "P:\\PROJECT\\02111\\DWG\\SECPlans\\*"))
    (emod 1 edata "12") ;Change the total sheet count
    (emod 1 edata "26") ;Change the total sheet count
    )
    (setq cnt (1+ cnt))
    )
    (command "regen")
    ))
    )
     
    RDI, Sep 11, 2003
    #3
  4. RDI

    RDI Guest

    OK. I misread the post. You're referring to looking at the block
    DEFINITION not the INSTANCE.

    I'm in the process now of trying that method.

    (setq theblock (tblobjname "BLOCK" "is name here")) returned the entity name
    of the block.

    (entnext a) returned invalid object

    I tried (setq a(entnext theblock)) and it returned the block's data (level,
    color etc.)

    From that point forward if I do (setq a(entnext a)) it returns the SAME info
    as above.
     
    RDI, Sep 11, 2003
    #4
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.