PDA

View Full Version : Map VBA's VLAX ?



KevinBarnett
2005-01-27, 09:00 AM
Greetings,

I am trying to issue ade functions within VBA (Map 2005) using Frank's VLAX:

retval = obj.EvalLispExpression("(ade_projsetsrc " & _
Chr(34) & ComboBox1.value & Chr(34) & ")")

retval = obj.EvalLispExpression("(ade_projsetdest " & _
Chr(34) & ComboBox2.value & Chr(34) & ")")

retval = obj.EvalLispExpression("(ade_projptforward " & _
"(list " & Trim(TextBox1.Text) & " " & Trim(TextBox2.Text) & "))")

But it does not appear to respond.

I have a feeling that this line in the class:
Set VL = ThisDrawing.Application.GetInterfaceObject("VL.Application.16")
is only loading the base lisp and not the ade's.

Does anybody know the solution?

Thanks,

Kevin.

Ed Jobe
2005-01-27, 04:13 PM
ade is not lisp. they are commands loaded from an arx. Try the (command) function, since you are using vlax. Otherwise use SendCommand.

KevinBarnett
2005-01-28, 06:26 AM
Thanks. The follwoing worked, but could I have completed the task in less steps?

Sub try()
ThisDrawing.SendCommand "(ade_projsetsrc " & _
Chr(34) & "Lo-27-WGS" & Chr(34) & ")" & vbCr

ThisDrawing.SendCommand "(ade_projsetdest " & _
Chr(34) & "LL" & Chr(34) & ")" & vbCr

ThisDrawing.SendCommand "(setq a (ade_projptforward " & _
"(list 99229.367 2820428.461)))" & vbCr

ThisDrawing.SendCommand "(setvar " & Chr(34) & "userr1" & Chr(34) & _
" (car a))" & vbCr

ThisDrawing.SendCommand "(setvar " & Chr(34) & "userr2" & Chr(34) & _
" (cadr a))" & vbCr

Dim X, Y As Double

X = ThisDrawing.GetVariable("userr1")
Y = ThisDrawing.GetVariable("userr2")
MsgBox CStr(X) & "," & CStr(Y)
End Sub