Results 1 to 2 of 2

Thread: Data Extraction Not Updating the xls File...

  1. #1
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,514
    Login to Give a bone
    0

    Default Data Extraction Not Updating the xls File...

    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.
    Phillip Bradshaw
    Lead Pixel Pusher, Lucid Design Studio
    CAD Detailer, Proctor Productions

    A doctor can bury his mistakes but an architect can only advise his clients to plant vines. - Frank Lloyd Wright

  2. #2
    Design Visualization Moderator stusic's Avatar
    Join Date
    2004-10
    Location
    Denver, Colorado
    Posts
    1,514
    Login to Give a bone
    0

    Default Re: Data Extraction Not Updating the xls File...

    Ah, it works; I just needed to add a delay to give Autocad enough time to write the excel file (it was copying it before it created the new one).

    Thanks anywho!
    Phillip Bradshaw
    Lead Pixel Pusher, Lucid Design Studio
    CAD Detailer, Proctor Productions

    A doctor can bury his mistakes but an architect can only advise his clients to plant vines. - Frank Lloyd Wright

Similar Threads

  1. Link data extraction file to a relative path
    By IanR in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2016-12-08, 06:04 PM
  2. Replies: 1
    Last Post: 2015-04-29, 01:18 PM
  3. 2014: Data Extraction Table not Updating to the Excel Sheet
    By JHARSH in forum ACA General
    Replies: 0
    Last Post: 2014-08-05, 08:55 PM
  4. Replies: 2
    Last Post: 2010-11-23, 08:45 AM
  5. Data Extraction Template (.blk) File
    By CADdancer in forum AutoCAD Tables
    Replies: 3
    Last Post: 2009-06-19, 08:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •