Hi all,
Here's a routine originally wrote by LeeMac.
I wanted to delete the previously inserted blocks after it's done updating them.
Thanks in advance. I'll wrote where the problem lies in my code.
(defun c:BK_Update_InsertAll_Redefine_ATTSYNCAll ( / dir doc extn spc )
(setq extn "dwg") ;; Extension of files to Insert e.g "dwg"
(if
; (setq dir (LM:DirectoryDialog (strcat "Select Directory of " (strcase extn) " Files to Insert") nil 512))
(setq dir "W:/SS_CAD/SS_AutoCAD Block's Library/Blocks Updated/" blk "`.dwg")
(progn
(setq doc (vla-get-activedocument (vlax-get-acad-object))
spc (vlax-get-property doc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace))
)
(foreach file (vl-directory-files dir (strcat "*." extn) 1)
(vla-insertblock spc (vlax-3D-point '(0.0 -50.0 0.0)) (strcat dir "\\" file) 1.0 1.0 1.0 0.0)
)
(vla-regen doc acallviewports)
(command "ATTSYNC" "NAME" "*")
; NOT WORKING, I want to delete the previously inserted block.
(vlax-delete (vlax-ename->vla-object spc))
)
(princ "\n*Cancel*")
)
(princ)
)