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

Error: Automation Error. Description was not provided.

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
nyashp
456 Views, 6 Replies

Error: Automation Error. Description was not provided.

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)
   
  )
6 REPLIES 6
Message 2 of 7
paullimapa
in reply to: nyashp

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
in reply to: nyashp

this reply deleted

 

 

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 4 of 7
nyashp
in reply to: paullimapa

Hi @paullimapa,

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

Message 5 of 7
paullimapa
in reply to: nyashp

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
Message 6 of 7
nyashp
in reply to: paullimapa

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

 

Message 7 of 7
paullimapa
in reply to: nyashp

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


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

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report