PDA

View Full Version : autolisp var to VBA text box?



mojo8997
5th May 2010, 04:07 am
Hey guys, im getting better at lisp but now i also want to dig into a little vba also, i hear its helpful to learn both if possible, i have a lsp that sets a var and i want it to show up in a vba text box i tried this but its not working, thanks for any advice in advance!

(testing does a (setq testing 12345)




Private Sub UserForm_Initialize()
ThisDrawing.SendCommand "testing" & vbCr
TextBox1.Text = ThisDrawing.GetVariable("test")

End Sub

MSasu
5th May 2010, 05:05 am
First, GetVariable statement is used to list the value of system variable, that it built-in variables that control drawing environment. So, cannot be used to list a user defined AutoLISP variable.

Second, since just getting started, maybe is better to consider the .Net customization approach; this is due to the fact that the VBA technology is dropped by both Microsoft and Autodesk. See:
http://www.cadtutor.net/forum/showthread.php?t=33211
http://www.cadtutor.net/forum/showthread.php?t=34389
http://www.cadtutor.net/forum/showthread.php?t=40154
http://www.cadtutor.net/forum/showthread.php?t=41247
http://www.cadtutor.net/forum/showthread.php?t=42385

Regards,

MSasu
5th May 2010, 05:17 am
To get that AutoLISP – VBA communication done may try to use the user system variables USERI1-5, USERR1-5 and USERS1-5; but the quantity of data that can be transferred this way is limited.

AutoLISP:

(setq USERS1 “TransferedString”)

VBA:

ThisDrawing.GetVariable "USERS1"

Regards,

MSasu
5th May 2010, 06:43 am
You may also take a look on that: http://autolisp-exchange.com/Forums/Forum6/F6T7P1.htm.

Regards,

BIGAL
5th May 2010, 01:11 pm
You can save variables in the user?? these are basicly 15 variables 5 as Integer 5 as string 5 as a real its a good simple way if you only work in house it can have a problem if external software "ADD ONS" also change these values I was involved in some software and we took advantage of this and save various variables in these such as scale, thickness of walls etc

You can also write to the register and save a variable value but its only local on your pc, otherwise look into extended entities which get saved into the drawing.

mojo8997
5th May 2010, 02:36 pm
very cool, thanks for the info! let me see what i can come up with. I would like to learn .net because vba is being dropped, i guess i should start looking into it, thanks again!

BIGAL
6th May 2010, 03:47 am
have a look at this

http://www.cadtutor.net/forum/showthread.php?t=47652