Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Redefining Block, Field won't Update

0 REPLIES 0
Reply
Message 1 of 1
christopher.l.evans
381 Views, 0 Replies

Redefining Block, Field won't Update

I've used this lisp routine to redefine blocks and it works fine but I discovered an issue that I'm not certain how to approach.  In a block that has a multiline attribute I have a field in it for the drawing properties title.  When I redefine the block it only shows that theres a field there and doesn't populate the data.  I tried updating the field with "_updatefield" and it updates 13 out of 14 fields, even though by my count there is only 7 fields for the particular block.  If I go into edit the multiline attribute and cancel out it then populates the data from the drawing properties.  So to get this to populate the data will I have to go into each block that I encounter this and edit the attribute and cancel out?  Or is the a better method to approach this?

 

 

(defun c:ReDef ( / *error* oc spc doc block b )
  (vl-load-com)
  ;; © Lee Mac 2010

  ;; Full filename needed if block is not in the support path
  (setq BlocksToRedefine
   '(
      "M:\\CAD_Folder\\AutoCad_Library\\Layouts\\D_Size.dwg"
    )
  )

  (defun *error* ( msg )
    (and oc (setvar 'CMDECHO oc))
    (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **")))
    (princ)
  )

  (setq spc
    (vlax-get (vla-get-ActiveDocument (vlax-get-acad-object))
      (if (= 1 (getvar 'CVPORT)) 'PaperSpace 'ModelSpace)
    )
  )
  
  (setq oc (getvar 'CMDECHO)) (setvar 'CMDECHO 0)

  (foreach block BlocksToRedefine
    (if (setq b (findfile (strcat block (if (not (vl-filename-extension block)) ".dwg" ""))))
      (progn
        (vla-delete
          (vla-insertblock spc
            (vlax-3D-point '(0. 0. 0.)) b 1. 1. 1. 0.
          )
        )
        (vl-cmdf "_.attsync" "_N" (vl-filename-base b))
      )
      (princ (strcat "\n** Cannot Find Block: " block " **"))
    )
  )
  
  (setvar 'CMDECHO oc)
  (princ)
)

 

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost