.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

vb.net set lisp variable

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
bart_van_tuyl
1638 Views, 5 Replies

vb.net set lisp variable

Hi,

I have a lot of questions qua vb.net and acad, but its all very new too me (an appologie if im anoying). Ive been toyong around with how to set variables and when its system variables its nice and easy. However I would like to know how I can set (or even create) a lisp variable from with in vb.net? Also yes I did consider setting the system variable USERs1 but only found out how to set the system variables for integers, wich is identified as USERi1 through to USERi5. When i tryed it out for string input (as its text i want to store in the variable, the result came up as a blank?
5 REPLIES 5
Message 2 of 6
BlackBox_
in reply to: bart_van_tuyl

For .NET interacting with LISP variables, give this a read: http://www.theswamp.org/index.php?topic=35714.0

 

You might also consider the USERR* and USERS* system variables.

 

Cheers



"How we think determines what we do, and what we do determines what we get."

Message 3 of 6

Userr* means USER REAL, and Users* means USER STRING, since i want to pass a string value i have chosen to use USERS*. The example I found was for integers (or said USERI*). The sample code was as follows

[code]

dim myint as integer= textbox1.text
application.setsystemvariable("Useri1", myint)

[code]

respectivaly if i modify the code as follows it should work for string variables but no value is set?

[code]

dim mystr as string = textbox1.text
application.setsystemvariable("users1", mystr)

[code]

but this fails toset anything, if i call the variable up via the sutocad command prompt it says users1("") ???
Message 4 of 6
norman.yuan
in reply to: bart_van_tuyl

After running the code

 

dim myint as integer= textbox1.text
application.setsystemvariable("Useri1", myint)

 

did you go to the command line for "USERS1" right after with the same drawing? There is no reason the above code does not work.

 

You may be aware that if there are multiple drawings are open, Application.SetSystemVariable() sets system variables of current drawing (MdiActiveDocument). Also, different from other USER variables (USERRx and USERIx), USERSx do not save their value inside the drawing. That is, if the drawing is closed and opened again, the USERSx value set in previous AutoCAD session will be gone.

Message 5 of 6

The integers version works, the string version fails o tried to use a numeric value afterwoulds with the string version but that failed also??
Message 6 of 6
dgorsman
in reply to: bart_van_tuyl

Rather than trying to set a variable, create a method as a LISP function that returns a value.  That way it can be called the same way as a LISP function, even if its just (setq tval (MyNETFunction)).

 

Don't rely too much on the USER* variables - other functions may be using them and writing/rewriting values can have unexpected results.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost