0 Members and 1 Guest are viewing this topic.
...to provide a quick explanation for the result that you are receiving:Attribute references contained within a block reference are considered as separate from the associated block definition (this is to enable the attribute references to hold different values across multiple block references); when you redefine a block in the drawing, the block reference geometry is updated to reflect the updated block definition, however, the attribute references are not altered in any way (since they become separate from the definition when a reference is inserted). The use of ATTSYNC will only update the positions & properties of the attribute references and possibly add or remove attribute references that are either present in the definition and not present in the block reference, or vice versa; the values of the attribute references are not altered in any way.Since the Field Expressions in your modified block definition are located in the default values for the attribute definitions, these default values will not be applied to existing block references when the block is redefined, and furthermore the values of the attributes references will not be updated following an ATTSYNC operation, as described above.A potential solution would be to use a custom program to update the values of the necessary attribute references to use the default values held by the associated attribute definitions within the block definition, or even hard-code these updated values in the program itself.
(defun blockup2 (/ newblk2 redefblk2 ) ;block replace(vl-load-com) (setvar "tilemode" 1) (setq newblk2 "SUN_TBD_ISO") ;set block name (progn ;do the following: ;prepare the block name string using the blockname=blockname format (setvar "attreq" 0) ;turn attribute request off (setq redefblk2 (strcat newblk2 "=M:/CADD Files/LISP_MODS/SUN_TBD_ISO.dwg")) (command "-insert" redefblk2 "0,0" "" "" "" );insert an instance of the re-defined block at 0,0 (command "zoom" "e") ;zoom extents (command "erase" "l" "") ;erase the just-inserted block (leaving an updated block reference) (command "zoom" "e") ;zoom previous (setvar "attreq" 1) ;turn attribute requesting back on (ARXLOAD "BATTMAN") (acet-attsync newblk2) ;synchronize attributes )(COMMAND ".QSAVE") (PRINC))(blockup2)
(command "-insert" redefblk2 "0,0" "" "" "" );insert an instance of the re-defined block at 0,0Have any vlisp code instead of this code?not use "command"