Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting a VBA variable into a VisualLisp variable

302 views
Skip to first unread message

Stacey Yates

unread,
Apr 8, 1999, 3:00:00 AM4/8/99
to
Does anyone know the command or sequence of commands to transfer
a variable (from a textbox control in VBA: variable.text) into a Visual Lisp
variable? and ViceVersa if possible...any recommendations would be
very very helpful...thanx.

Stacey Nicole
stacey...@towill.com
 

Thilaknath Rao

unread,
Apr 9, 1999, 3:00:00 AM4/9/99
to
Hi,

I have a solution for this, but probably may not be usefull at all times.

If you would like transfer values like strings or numbers from VBA to VLISP,
then probably u can assign them to one of the user variables
(setvariables)[Ex: Users1-5 or Userr1-5 or Useri1-5] and then from VLISP
access these setvariables.

Similarly, from VLISP to VBA.

Note, that this has a lot of limitations.

Thilak
thil...@hotmail.com


Luther W. Early

unread,
Apr 9, 1999, 3:00:00 AM4/9/99
to

You could pass data as string through a file. Works like a charm. I have been doing so since AC
r2.3 when PDS was Basic. <g>

Cheers,
Lu
;-----------------------------------------------------------------------
; When all else fails, read the book. But there ain't none no more! <g>
; CAD-Tek web site: http://www.cad-tek.com
;-----------------------------------------------------------------------

Michael Puckett

unread,
Apr 9, 1999, 3:00:00 AM4/9/99
to
Another cheesy way would be to use the User* variables. You have at your
disposal reals (UserR1-5), Integers(UserI1-5) and Strings (UserS1-5).

Certainly not bullet / idiot proof, but it'll work.

e.g.

''' VB(A) *******************************

Dim VarName as String
Dim VarData as Variant

VarName = "USERR1"

' get data left by last program to access UserR1
VarData = ThisDrawing.GetVariable (VarName)

' do stuff, change value, send it back to user var
VarData = 2 * PI
ThisDrawing.SetVariable VarName, VarData

;;; LISP *******************************

; get data left by last program accessing UserR1
(setq vardata (getvar "userr1"))

; do stuff, change value, send it back to user var
(setvar "userr1" (* 2 pi))

Precarious stuff, since any, and all programs have access to this "landing
zone", but it is really easy to use (and abuse). If your VB(A) and LISP
programs are running back to back it shouldn't pose a problem.

- - -

In the good old DOS days I use to use upper memory (beyond 640k) unused by
video to swap data between programs; sure miss those days.

Regards,

M.

- - -

Luther W. Early <lea...@cad-tek.com> wrote in message
news:370e5ee1....@adesknews.autodesk.com...


> On Thu, 08 Apr 1999 10:42:54 -0700, Stacey Yates <stacey...@towill.com>
wrote:
>
> >Does anyone know the command or sequence of commands to transfer
> >a variable (from a textbox control in VBA: variable.text) into a Visual
> >Lisp
> >variable? and ViceVersa if possible...any recommendations would be
> >very very helpful...thanx.
> >
> >Stacey Nicole
> >stacey...@towill.com
> >

<snip>


Tony Tanzillo

unread,
Apr 10, 1999, 3:00:00 AM4/10/99
to
Try this:

(Before you can do this, you must first call
(vl-load-com) in Visual LISP)

Public Sub1()
Dim VLisp as Object
Dim vlEval as Object
Dim vlRead as Object
Dim vlResult as Object
App As AcadApplication
Set App = ThisDrawing.Application
Set Vlisp = App.GetInterfaceObject("VL.Application.1")
Set vlEval = VLisp.ActiveDocument.Functions.Item("Eval")
Set VlRead = VLisp.ActiveDocument.Functions.Item("read")
Set VlResult = VlRead.FunCall("(setq x 99)")
Set vlResult = VlEval.FunCall(vlResult)
End Sub


Stacey Yates wrote:
>
> Does anyone know the command or sequence of commands to transfer
> a variable (from a textbox control in VBA: variable.text) into a Visual Lisp
> variable? and ViceVersa if possible...any recommendations would be
> very very helpful...thanx.
>
> Stacey Nicole
> stacey...@towill.com
>

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.t...@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/

Tony Tanzillo

unread,
Apr 10, 1999, 3:00:00 AM4/10/99
to
Oops - In the following code,

change 'App As AcadApplication' to

'Dim App As AcadApplication'

kailas

unread,
Apr 12, 1999, 3:00:00 AM4/12/99
to
Hi all,

Here is code with small modification. I have tried the code given by Tony.
For lists and other data types also. I can use standard data types in VB and
AutoLisp. There is no similar data type like list in AutoLisp in VB(A)


Sub Sub1()
Dim VLisp As Object
Dim vlEval As Object
Dim vlRead As Object
Dim vlResult As Variant
Set VLisp = ThisDrawing.Application.GetInterfaceObject("VL.Application.1")


Set vlEval = VLisp.ActiveDocument.Functions.Item("Eval")

Set vlRead = VLisp.ActiveDocument.Functions.Item("read")
Set vlResult = vlRead.FunCall("(setq x (list 100 100))")
If TypeName(vlEval.FunCall(vlResult)) = "DVlObject" Then
Set vlResult = vlEval.FunCall(vlResult)
Else
vlResult = vlEval.FunCall(vlResult)
End If

Set vlResult = vlRead.FunCall("(setq y 100)")
If TypeName(vlEval.FunCall(vlResult)) = "DVlObject" Then
Set vlResult = vlEval.FunCall(vlResult)
Else
vlResult = vlEval.FunCall(vlResult)
End If
End Sub


Kailas Dhage

Tony Tanzillo wrote in message <370F23B4...@worldnet.att.net>...

0 new messages