Author Topic: Batch Processing.  (Read 2362 times)

0 Members and 1 Guest are viewing this topic.

deegeecees

  • Guest
Re: Batch Processing.
« Reply #15 on: March 05, 2012, 12:10:27 pm »
I have a Lisp batch processor floating around here somewhere. It takes all dwg's from ONE directory only though. Maybe someone could expand on it. I would but I've been away from Lisp/programming for quite a while now.

Here it is:

http://www.theswamp.org/index.php?topic=21412.msg259520#msg259520

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Batch Processing.
« Reply #16 on: March 05, 2012, 03:13:26 pm »
The reason I am inquiring is, I have been working on one that is lisp only (no scr)  I have it to a point that it works pretty well.  Once I finish some of the documentation I will post it for everyone to tear to shreds.  It allows drawings from any location, and also has the ability to run a clean up function upon completion. (lsp, bat, exe, vbs).  I am cleaning up the code a bit and finishing up the documentation and I'll post it.
ACA 2011 - Windows XP
All Comments and Content by TimSpangler, Copyright 2012

deegeecees

  • Guest
Re: Batch Processing.
« Reply #17 on: March 05, 2012, 10:53:45 pm »
Sounds pretty cool, looking forward to it.

Ausrod

  • Newt
  • Posts: 25
Re: Batch Processing.
« Reply #18 on: March 06, 2012, 12:05:22 am »
I would suggest you try scriptpro2 free download from http://labs.autodesk.com/utilities/ADN_plugins/catalog/
this is already very fast, has a good user interface and lets you know if the script was successful. This will be even faster once you have 2013 as mentioned in http://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-console.html
Regards Rod

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 10733
  • class keyThumper<T>:ILazy<T>
Re: Batch Processing.
« Reply #19 on: March 06, 2012, 02:08:08 am »

I have to agree about ScriptPRO2. I've written several batch processors over the years but I currently use scriptPRO  for all batch processing we need.  It's written in C# and works in 32 and 64 bit environments. It's well behaved and easy to use.

Regards,
 
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate<--

irneb

  • Water Moccasin
  • Posts: 1641
  • ACad R9-2014, Revit Arch 6-2014
Re: Batch Processing.
« Reply #20 on: March 07, 2012, 07:14:06 am »
I don't know ... I've tried ScriptPro 2 several times now, but it only works on 32bit systems (and XP at that). I've tried everything I could think of, including starting it as Administrator, changing all the settings in W7 to allow all access to every file/folder without constantly poping up with that admin access dialog, changing username to be a full admin, only working with SCR & DWG files saved direct to a user-created folder on my C drive. Etc. etc. etc.

On 32bit XP it has no benefit over the old ScriptPro (i.e. it opens an acad session for each DWG in turn). On Win7 64bit I keep getting a situation of "Can't start the acad.exe process. Only in one case did it open the ACad logo screen, and then simply close it down without doing anything.

And I can't understand what you guys mean by: "It's fast". It needs to close and restart acad for every DWG you've added to the list. AutoScript doesn't need to do that since it runs inside of acad already - no need to start a new process, just open DWG, run SCR, close DWG ... next.

Anyhow, the very oldest LSP only thing I could find is this: http://www.jefferypsanders.com/autolisp_batchlisp.html
But that one sets SDI=1 in order to force acad to only have one DWG open at a time - i.e. it then works like the very old (early 90's) acads.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 10733
  • class keyThumper<T>:ILazy<T>
Re: Batch Processing.
« Reply #21 on: March 07, 2012, 02:51:13 pm »
I don't know ... I've tried ScriptPro 2 several times now, but it only works on 32bit systems (and XP at that). I've tried everything I could think of, < .. >

I run it on a group of 64 bit machines with impunity.

... and yes, speed is relative ... it's not as speedy as some of my old lisp controllers ... but it behaves well if a drawing errors out.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate<--

CADDOG

  • Newt
  • Posts: 76
  • wishbonesr
Re: Batch Processing.
« Reply #22 on: July 27, 2012, 01:03:35 pm »
I would seriously revisit Lee Macs post about his ODBX wrapper.  He's really under selling it.  One of the best implemenations of ODBX near plugin capability.

See how fast DBX can opperate - see below.

Combine your function with his LM:GetFiles function and that will prep a list formatted for his LM:ODBX wrapper function.  (LM:GetFiles btw is the best file selectors I've seen.)


Without the additional called functions, here's another example of using his wrapper.

First here, we get options from the user
Code: [Select]
(initget "Valves Linenumber Equipment Instrument")
  (if (setq opt (getkword "\nChoose Extraction Type [Valves/Linenumber/Equipment/Instrument] <exit>: "))
    (if (findfile (strcat "advanExtract_" opt ".lsp"))
      (load (strcat "advanExtract_" opt ".lsp"))
      (princ (strcat "Missing: BorderExtract" opt ".lsp")))
    ;not opt then exit
    (exit)
    )
 
  (initget "Select Current")
  (setq opt (getkword (strcat advan_Outfile ":  " "Process [Select files/Current dwg] <Current dwg>: ")))
  (cond
    ((= opt "Select")
     (cond
       ((not LM:ODBX) (princ "DBX Wrapper function not loaded.  See Admin"))
       ((not LM:GetFiles) (princ "Get Files Wrapper function not loaded.  See Admin"))
       ((not advan_Outfile)) ;we've already warned, just making sure these got set
       ((not advan_BlockList)) ;public var loaded by (load (strcat "advanExtract_" opt ".lsp"))
       ((not advan_TagList)) ;public var loaded by (load (strcat "advanExtract_" opt ".lsp"))
       (t (_extraction t)))
     )
    (t
     (_extraction nil)
     )
    );cond

And then there's the actuall implementation of his ODBX wrapper and GetFiles function
Code: [Select]
  (defun _extraction (runfolder / doc dwgname data name file item a)
    (setq name "")
    (setq doc (vla-get-activedocument (vlax-get-acad-object))
  dwgname (vla-get-fullname doc))
    (cond ((and (not runfolder)
(setq name (strcat (vl-filename-directory dwgname) "\\" (vl-filename-base dwgname) " " advan_Outfile))
(setq data (_parseattributes (list (append (list dwgname) (_getattributes doc)))))
);and
   (setq name (_getsavefile "Choose Extract Save File" name "CSV"))
   )
  ((and (setq name (strcat (vl-filename-directory dwgname) "\\"))
(setq runfolder (LM:GetFiles "Select Files to Process" name "dwg"))
(setq data (_parseattributes (LM:ODBX '_getattributes runfolder nil)))
(setq name (strcat (vl-filename-directory (caar data)) "\\" advan_Outfile))
(setq name (_getsavefile "Choose Extract Save File" name "CSV"))
);and
   )
  );cond
...
...
...

The rest of the code is just parsing the return data to a deliminated out file.
Notice my call to his _getattributes function.


Another implementation translated 3384 attributes on 130 drawings in 14.25 seconds.
Code: [Select]
     Processing Results
---------------------------
     Drawings Processed: 130
  Translated Attributes: 3384
        Processing Time: 14.25 seconds

I can't say enough about DBX and how Lee has brought, the more confusing implementation of it, down to my level.

NOTE:  Don't forget that you can vl-propagate a var if you need to supply more info to your function derived by user interaction at the beginning.

Lee Mac

  • Seagull
  • Posts: 10004
  • AutoCAD 2015 Windows 7 London, England
Re: Batch Processing.
« Reply #23 on: July 28, 2012, 03:17:06 pm »
Wow! -  Many thanks for your high praise for my functions CADDOG, I very much appreciate it. That's fantastic to hear that you are able to utilise the functions in your programs, and it's great that you are also pleased with the results  :-)

ObjectDBX is indeed a powerful tool when used in the right way, and I'm pleased that my ObjectDBX Wrapper has made the interface more accessible for other developers to use in their programs.