Saturday, November 21, 2009
Home   |   Search   |   About AUGI   |   My AUGI   |   Join Now

Go Back   AUGI Forums > AUGI Technical (English) > Programming > AutoLISP
 Welcome, Guest. 

Login

Join Now FAQ Members List Calendar Search Today's Posts Mark Forums Read

AutoLISP AutoLISP or Visual LISP, learn both here!

Reply
 
Thread Tools Display Modes
Old 2004-07-02, 03:52 PM   #1
peter
Vice President / Director
 
peter's Avatar
 
Join Date: 2000-09
Location: Kenosha Wisconsin
Posts: 375
peter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the stars
Default Loading Lisp routines from a reactor

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
peter is online now   Reply With Quote
Old 2004-07-02, 05:57 PM   #2
stig.madsen
100 Club
 
Join Date: 2000-12
Posts: 126
stig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightly
Default

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.
stig.madsen is offline   Reply With Quote
Old 2004-07-03, 04:31 PM   #3
dbroad
Member
 
Join Date: 2001-12
Location: North Carolina, USA
Posts: 27
dbroad is going the right waydbroad is going the right way
Default RE: Loading Lisp routines from a reactor

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"))))
dbroad is offline   Reply With Quote
Old 2004-07-03, 05:11 PM   #4
peter
Vice President / Director
 
peter's Avatar
 
Join Date: 2000-09
Location: Kenosha Wisconsin
Posts: 375
peter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the starspeter is shooting for the stars
Default RE: Loading Lisp routines from a reactor

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))
in a file with many other statements like this to load lisp routines.

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
peter is online now   Reply With Quote
Reply


Go Back   AUGI Forums > AUGI Technical (English) > Programming > AutoLISP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

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


All times are GMT +1. The time now is 03:53 PM.