Author Topic: Persistent Reactors  (Read 6728 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Persistent Reactors
« on: August 27, 2009, 05:56:17 AM »
OK, so I've done a little searching (maybe not thoroughly enough), but I can't seem to find anyway around my problem.

I realise that with a persistent reactor, the reactor object will stay in the drawing (stored in the relevant dictionary (vlr-pers-dictname)), but you must have the callback functions loaded also, to make the reactor work.

So, my question to you clever folks is: Is it possible to make a LISP load upon opening a drawing - (without modifying acaddoc.lsp etc)?

Lee

mkweaver

  • Bull Frog
  • Posts: 352
Re: Persistent Reactors
« Reply #1 on: August 27, 2009, 07:43:48 AM »
OK, so I've done a little searching (maybe not thoroughly enough), but I can't seem to find anyway around my problem.

I realise that with a persistent reactor, the reactor object will stay in the drawing (stored in the relevant dictionary (vlr-pers-dictname)), but you must have the callback functions loaded also, to make the reactor work.

So, my question to you clever folks is: Is it possible to make a LISP load upon opening a drawing - (without modifying acaddoc.lsp etc)?

Lee

Add it to your startup suite with Appload.  This is entirely local (profile) and will not affect any other users.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Persistent Reactors
« Reply #2 on: August 27, 2009, 07:55:22 AM »
Thanks for your reply mkweaver, but I think I didn't explained the question well enough.

I was thinking about if I sent the drawing somewhere - is it possible to get the subs to load automatically?

Chris

  • Swamp Rat
  • Posts: 548
Re: Persistent Reactors
« Reply #3 on: August 27, 2009, 08:33:19 AM »
is it possible to include the callback function as part of the reactor?  or store it in xdata and call it from there?  Or could you even create some very small text, place it in an area where it would be difficult to detect, and read the function from there?  I'm just throwing out ideas trying to help.
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Persistent Reactors
« Reply #4 on: August 27, 2009, 09:20:45 AM »
Nice ideas Chris - I'll look into the XData  8-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Persistent Reactors
« Reply #5 on: August 27, 2009, 09:46:53 AM »
OK, so I've done a little searching (maybe not thoroughly enough), but I can't seem to find anyway around my problem.

That's why I don't like persistent reactors. There are several examples here of nonpersistent reactors where the handles are stored in xdata.
When the reactor lisp is loaded the first time the xdata is read & the reactors are restored.

PS I think there is a way to load a lisp or maybe it was an arx when the drawing is opened.
The thread is here in the swamp but 3-4 years old by now.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Persistent Reactors
« Reply #6 on: August 27, 2009, 09:50:01 AM »
Thanks Alan, I'll have a dig around  :-)

Spike Wilbury

  • Guest
Re: Persistent Reactors
« Reply #7 on: August 27, 2009, 11:42:59 AM »
Lee,

I remember doing some code to allow the lisp file to autoload it self.... but forgot where it is here - not much of a help I know....

Edit <look in there for the solution>:

http://www.theswamp.org/index.php?topic=6870.0
« Last Edit: August 27, 2009, 11:57:56 AM by Esquivel »

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Persistent Reactors
« Reply #8 on: August 27, 2009, 01:07:20 PM »
Aha, So I see Luis that others have thought about it too...  ^-^  Its true what they say about everything has been done before...

Anyway to get back on topic, I probably shouldn't drag this up, due to how "dangerous" it is in the wrong hands   ;-)   but I wanted to understand it better than I do.

Quote
Code: [Select]
(vl-load-com)

(vlax-ldata-put "reactorswiz" "stickto_free_version" nil t)

(alert "this is only a test")

(defun C:TST  ()
  (alert
    "I can be self loaded if you save the drawing\nAnd the next time you open it I will be back"))

Then make a protected separate namespace VLX, have our vlx place in the same folder as our drawing, load the vlx and saved the drawing and that's it....

I've never ventured into the realm of ldata, and so and trying to study it now - but I am not sure what you mean when you mention making a "protected separate namespace VLX" - I realise this is so that the [private] argument will mark the ldata as retrievable only by the VLX, but what does that mean exactly? And also, what are the dictionary keys/names referring to?

I can see that I am a little out of my league with this stuff, but for those with enough patience - I appreciate any help I can get   ;-)

Thanks,

Lee

PS> Would love to know how Michael cracked the you-know-what   ;-)


gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Persistent Reactors
« Reply #9 on: August 27, 2009, 03:24:25 PM »
Hi,

As CAB, I avoid using persistent reactors.
I rather store needed datas in (xdata, ldata, xrecord) in the document and re-built the reactors when loading the LISP file.

You can have an example with Rectangle.lsp
More the object and command or lisp reactors needed for the "rectangle" behavior, a DWG reactor is define which stores the objects handles in a dictionary while saving the document (the last release uses xrecord, others ldata).
On loading the LISP file, the object reactors are re-built from the handles.
Speaking English as a French Frog

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Persistent Reactors
« Reply #10 on: August 27, 2009, 05:39:58 PM »
Thanks for the tip Gile, but the question there is how to load the LISP file automatically...  ;-)

Spike Wilbury

  • Guest
Re: Persistent Reactors
« Reply #11 on: August 27, 2009, 05:52:25 PM »
Lee,

Unfortunately I lost all my practice in lisp and mostly on reactors and worst my memory too (I only use now my last 3 brain cells left)... So, if I had a chance and if I still have the info here, I look around and post it back.

Aha, So I see Luis that others have thought about it too...  ^-^  Its true what they say about everything has been done before...

Anyway to get back on topic, I probably shouldn't drag this up, due to how "dangerous" it is in the wrong hands   ;-)   but I wanted to understand it better than I do.

Quote
Code: [Select]
(vl-load-com)

(vlax-ldata-put "reactorswiz" "stickto_free_version" nil t)

(alert "this is only a test")

(defun C:TST  ()
  (alert
    "I can be self loaded if you save the drawing\nAnd the next time you open it I will be back"))

Then make a protected separate namespace VLX, have our vlx place in the same folder as our drawing, load the vlx and saved the drawing and that's it....

I've never ventured into the realm of ldata, and so and trying to study it now - but I am not sure what you mean when you mention making a "protected separate namespace VLX" - I realise this is so that the [private] argument will mark the ldata as retrievable only by the VLX, but what does that mean exactly? And also, what are the dictionary keys/names referring to?

I can see that I am a little out of my league with this stuff, but for those with enough patience - I appreciate any help I can get   ;-)

Thanks,

Lee

PS> Would love to know how Michael cracked the you-know-what   ;-)



Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Persistent Reactors
« Reply #12 on: August 27, 2009, 05:54:16 PM »
Unfortunately I lost all my practice in lisp...

Moving onto bigger and better things ...

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Persistent Reactors
« Reply #13 on: November 08, 2014, 05:20:45 AM »
Hello!
I read this thread and I am wondering why not use persistent-object-reactor. In my example I have two Block with Attributes (both shows a REAL-value). The sec. is between two blocks is a text with a arrow symbol, that shows in direction there lowest value in the Blockattribute is.

My questions are:
1)How comlicate could it be in the Acad.databas, if have hundrets of Bocks which connect each other ?
2) Which steps I have to do if I create the two blocks ?

3) I want after creation in case I move the block it should change the position of arrow-text-symbol.

I have seen a example-DWG https://www.dropbox.com/s/eevmzowdmqp70el/XDICT.dwg?dl=0

4) How I can understand this xdir, should I save in all objects a xdirectory-object that have connection to the other object or how can it work ?
« Last Edit: November 08, 2014, 05:25:24 AM by cadplayer »