+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Senior Member MiGo's Avatar
    Computer Details
    MiGo's Computer Details
    Operating System:
    XP
    Computer:
    Junk (typical)
    Monitor:
    Dual Screen
    Using
    MEP 2010
    Join Date
    Mar 2009
    Location
    Upstate NY
    Posts
    150

    Question AutoLISP run on group of drawings?

    Registered forum members do not see this ad.

    Is it possible to make an AutoLISP that gets a selectionset of drawings from the user and simply runs a script on each drawing selected?

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,729

    Default

    I've never done it, but I should think that you could get a list of the drawings and then get a LISP routine to write the script file and save it somewhere, then the user can run it, but I don't think you can run a script on more than one drawing from a LISP as the LISP would terminate as soon as the new drawing is opened.
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  3. #3
    Senior Member MiGo's Avatar
    Computer Details
    MiGo's Computer Details
    Operating System:
    XP
    Computer:
    Junk (typical)
    Monitor:
    Dual Screen
    Using
    MEP 2010
    Join Date
    Mar 2009
    Location
    Upstate NY
    Posts
    150

    Default

    A guy at where I work has come up with some lisp routines that run functions that the user designates on a batch of drawings that the user selects, but you have to put cad in a Single Drawing Interface (sdi).

  4. #4
    Super Moderator fuccaro's Avatar
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,540
    It's nice to be nice, but sometimes is nicer to be evil!.
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,729

    Default

    I would still be inclined to use something like a combination of maybe, "getfiled" and/or "vl-directory-files" or something to that nature to collect your list of files and directory paths.

    Then, I would use "vl-filename-mktemp" to create the script file and use "write-line" to write a script file that you can run at your own expense.

    Or maybe you could use the "script" command (but make sure that it is the LAST thing you run in your LISP...

    Just my opinion,

    Lee
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  6. #6
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    6,007

    Default

    scriptpro (autodesk) will do exactly that.
    write a little script that will execute the lisp routines.

    this won't work anymore (scriptpro doesn't work with plotting after version 2004, i think), but this was something i put together to batch plot our EMP plans. this way, we could set a computer to plot the sheets, then have an admin collate anything that was out of order. granted, sheet set manager does this now but you can still use it for batch editing drawings.

    Code:
    (foreach layl (layoutlist)
     (if (wcmatch (strcase layl) "*EMP*")
      (progn
       (setvar "ctab" layl)
       (command "-plot" "n" (getvar "ctab") "" "" "n" "n" "y")
      );progn
     );if
    );foreach
    even though this is all lisp coding, you can still just load it as a .scr file. or just call out the lisp routines from your script. this was one of many we used. i just keep them in my archives to be a pack rat.

  7. #7
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    You should get collection of opened documents:

    Code:
    (setq dCol(vla-get-Documents
    	    (vlax-get-acad-object)))
    and run your code for every drawing:

    Code:
    (vlax-for doc dCol
     ... Your code ...
    ); end vlax-for
    To open existing documents you can use vla-Open method:

    Code:
    (setq doc(vla-Open dCol "C:\\Some path"))
    Or use Object DBX interface to proceed drawings without opening.

    You can't to use command for this code.

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,729

    Default

    Registered forum members do not see this ad.

    ASMI, I learn such a lot from you

    Thanks
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

Similar Threads

  1. is this a group or what!?
    By dusko in forum AutoCAD General
    Replies: 5
    Last Post: 3rd Feb 2009, 04:09 pm
  2. .dwg to .tif group 4?
    By MAREBER in forum AutoCAD Drawing Management & Output
    Replies: 10
    Last Post: 15th Sep 2008, 01:06 pm
  3. Easiest way to convert a batch of 2007 drawings into 2004 drawings?
    By hhh123kid in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 17th Jun 2008, 04:42 am
  4. add group
    By htls69 in forum Feedback
    Replies: 4
    Last Post: 7th May 2008, 11:25 am
  5. Making AutoCAD drawings look like hand drawn drawings
    By ron1976uk in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 20th Aug 2004, 01:17 pm

Bookmarks

Posting Permissions

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