I'm not exactly sure where to post this, but it involves my code, so I'm putting it here. If there's data extraction gurus somewhere else, I'd be happy to have this thread moved.
I've got the code below to give our users a "one-click" solution to data extraction. I've done this by saving the dwg file in a temporary directory where a pre-made dxe file acts as a dummy file for the data extraction, then copies the drawing and xls file back to the appropriate directory.
However, after running the extraction, the xls file isn't updated to reflect the data in the "new" drawing, it still references the original drawing the dxe was created from - even though the original drawing used to create the dxe file is overwritten by my "new" drawing...
Any ideas? I'm so close to getting this to work, now this. I'm afraid I might have gotten to a dead end.
Code:
(vl-load-com)
(defun c:dext ( / *error* vars old dn dp)
(defun *error* ( msg );error handler
(and old (mapcar 'setvar vars old))
(or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
(princ (strcat "\n** Error: " msg " **")))
(princ)
)
(setq vars '("CMDECHO" "FILEDIA") old (mapcar 'getvar vars))
(mapcar 'setvar vars '(1 0));set variables
(setq dn (getvar "dwgname"));get filename
(setq dp (getvar "dwgprefix"));get file path
(command "qsave")
(vl-file-copy "X:\\CONTROLLED_DOCUMENTS\\SYSTEMS\\ENGINEERING_DOCUMENTS\\AUTOCAD_STANDARDS\\Templates\\dext.dxe" "c:\\temp\\dext.dxe" T);copy dext.dxe from server to local to keep local copy up to date
(command "SAVEAS" "2010" (strcat "C:\\Temp" "\\" "dext.dwg") "Y");temporary directory for dummy dxe
(command "-dataextraction" "c:\\temp\\dext.dxe" "YES" "-75,75,0");perform the data extraction
(vl-file-copy "c:\\temp\\dext.xls" (strcat dp "..\\misc\\dext.xls")T);copy excel sheet to misc folder in project directory
(command "SAVEAS" "2010" (strcat dp dn) "Y");restore dwg to original directory
(mapcar 'setvar vars old);return variables
(princ);exit quietly
)
Sorry fo rthe horrible patchwork code. Much was garnered from this thread.