Anyone know how I can extract a series of attributes from a block and have them updated?
Hi, Yes. At a minimum everybody who has read the help files. -- Regards Laurie Comerford www.cadapps.com.au
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
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
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.
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.