|
Welcome, Guest.
|
||||||
| AutoLISP AutoLISP or Visual LISP, learn both here! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Vice President / Director
Join Date: 2000-09
Location: Kenosha Wisconsin
Posts: 375
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Does anyone have an example of loading a lisp routine using a reactor?
For some reason the (load "xxx") is causing an error within a routine I was working on. Peter Jamtgaard |
|
|
|
|
|
#2 |
|
100 Club
Join Date: 2000-12
Posts: 126
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hey Peter,
Not a solution, just an affirmation that I also get errors. I just added an automatic loading feature to a :vlr-unknownCommand reactor and get crashes when it tries to evaluate any C:-functions. Example of error in backtrace: "ads_undef fails: <name num arc>: C:INSUL 2470 22" Tried multiple loads and it stops at the first C: defun it encounters. If no C: defun exists it loads just fine. |
|
|
|
|
|
#3 |
|
Member
Join Date: 2001-12
Location: North Carolina, USA
Posts: 27
![]() ![]() |
Peter,
I don't think that loading lisp programs is inherently bad but the lisp loaded must follow all the rules of reactor callbacks if executed during the callback.(ie. no command functions...) ;;This works fine as long as "test.lsp" either doesn't execute ;;or executes under callback rules. (setq cmdreact (vlr-command-reactor nil '((:vlr-commandended . testload)))) (defun testload (r cl) (if (= "LINE" (CAR cl)) (progn (print "loading") (load "test")))) |
|
|
|
|
|
#4 |
|
Vice President / Director
Join Date: 2000-09
Location: Kenosha Wisconsin
Posts: 375
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Well forum,
I have had a breakthrough.... Let me explain. Frequently I use a statements like this Code:
(defun C:CHW () (load "CHW")(C:CHW)) It was thinking... Could the UnknownCommand reactor be used to load lisp routines? It connot be done directly (because of the errors with loading routines from within a reactor) hence the post that started this thread. I HAVE found a solution, that will allow me to "automatically" load and run lisp routines that have not been defined in a location (like the statement above) using the UnknownCommand reactor. It is a hybrid application that uses a couple tricks. First I used the vla-setVariable method to set the UserS5 system variable to the Unknown command string name inside the reactor. I then created a VBA routine that monitors the system varaiable change events. WHen the system variable is changed the vba event checks to see if it is the USERS5 system variable and if it is... It uses the sendcommand method to load and run the lisp file. I have added some checking mechanisms to make sure the filename is valid. I would be glad to share this code if anyone is interested. Peter Jamtgaard |
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Learning Lisp | Wolfgirl | AutoLISP | 37 | 2008-09-21 07:22 AM |
| Using LISP routines in 2005 Palettes | soverpeck | AutoCAD Customization | 5 | 2005-03-23 10:39 PM |
| Routine to add text below existing text | jhohman | AutoLISP | 8 | 2004-06-29 09:05 PM |
| loading lisp | richardl | VBA | 1 | 2004-06-11 07:37 PM |
| loading lisp | richardl | AutoLISP | 5 | 2004-06-11 04:41 PM |