• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

switch variables from vb6 to autolisp

  • Thread starter Thread starter tiziano69
  • Start date Start date

tiziano69

Guest
it is possible to pass variables of vb6 to autolisp..... I have done this way but since the variables are many I have not available so many variables "users1" made available by autocad. There is a cleaner method or I can create a variable that can be used in autocad (lisp) directly from vb6.

objdoc.setvariable "users1", text2.text
autocad.acadapplication.activedocument.sendcommand (setq a (getvar ""users1"")" & vbcr

Thank you.
 
you did not pass "users1" to lisp but set the variable "a" to such value.
A$="test"
autocad.acadapplication.activedocument.sendcommand (setq a " & chr(34) & a$ & chr(34) & ")" & vbcr
So you can pass as many as you want.
there are other methods but this is easy to manage.
bye
 
ok thanks, I have made various tests and I could verify that you can pass also directly the values present within the vb6 controls - this is the code used

private sub command1_click()
set objacad = getobject(, "autocad.application") set objdoc = objacad.activedocument

a$ = "test"
b = "try"
c = 10
d = 45
autocad.acadapplication.activedocument.sendcommand (setq a " & chr(34) & a$ & chr(34) & ")" & vbcr

autocad.acadapplication.activedocument.sendcommand"(setq b " & chr(34) & b & chr(34) & ")" & vbcr

autocad.acadapplication.activedocument.sendcommand"(setq c " & chr(34) & c & chr(34) & ")" & vbcr

autocad.acadapplication.activedocument.sendcommand"(setq d " & d")" & vbcr

autocad.acadapplication.activedocument.sendcommand"(setq d " & text1.text & ")" & vbcr

end
 
a clarification: In doing so create public variables, take into account why they could be caused by overwriting of values that would result in unwanted abnormalities.
 
is it possible to do the opposite, that is, having in autocad a variable "pippo", to be able to read the content from vb6 ?
 
you can use the configuration log:
in lisp
(defunc c:rwrite()
(setq strpippo "test string value")
(vl-registry-write "hkey_current_user\\software\\vb and vba program settings\myapp\\\\\lisp2vba" "pippo" strpippo)
)

where "pippo" will be displayed in the configuration log in column name
the value of the variable strpippo in data column

in vba
strpippo=getsetting("myapp", "lisp2vba", "pippo", "")

at the end of reading from vba deletes entries in the register.

bye
 
Okay, thank you, I got what I wanted, a last question, how do I remove voices in the register?
 
I solved that, okay?

(defun c:del_chiave()
(vl-registry-delete "hkey_current_user\\software\\vb and vba program settings\myapp\\\\\lisp2vba" "pippo")
)
 
you make me an example of writing/reading a registry key in vb6... I only managed partially.

rege.regwrite "hkey_current_user\software\vb and vba program settings\myapp\tavoletta", value, "reg_sz"


Thank you.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top