Solved! Go to Solution.
Solved by paullimapa. Go to Solution.
Solved by paullimapa. Go to Solution.
try these modifications:
; removeOverlayXREFs
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-automation-error-description-was-not-provided/m-p/12172650#M453155
(defun c:removeOverlayXREFs
(/ doc blocks layouts model-layout name objlst) ; localize variables
(if(not(car (atoms-family 1 '("vl-load-com"))))(vl-load-com)) ; load vl functions
(setq acad (vlax-get-acad-object)
doc (vla-get-ActiveDocument acad)
blocks (vla-get-Blocks doc) ; get block table obj
layouts (vla-get-layouts doc)
model-layout (vla-item layouts "Model")
objlst (vla-get-block model-layout)
)
(vlax-for itm objlst
(if
(and
(= (vla-get-objectname itm) "AcDbBlockReference") ; confirm is block
(= (vla-get-IsXRef (vla-Item blocks (setq name(vla-get-name itm)))) :vlax-true) ; confirm is xref
)
(progn
(prompt (strcat "\nThe name of Xref file is: " name ))
(vla-delete itm) ; delete xref found
)
) ; if
) ; vlaxl-for
(princ) ; clean exit
) ; defun
Hi @paullimapa,
But that's deleting all external reference files but for this code only overlay type of xref file should be removed.
then just add to the code to test for the Group 70 bit code in the Block Table to confirm it's an Overlay...see modifications:
; removeOverlayXREFs
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-automation-error-description-was-not-provided/m-p/12172650#M453155
(defun c:removeOverlayXREFs
(/ doc b70 blocks layouts model-layout name objlst tbl) ; localize variables
(if(not(car (atoms-family 1 '("vl-load-com"))))(vl-load-com)) ; load vl functions
(setq acad (vlax-get-acad-object)
doc (vla-get-ActiveDocument acad)
blocks (vla-get-Blocks doc) ; get block table obj
layouts (vla-get-layouts doc)
model-layout (vla-item layouts "Model")
objlst (vla-get-block model-layout)
)
(vlax-for itm objlst
(if
(and
(= (vla-get-objectname itm) "AcDbBlockReference") ; confirm is block
(= (vla-get-IsXRef (vla-Item blocks (setq name(vla-get-name itm)))) :vlax-true) ; confirm is xref
)
(progn
(setq tbl (tblsearch "Block" name) ; get block table
b70 (cdr(assoc 70 tbl)) ; get 70 flg
) ; setq
(if(= 8 (logand 8 b70)) ; this is an xref overlay
(progn
(prompt (strcat "\nThe name of Xref Overlay file is: " name ))
(vla-delete itm) ; delete xref found
)
(prompt (strcat "\nThe name of Xref that's NOT an Overlay file is: " name ))
) ; if
) ; progn
) ; if
) ; vlaxl-for
(princ) ; clean exit
) ; defun
@paullimapa For overlay file you used logical bitwise AND of b70 with number 8, but for attach xref file type what is that number which can be used in "logand" to check for attachment type of xref file.
If it doesn’t fit overlay then it must be attached.
Can't find what you're looking for? Ask the community or share your knowledge.