Author Topic: using LISP/VLISP with coreconsole  (Read 3151 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
using LISP/VLISP with coreconsole
« on: March 18, 2015, 02:42:35 PM »
Hi all,

anyone already experimented to use LISP batch process with coreconsole ?
Keep smile...

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: using LISP/VLISP with coreconsole
« Reply #1 on: March 19, 2015, 10:33:10 AM »
I wrote a program using the console, for parallel computing.
The program has involved 8 core procesor.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: using LISP/VLISP with coreconsole
« Reply #2 on: March 19, 2015, 10:56:08 AM »
I wrote a program using the console, for parallel computing.
The program has involved 8 core procesor.

nice...wrote in .net ? or LSP ?
Keep smile...

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: using LISP/VLISP with coreconsole
« Reply #3 on: March 19, 2015, 11:30:43 AM »
I wrote a program using the console, for parallel computing.
The program has involved 8 core procesor.

nice...wrote in .net ? or LSP ?
LISP!  :-)

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: using LISP/VLISP with coreconsole
« Reply #4 on: March 19, 2015, 11:45:07 AM »
a little more information in my presentation (see slide 13 - 26)

Andrea

  • Water Moccasin
  • Posts: 2372
Re: using LISP/VLISP with coreconsole
« Reply #5 on: March 19, 2015, 11:52:29 AM »
a little more information in my presentation (see slide 13 - 26)

:\ not able to open your file....

however,...my question is,...do you use LISP function in batch with coreconsole or autoCAD command only ?
Keep smile...

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: using LISP/VLISP with coreconsole
« Reply #6 on: March 19, 2015, 11:56:08 AM »
Yes, I'm from lisp files generates bat  and scr files to launch consoles. Lisp gets executed multiple bat files and keep track of the end of each. Once freed stream, run the following...

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: using LISP/VLISP with coreconsole
« Reply #7 on: March 19, 2015, 12:00:30 PM »
a little more information in my presentation (see slide 13 - 26)

:\ not able to open your file....

however,...my question is,...do you use LISP function in batch with coreconsole or autoCAD command only ?
presentation in pdf

Andrea

  • Water Moccasin
  • Posts: 2372
Re: using LISP/VLISP with coreconsole
« Reply #8 on: March 19, 2015, 02:46:41 PM »
thank you,...I did exactly the same thing...
unfortunatly,...I had some issue with some lisp loaded from the script..
in fact,...when a "SAVE" or "SAVEAS" or "QSAVE" command come directly from the lisp file...the drawing is not saved.
but as I see,...you by-bass this step by using these command in the script directly.  :) nice catch.

what I came with a solution,...is...
1) put your LISP file in the startup application
2) run accoreconsole.exe to open each drawing without any script.

it work.
Keep smile...

enderprime

  • Guest
Re: using LISP/VLISP with coreconsole
« Reply #9 on: March 25, 2015, 03:52:11 PM »
My post in a similar thread recently:

Quote
I have a number of batch tools that utilize scripts to process lists of drawings.

My general method is:

1) Separate LISP into 2 functions, one that creates and runs the main script, and one that will run in each dwg, ex: f-external and f-internal

2) In (f-external), for each dwg in the batch list, add to the main script something similar:

    "_.OPEN"
    "path-to-dwg"
    "(load \"path-to-lisp\")"
    "(f-internal)"

    Loading and executing the (f-internal) function per drawing keeps all real work inside LISP, instead of having a long script file that can only
    issue commands. This lets you do all the cool vla/vlax functions and decisions/loops that you can't do through script commands.
   
    If you are loading each drawing in its own session, such as through core console, then you can omit the open command and use the same
    script for every drawing, instead of making a long assembly line type of script.

3) In (f-internal), do all necessary work, then save and close the drawing

4) At the end of (f-internal), I append a report or log file of work done. You could also write variables to a file at this point so that the main code can read them back if needed.

As for keeping main code paused while f-internal is working, what I have been doing is creating my own .lock file that gets deleted when f-internal is finished (it may be any file type really, and does not need to contain any actual data). Somewhere in a (foreach dwg dwgs..) processing loop or in a main code block just before the main script starts running, I usually have code similar to the following:

(while (findfile "path-to-lock")
    (command "DELAY" 1000)
)

So every second it checks if the lock file still exists, and if so it waits before continuing along in the loop. If you would like to use only one lock file that exists for the duration of the batch, you could have the end of script delete the lock file instead of (f-internal) with:

"(vla-file-delete \"path-to-lock\")"

This method has been very successful for me, both in MDI and SDI batches. Hope it helps.