Error: Automation Error. Description was not provided.

Error: Automation Error. Description was not provided.

nyashp
Explorer Explorer
759 Views
6 Replies
Message 1 of 7

Error: Automation Error. Description was not provided.

nyashp
Explorer
Explorer
I want to read the name and remove overlay xref files.
 
(defun c:removeOverlayXREFs ()
   
    (setq acad (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acad))
   
    (setq layouts (vla-get-layouts doc))
   
    (setq model-layout (vla-item layouts "Model"))
    (setq xrefs (vla-item layouts doc))

    (foreach xref xrefs      
      (setq name (vla-get-Name xref))
      (prompt (strcat "The name of Xref file is: " name ))      
    )
   
    (princ)
   
  )
0 Likes
Accepted solutions (2)
760 Views
6 Replies
Replies (6)
Message 2 of 7

paullimapa
Mentor
Mentor

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

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 7

paullimapa
Mentor
Mentor

this reply deleted

 

 

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 4 of 7

nyashp
Explorer
Explorer

Hi @paullimapa,

But that's deleting all external reference files but for this code only overlay type of xref file should be removed. 

0 Likes
Message 5 of 7

paullimapa
Mentor
Mentor
Accepted solution

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

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 7

nyashp
Explorer
Explorer
(if (= 8 (logand 8 b70))
            (progn
              (prompt (strcat "\nThe name of Xref Overlay file is: " name))
              (vla-detach (vla-Item blocks (setq name(vla-get-name itm))))
            )
            (prompt (strcat "\nThe name of Xref that's NOT an Overlay file is: " name))
        )
 

@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.

 

0 Likes
Message 7 of 7

paullimapa
Mentor
Mentor
Accepted solution

If it doesn’t fit overlay then it must be attached. 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes