Results 1 to 3 of 3

Thread: Automated Data Extraction

  1. #1
    Member
    Join Date
    2013-12
    Posts
    8
    Login to Give a bone
    0

    Question Automated Data Extraction

    Okay so I am sick of having to use the data extraction tool for the same thing over and over. I am looking for an automated lisp routine hopefully that will do it for me with a click of a button.

    I am currently using data extraction tool to extract attributes from the same block in every dwg, then immediately export it to an excel file. If possible I would like it to do the same thing without having to go through the normal process. Also if it could ask for save location and what to name the excel file that would be great as well.


    Thank you!!

  2. #2
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    555
    Login to Give a bone
    0

    Default Re: Automated Data Extraction

    Just google so many examples
    check Lee-mac.com as well
    3rd search cadtutor.net

    Code:
    an example
    ; changes to issued for construction
    ; by Alan H
    : thanks to lee mac for original code
    
    (vl-load-com)
    ; 1.  Get current date in mm/dd/yy format.
    (defun ddmmyy (/ x today)
         (setvar "cmdecho" 0)
         (setq x (getvar "CDATE"))                 ; get current date
         (setq today ( rtos x 2 4))                    ; convert to a string
         (setq newdate (strcat (substr today 7 2) "."    (substr today 5 2) "." (substr today 3 2) ))
    )
    
    (ddmmyy)
    (setq oldtag1 "DRAWING_STATUS") ;attribute tag name
    (setq newstr1 "ISSUED FOR CONSTRUCTION")
    (setq oldtag2 "REV_NO")  ;attribute tag name
    (setq newstr2 "0")
    (setq oldtag3 "DRDATE")  ;attribute tag name
    (setq newstr3 newdate)
    
    
    (setq ss1 (ssget "x"  '((0 . "INSERT") (2 . "DA1DRTXT"))))
    (setq inc (sslength ss1))
    
    (repeat inc      
    (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 (setq inc (1- inc)) )) 'getattributes)
    (if (= oldtag1 (strcase (vla-get-tagstring att)))
    (vla-put-textstring att newstr1) 
    ) ; end if
    (if (= oldtag2 (strcase (vla-get-tagstring att)))
    (vla-put-textstring att newstr2) 
    ) ; end if
    (if (= oldtag3 (strcase (vla-get-tagstring att)))
    (vla-put-textstring att newstr3) 
    ) ; end if
    ) ; end for
    ) ;end repeat
    
    (setq oldtag1 "REV-NO")
    (setq newstr1 "0")
    
    
    (setq oldtag2 "DATE")
    (setq newstr2 newdate)
    (setq oldtag3 "AMENDMENT")
    (setq newstr3 "ISSUED FOR CONSTRUCTION")
    
    (setq ss2 (ssget "x"  '((0 . "INSERT") (2 . "REVTABLE"))))
    (setq inc (sslength ss2))
    (repeat inc
    (foreach att (vlax-invoke (vlax-ename->vla-object (ssname ss2 (setq inc (1- inc)))) 'getattributes)
    (if (= oldtag1 (strcase (vla-get-tagstring att)))
    (vla-put-textstring att newstr1) 
    )
    (if (= oldtag2 (strcase (vla-get-tagstring att)))
    (vla-put-textstring att newstr2) 
    )
    (if (= oldtag3 (strcase (vla-get-tagstring att)))
    (vla-put-textstring att newstr3) 
    )
    )
    )
    
    (setq ss1 nil)
    ; (setq ss2 nil)
    (princ)

  3. #3
    Member
    Join Date
    2012-11
    Posts
    6
    Login to Give a bone
    0

    Default Re: Automated Data Extraction

    I use an "old style data extraction template", with the "ATTEXT" command. Once the template is selected and the location for the saved filename.txt you don't have to keep resetting it. When i have done all the files i use the DOS copy command to combine all the txt files and open in excel. this can also be combined with a batch command and lisp or script file and can be left to run. Also there is a nice command that LeeMac has if you just want attributes from the drawings in a directory.

Similar Threads

  1. UCS and Data Extraction
    By CADdancer in forum AutoCAD General
    Replies: 15
    Last Post: 2018-09-28, 12:16 PM
  2. Replies: 1
    Last Post: 2015-04-29, 01:18 PM
  3. VBA data extraction
    By jbortoli in forum VBA/COM Interop
    Replies: 4
    Last Post: 2012-03-09, 05:55 PM
  4. 2011: Data Extraction
    By CAD-1311 in forum AutoCAD General
    Replies: 5
    Last Post: 2011-07-13, 02:10 PM
  5. Data Extraction
    By matt.wagner in forum AutoCAD LT - Wish List
    Replies: 7
    Last Post: 2009-04-27, 02:02 AM

Tags for this Thread

Posting Permissions

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