Results 1 to 2 of 2

Thread: Lisp to separate multiple drawing based on some text key word

  1. #1
    Member
    Join Date
    2009-02
    Posts
    7
    Login to Give a bone
    0

    Default Lisp to separate multiple drawing based on some text key word

    Hai,

    I have almost 1000 drawings in folder. I need to separate them based on some text keyword in the drawings.For eg: I need to separate the drawings which contains text key word "hello" in to one folder and the rest of the drawing to another folder. I need to do it with out opening the cad.With my limited knowledge I wrote a small auto lisp program and tried to run it through script and bat file. But unfortunately its shows message that "cannot find the specified drawing file.Please verify the file exists". When I double click the drawing file it opens perfectly.Can any body help me to solve this issue.I am attaching the files what I have prepared.

    Regards
    Prasanth
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    2006-07
    Location
    Currently Vancouver BC
    Posts
    47
    Login to Give a bone
    0

    Default Re: Lisp to separate multiple drawing based on some text key word

    you can try "SaveAs" , vl-file-copy or use dbx

    Code:
    ;;; How to use (sortFile "Find Me Text" "c:/temp")
    ;;; Select all dwg from a dwg-folder
    ;;; Create a subfolder named stringToFind
    ;;; open DBX file
    ;;; Find a stringToFind in next_object
    ;;; Copy dwg if stringToFind is found
    (defun sortFile (stringToFind dwg-folder / file files AD cad-ver)
    (setq files(vl-directory-files dwg-folder "*11.dwg" ))
    (setq cad-ver (itoa(atoi(getvar "acadver"))))
    (vl-mkdir (strcat dwg-folder "/" stringToFind ));; make a folder
      
    (foreach file files
     (setq AD (vla-getinterfaceobject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." cad-ver)))
     (vla-open AD (strcat dwg-folder "/" file))
     (vlax-for next_object (vla-get-modelspace AD )
      (if (not(findfile (strcat dwg-folder "/" stringToFind  "/" file)))
       (if(= "AcDbMText"(vla-get-ObjectName next_object))
        (if (vl-string-search stringToFind (vla-get-TextString next_object))
         (vl-file-copy fileName (strcat dwg-folder "/" stringToFind  "/" file))
        )
       )
      )
     )
     (vlax-release-object AD)
    )
    )

Similar Threads

  1. Lisp to convert multiple dimensions to text
    By mbrandt5 in forum AutoLISP
    Replies: 10
    Last Post: 2015-07-15, 01:14 AM
  2. MS Word - TOC with separate docs
    By Wanderer in forum Software
    Replies: 8
    Last Post: 2015-05-06, 05:46 PM
  3. Replies: 9
    Last Post: 2012-01-21, 07:58 AM
  4. Lisp to print multiple title blocks in a drawing
    By leo_munters in forum AutoLISP
    Replies: 5
    Last Post: 2010-07-08, 07:13 AM
  5. Replies: 3
    Last Post: 2007-02-08, 11:43 AM

Posting Permissions

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