VB.NET Var to LISP Var

VB.NET Var to LISP Var

Anonymous
Not applicable
1,391 Views
5 Replies
Message 1 of 6

VB.NET Var to LISP Var

Anonymous
Not applicable

Anybody got a function (or sample code) that converts a VB variable (and it values) to a LISP variable?....VB array to LISP list...

0 Likes
1,392 Views
5 Replies
Replies (5)
Message 2 of 6

kerry_w_brown
Advisor
Advisor

 

Did you want rio use a global lisp Variablewhile the .net is running or return a value from a routine.

Either way, with lists you'll need tio study the details for the result buffer.


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 3 of 6

Anonymous
Not applicable

Thanks for the reply Kerry.

We have a VB.NET app that reads an XML file....and assigns VB Variables values n an array.

For example

VesselInfo (120.0 0.5 12.75 129.625....etc)

Supportinfo (145.75 0.3125 12 45.5......etc)

etc...

 

We then need to convert these VB Arrays over to LISP Variables as a LIST

There are 7-8 of the VB Arrays, all of which contain 20-30 "values"

 

We then take those LISP variables values contained in the lists (probably around 200), and pass to a drawing program that uses LISP routines to generate drawings. The LISP drawing routines are about 50,000 lines of code....thus we dont' want to convert that over to .NET, which would probably be about 200,000 lines of code...

 

I used to use VLAX.CLS that I found on here several years ago. of course, it doesn't work in .NET...and that our problem...basically trying to convert it over.....and I am a novice .NET programmer...(probably a 1.5 on as scale of 10).

 

I need a function that can convert a VB.NET array to a LISP LIST

 

thx

0 Likes
Message 4 of 6

norman.yuan
Mentor
Mentor

You can encapsulate the XML file reading process in a .NET methond, decorated with [LispFunction] attribute, which returns a list of data as ResultBuffer.

 

Then simply call the .NET lisp function in your lisp routine, as if it is a lisp function. Something like:

 

[LispFunction("ReadXml")]

public static ReadXlmData(ResultBuffer args)

{

    //Read XML file

   ....

 

    //Build return data

    ResultBuffer res=new ResultBuffer(....);

   

    //Fill the result buffer with data from XML file

    ....

 

    return res;

}

 

Now, you can call it at command line as if it is a lisp function

 

Command: (ReadXml)

 

At command line, you may get something like  (xx xx xxx xxx xxx), which is the output ResultBuffer, shown in Acad command line as a list, which depends on how you build the output ResultBuffer in the .NET function.

 

In your lisp routine, you can get the .NET function's output:

(setq netOutput (ReadXml))

 

Then you may parse the variable netOutput into a list, based on your lisp routine's need:

(list ...)

 

As you can see, you simply move the XML data reading process (or even showing a form to allow to pick the XML file, or get other user input) into a .NET method, mark it with [LispFunction()], then plug it into your existing lisp routines. Of cause, you have to make sure the .NET dll is loaded before your lisp routine could use it.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 5 of 6

Anonymous
Not applicable

Thanks...very interesting...I'll try and figure it out...I believe I understand what you saying.

0 Likes
Message 6 of 6

kerry_w_brown
Advisor
Advisor

 

Have a look at this

http://www.theswamp.org/index.php?topic=35714.0

 

It's c# but may give you some ideas for a suitable solution.


@Anonymous wrote:

I need a function that can convert a VB.NET array to a LISP LIST 

thx


If you post some code to produce an example list we may be able to determine a more targeted solution.

 

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes