Author Topic: Batch Processing.  (Read 9617 times)

0 Members and 1 Guest are viewing this topic.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Batch Processing.
« on: February 29, 2012, 12:39:00 PM »
What, How, do you do it?

VBA, .NET, .lsp?

Pros/Cons?

Thanks
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

danallen

  • Guest
Re: Batch Processing.
« Reply #1 on: February 29, 2012, 12:56:52 PM »
Just started using http://www.ezscriptpro.com and it worked pretty well.

GILESP

  • Newt
  • Posts: 42
Re: Batch Processing.
« Reply #2 on: February 29, 2012, 01:09:04 PM »
I've written a VBA script that does some fairly basic batch processing, it's slow as it has to open each file in turn, and you're at the mercy of the payload once you've opened the file, but it does the trick 9/10 times.

It's nice as I can modify the code to my needs, and write quick 'bodges' as and when someone want to move text by 5mm on 100 drawings.

Code fragment here:

Code: [Select]
    For i = 0 To Me.FilesToOpList.ListCount - 1
        Set SubDwg = Application.Documents.Open(Me.FilesToOpList.List(i, 1), False)
        DwgChanged = False
        'do stuff here

        If BatchLaunchWin.SearchChkBox Then
            DwgChanged = ChangeText(SubDwg, BatchLaunchWin.SearchTextBox.Value, BatchLaunchWin.ReplaceTextBox.Value)
        End If

The payload are functions that return true when they sucessfully execute
..END OF LINE..

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Batch Processing.
« Reply #3 on: February 29, 2012, 01:45:41 PM »
Don't do much batch work, so I custom build where needed.  When I have LSP functions that may be batched I put some consideration as to whats needed to make it work with ObjectDBX e.g. passing a database as an additional argument, with nil selecting the active drawing.  Otherwise, I use dotNET to iterate over the drawings.  Embedded calls to (command...) in some of our client-supplied FAS files results in some COM bodgy-ness so the SendStringToExecute will function appropriately.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Batch Processing.
« Reply #4 on: February 29, 2012, 01:46:53 PM »
I would use this where I could, otherwise I would use a LISP to write Script that calls a LISP  8-)

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Batch Processing.
« Reply #5 on: February 29, 2012, 01:51:27 PM »
I would use this where I could, otherwise I would use a LISP to write Script that calls a LISP  8-)
I would use a LISP to write a script that calls a VBA app that calls a LISP that opens multiple sessions of AutoCAD (in the cloud) that would then process using ODBX via OpenDCL.   All on LINUX!  Bazinga!



Well, alright..... maybe not.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Batch Processing.
« Reply #6 on: February 29, 2012, 01:53:58 PM »
I would use this where I could, otherwise I would use a LISP to write Script that calls a LISP  8-)
I would use a LISP to write a script that calls a VBA app that calls a LISP that opens multiple sessions of AutoCAD (in the cloud) that would then process using ODBX via OpenDCL.   All on LINUX!  Bazinga!

:lol:

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Batch Processing.
« Reply #7 on: February 29, 2012, 04:37:40 PM »
I would use this where I could, otherwise I would use a LISP to write Script that calls a LISP  8-)
I would use a LISP to write a script that calls a VBA app that calls a LISP that opens multiple sessions of AutoCAD (in the cloud) that would then process using ODBX via OpenDCL.   All on LINUX!  Bazinga!



Well, alright..... maybe not.
mindblown.jpg
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

GDF

  • Water Moccasin
  • Posts: 2081
Re: Batch Processing.
« Reply #8 on: February 29, 2012, 04:59:11 PM »
I would use this where I could, otherwise I would use a LISP to write Script that calls a LISP  8-)
I would use a LISP to write a script that calls a VBA app that calls a LISP that opens multiple sessions of AutoCAD (in the cloud) that would then process using ODBX via OpenDCL.   All on LINUX!  Bazinga!



Well, alright..... maybe not.


WTF
 :lmao:
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Batch Processing.
« Reply #9 on: February 29, 2012, 05:34:43 PM »
I would use this where I could, otherwise I would use a LISP to write Script that calls a LISP  8-)
I would use a LISP to write a script that calls a VBA app that calls a LISP that opens multiple sessions of AutoCAD (in the cloud) that would then process using ODBX via OpenDCL.   All on LINUX!  Bazinga!



Well, alright..... maybe not.

You missed XML.   :lol:  I'll assume thats what the scripting is written with, then uses XSL and javascript/ECMA to transform it to an AutoCAD command script.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Batch Processing.
« Reply #10 on: February 29, 2012, 09:21:55 PM »
I have a batch plotting setup that I use.

VBA calls script that processes all the files.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Batch Processing.
« Reply #11 on: March 01, 2012, 07:43:25 AM »
With the batch processor that everyone uses, are you limited to files in a single directory at a time or can you run multiple files from different locations?

Is there ever a need to run a lisp or such once the batch process has finished?

Anyone using straight lisp for batch processing?
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

GILESP

  • Newt
  • Posts: 42
Re: Batch Processing.
« Reply #12 on: March 01, 2012, 08:12:54 AM »
In theory my vba will accept files from every location, as it passes the long filename (Including path) to the open command.  I can't say I've tested that aspect yet as I've not had cause to process massed folders of drawings.

I think the context would determine if an other custom commands are required after running the batch, I've not needed anything like that so far.

I saw a piece of lisp only code once, but it relied on a windows script to open the next file, and then execute another lisp script within it, looked kinda clunky.
..END OF LINE..

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Batch Processing.
« Reply #13 on: March 01, 2012, 10:22:25 AM »
For the one major batch process I have set up, the user creates a master folder, with the drawings split up into sub-folders under that one.  Each sub-folder prompts for process yes/no? in the cycle so the user can skip that group if necessary, since some of the groups need to be processed multiple times.  It does run a pre- and post-LISP to set/remove a semaphore file in the users ACADTEMP folder; that file is used to signal the system to skip some of the standard functions which run on drawing open.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Batch Processing.
« Reply #14 on: March 05, 2012, 03:34:49 AM »
I think the best idea for a Lisp-only batch is Kean's over here: http://through-the-interface.typepad.com/through_the_interface/2009/06/index.html

The reason I say it's the "best" is it attempts to break the scripting into one script per DWG. Thus if something fails in one DWG the entire batch job doesn't fail. Though Kean's example is just that, an example. It's not showing much in the form of UI and selecting DWGs, etc. Also I'd use some other way to store the list of drawings, e.g. instead of a temp file, just use vl-propagate or vl-bb-*.

At the moment though I like AutoScript - does the job reasonably well and faster than ScriptPro. Haven't tried EzScript yet. As for VBA ... if I go that route, I might as well do the whole thing in C#.  ::) ... Which is probably just going to be a clone of AutoScript in any case.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.