ATTSYNC with external block attributes.
I have a master template.dwg file that I have been keeping the block attributes up to date.
When I go to use an old dwg file with old blocks, I copy and paste the old file into the template.dwg file and then rename it.
I use the ATTSYNC command for each block which synchronizes the old block to the new template.dwg file blocks.
Maybe there is a better way, but this is working great!
Thanks again Jason, this has saved me a crazy amount of time.
Jason was kind enough to write a solution to my problem so I wanted to make a discussion thread
@Jason Bourhill said: Try using BATTMAN . This allows you to change the order of attributes in a block definition, and sync those changes to the inserted blocks. ATTSYNC can be used separately to sync changes. You may strike limitations if you're using block attributes to store inputs to a programme. Attributes entry doesn't provide validation on the input, Isn't typed, essentially everything is a string. Also doesn't allow for differing units. Alternate options here would be to look at extended entity data, or creating a custom dictionary. Regards, Jason Bourhill BricsCAD V21 Ultimate CAD Concepts
Comments
-
You can update a block definition within a drawing to a drawing file on disk using
INSERT
, which is the opposite way around to how you're doing it. The catch is that you have to have each block you want to use stored on your disk as an individual drawing file.If you use
-INSERT
, then you can see the command line version, when it asks you for a block name you can enter "BlockName=DrawingName" to specify the block to update, and the file to reference. Once the block definition is updated you can cancel out of the command. Following on from this you would runATTSYNC
to update attributes of existing block inserts.The following LISP makes use of this method to automate the process
; CCL-BLOCKREDEFINE ; Updates a block definition within the drawing to the one on disk. ; (CCL-BlockRedefine "BlockName") (defun CCL-BlockRedefine ( BlkName / oDoc blkdef isxref BlkFile flag ) (cond ((and (setq blkdef (tblsearch "BLOCK" BlkName)) (not (setq isxref (assoc 1 blkdef))) (setq BlkFile (findfile (strcat BlkName ".dwg")))) (setq oDoc (vla-get-activedocument (vlax-get-acad-object))); retrieve current doc (vla-EndUndoMark oDoc) (vla-StartUndoMark oDoc) (acet-sysvar-set '("CMDECHO" 0)) (command "._INSERT" (strcat BlkName "=" BlkFile) nil) (Princ (strcat "\nBlock name " (strcase BlkName) " Redefined")) (command "._ATTSYNC" "_Name" BlkName) (setq flag T) (acet-sysvar-restore) (vla-EndUndoMark oDoc) ) ((not blkdef) (Princ (strcat "\nBlock name " (strcase BlkName) " not defined in current drawing"))) (isxref (Princ (strcat "\nBlock name " (strcase BlkName) " is an XREF"))) ((not BlkFile) (Princ (strcat "\nBlock name " (strcase (strcat BlkName ".dwg")) " not found on search path"))) ) (terpri) flag )
Regards,
Jason Bourhill
BricsCAD V21 Ultimate
CAD Concepts0