PDA

View Full Version : LISP/VBA Data Communication



relysoft
2005-02-15, 08:44 PM
As you regulars has seen, I have been posting questions on this forum for the last few days as I try to lean enough about ACAD's VBA environment to accomplish the task before me. Thanks for being so helpful.

Now I would like to pose a more general question....

What is a simple way to communicate data among my LISP and VBA functions. This needs to be bi-directional and must support data created in the ACAD current session or data that needs to be stored with the drawing for later use. I am thinking that XDATA and dictionaries are probably my two simplest choices. Is that correct and reasonable? Remember, I'm a novice in VBA and have coded LISP for only a few months, so I need a SIMPLE solution for my requirements.

Thanks,
Bob

Ed Jobe
2005-02-15, 09:39 PM
Sounds like you have complex requirements. So I wouldn't expect a simple solution. Can you clarify "bidirectional"? You can't have both lisp and vba controlling each other at the same time. Also, vba can use vlisp as a 'client', but it's not that staightforward the other way around.

relysoft
2005-02-15, 10:26 PM
Ed,

Sorry I was ambiguous on what I meant by bi-directional. Funny how clear it was to me until I went back and reread it with a more objective perspective.

Here's the scenario...

I have some data that resides in a text file that I read using LISP when ACAD is launched. I store this data in the blackboard and get it from there each time a drawing is opened. This information is operator-dependent so it varies by user login. I need to store a portion of this data and some dynamically created data with the drawing and update it each time the drawing is saved. I am working on using VBA to save the updated data so I can wrap my logic around the CLOSEALL and QUIT commands in case a drawing has not been saved before that point.

I do not foresee a requirement for direct communication bewteen LISP and VBA for this. I just need a way to store the data with the drawing and get and put it from both VBA and LISP. Somewhat analogous to using the blackboard in LISP to communicate between drawings. In this case I am thinking that XDATA or a dictionary could be used as the "blackboard" between LISP and VBA. Not very elegant, but a suffcient solution for my immediate needs. Was thinking that there might be a simpler way.


Thanks for your help.

Bob

Ed Jobe
2005-02-15, 11:21 PM
If all you need lisp for is reading the text file, I would rewrite that in vba.

L.J.Oosterbaan
2005-03-12, 01:20 AM
Memory data (variables) defined in LISP do not propegate into a new drawing session.
meaning if in drawing 1 a=1, if you open drawing 2 a is not defined. With VBA these variables remain static between sessions. Specific data you can store with LISP in the USERx systemvariables, which you can retrieve with VBA and the other way around, but these get unreachable from one drawing to another.

jwanstaett
2005-03-14, 02:46 PM
see post http://forums.augi.com/showthread.php?p=28768#post28768 for way to read and write to lisp from VBA

san_k4
2005-03-16, 04:19 AM
There is plenty of code available in the web for reading text files through vba. After I migrated To vba, I have found it better to keep my data in a database and take the rquired information through an sql query.just check out if it will suit you. this feature may have been introduced in vlisp..i am not sure about it..

Regards,

santhosh