Author Topic: Check status of AcDbRasterImage  (Read 1408 times)

0 Members and 1 Guest are viewing this topic.

jasonyctam

  • Guest
Check status of AcDbRasterImage
« on: January 26, 2015, 07:46:40 PM »
Hi All,

I am trying to repath all the xrefs (including "AcDbRasterImage") in multiple files using Objectdbx and autolisp

I have more or less the following code for dealing with "AcDbRasterImage"s

   ; Set up our paths.
   (setq
      path_base "Q:\\Trial\\problematic2\\"
   )

   (setq
      dbx_master (
         vla-getinterfaceobject(vlax-get-acad-object)
         (strcat "ObjectDBX.AxDbDocument." (substr (getvar 'AcadVer) 1 2))
      )
   )

   (foreach drawing (vl-directory-files path_base "*.dwg")
   
      (setq checkIfOpenMaster (vl-catch-all-apply 'vla-open (list dbx_master (strcat path_base drawing))))
      (princ (strcat "Got File '" path_base drawing "\n"))
      (if (= (type checkIfOpenMaster)'VL-CATCH-ALL-APPLY-ERROR)
         (progn
            (princ (strcat "Master File '" (strcat path_base drawing) "' cannot be opened \n"))
         )
         (progn
            ; Loop though each layer to search for xref in formats other than dwg
            (setq LOCol (vla-get-Layouts dbx_master))
            (princ (strcat "Got layouts in File '" path_base drawing "\n"))
            (vlax-for LO LOCol
               (vlax-for Obj (vla-get-Block LO)
                  (if
                     (= (vla-get-ObjectName Obj) "AcDbRasterImage")
                     (progn
                        (princ "Inner Loop \n")
                        (setq image (vla-get-ImageFile Obj))
                        (princ "Got Image \n")
                        (setq imageName (vl-filename-base image))
                        (princ "Got Image Name \n")
                        (setq imageExtn (vl-filename-extension image))
                        (princ "Got Image Extn \n")

                        (vla-put-ImageFile Obj (strcat "./" path_processed_other_refs (vl-filename-base image) imageExtn))

                     )
                  )
               )
            )
         )
      )   
   )

But then it crashes when I encounter a file containing an image with status "Not Found". How can I implement the equivalent of vl-catch-all-apply....thing for that?

Additionally, is there a general way for me to process these non-dwg format xrefs? For the batch of AutoCAD drawings that I have to process, there are also PDFs, .doc(x)s, .xls(x) etc as xrefs.

Thanks a lot in advance.