TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: sporte0000 on June 05, 2021, 10:11:05 AM

Title: Acad CoreConsole - Controling Active console count in lisp/autolisp/vlisp
Post by: sporte0000 on June 05, 2021, 10:11:05 AM
So I'm attempting to control the number of active Acad Coreconsole instances are active at one time.  I'm reaching out to the internet with the hopes of more creative solutions being brought up, because I'm honestly out of ideas.  Currently the method i use is similar to the follow:

Code: [Select]

;-------AETM-ACADCORECONSOLESCRIPT------------------------------------------------;;
  ;; 05.19.2021 - 00sp00 | function will run scripts into the core console
    (defun C:AESCRIPTER ( / SNXquote ArchiveComplete FileList FileExt StartFolder SelectedFile scriptnamex)
      (command "FILEDIA" "0"); disable dialogs
      (vl-load-com);vlsip
      (setq SNXquote "\"") ; cast string as vars
      (setq FileExt "dwg") ; cast string as vars
      (LM:getfiles (GETVAR "DWGPREFIX") FileExt)  ; credit lee mac for get files command -> http://www.lee-mac.com/getfilesdialog.html
      (setq scriptnamex (getfiled "Select a Script File" (strcat (getenv "UserProfile") "\\Desktop") "scr" 16))
      (foreach SelectedFile FileList
        (COMMAND "start" (strcat "accoreconsole " "/i " SNXquote SelectedFile SNXquote " /s " SNXquote scriptnamex SNXquote " /l en-us"))
      )
      (command "FILEDIA" "1")
      (princ)
    )


I'm using the following generic plot script to push new dwfs

Code: [Select]

(COMMAND "PROXYNOTICE" "0")
(COMMAND "PROXYSHOW" "0")
(COMMAND "PROXYGRAPHICS" "0")
(COMMAND "ISavepercent" "0")
(COMMAND "ISAVEBAK" "0")
(COMMAND "XREFREGAPPCTL" "0")
(COMMAND "FILEDIA" "0")
(setq cmdsave (getvar "cmdecho"))
(setvar "cmdecho" 0)
(vl-load-com)
AttDia 0
AttReq 0
-PLOT
Yes

DWFx ePlot (XPS Compatible).pc3
ARCH full bleed D (24.00 x 36.00 Inches)
Inches
Landscape
No
Extents
1=1
Center
Yes
acad.stb
Yes
No
No
No
;ENTER FILE OUTPUT TYPE NAME

No
Yes
AttReq 1
AttDia 1
_qsave
(COMMAND "FILEDIA" "1")
(setvar "cmdecho" cmdsave)
_qsave


This system works great for just pushing either a relatively small number of plots out, but If you say try to push a schematic of 1300 drawings.  Well your PC becomes a vacuum, space heater, and nuclear fallout zone all-in-one.  So as a result I'm looking to try to control the number of active Consoles to keep from destroying my gear.  Albeit the explosion of active programs is awe inspiring to watch as the number YEETs itself into space!

I've researched the following methods

0. Writing an external .bat file to run the console then build a detectable .txt file as a process finished response.  I've never written .bat files proficiently so this is out of my element. 

1. Poling using a delay or sleep method.  This works pretty well for controlling the wait times, but without an effective output from the actively running console.  You tend to be a bit SOL trying to know when to stop waiting.

2. CoreConsoles Calling Coreconsoles...  So this was a doomed effort to look at. 

3. Building external code modules in other languages than lisp.   I do this for large user deployments So new arx, crx, or dll's haven't been explored, because of distribution complexity.  The coreconsole without any additionally loaded CRX modules is not capable of creating new files.  It can do saveas, but then I'm deleting new files as well.  Crappy workaround but maybe the only way out.


Title: Re: Acad CoreConsole - Controling Active console count in lisp/autolisp/vlisp
Post by: BIGAL on June 05, 2021, 08:49:48 PM
This may help for 1300 dwgs.

https://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-console.html
Title: Re: Acad CoreConsole - Controling Active console count in lisp/autolisp/vlisp
Post by: VovKa on June 06, 2021, 06:38:23 AM
So I'm attempting to control the number of active Acad Coreconsole instances are active at one time.
have a look at https://www.theswamp.org/index.php?topic=56327.msg602026#msg602026
and use it instead of start, it will wait until the external program finishes and then proceed

you might also like 'mp-console-process-drawing' function here https://www.theswamp.org/index.php?topic=56285.msg601774#msg601774
Title: Re: Acad CoreConsole - Controling Active console count in lisp/autolisp/vlisp
Post by: Crank on June 06, 2021, 07:53:47 AM
Good links Vovka !


For large batches you can also think about parallel processing.

Divide the files over several processes, keep 1 (or more) core available for other tasks:
Code: [Select]
(setq MaxTasks (1- (atoi (getenv "NUMBER_OF_PROCESSORS"))))