Results 1 to 4 of 4

Thread: Loading Lisp routines from a reactor

  1. #1
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,106
    Login to Give a bone
    0

    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

  2. #2
    100 Club
    Join Date
    2000-12
    Posts
    126
    Login to Give a bone
    0

    Default Re: Loading Lisp routines from a reactor

    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. #3
    Active Member
    Join Date
    2001-12
    Location
    North Carolina, USA
    Posts
    52
    Login to Give a bone
    0

    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"))))

  4. #4
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,106
    Login to Give a bone
    0

    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

Similar Threads

  1. Lisp routines not loading in 2013
    By thomas.stright in forum AutoLISP
    Replies: 1
    Last Post: 2012-09-04, 01:59 PM
  2. 2012 LT Question (Loading Lisp Routines)
    By jdcincy in forum AutoLISP
    Replies: 3
    Last Post: 2011-07-27, 01:36 PM
  3. Replies: 5
    Last Post: 2006-12-08, 03:20 AM
  4. Loading LISP routines, is there a better way...
    By thomas.stright in forum AutoLISP
    Replies: 24
    Last Post: 2006-02-23, 05:00 PM
  5. Lisp routines not loading
    By stusic in forum AutoLISP
    Replies: 6
    Last Post: 2004-11-09, 06:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •