VBA Var to LISP Var

Discussion in 'AutoCAD' started by jbryant4, Jul 19, 2004.

  1. jbryant4

    jbryant4 Guest

    Maybe a stupid question........Is there a way to take a VB variable and copy it to a Lisp Var. Say you have a variable in VB called HEIGHT with a value of 2.00....Is there a function to hand this over to LISP,so that you now have a LISP varible HEIGHT which has a value of 2.00.....Second stupid question.....Say you have a VB Array with 5 members....Is there an easy way to make this ARRAY available to LISP in the form of a list?....
     
    jbryant4, Jul 19, 2004
    #1
  2. jbryant4

    Bart1123 Guest

    Look at the USERR1-5 DXF system variables for Real Numbers or USERI1-5 DXF system variables for integers.

    I use this to pass a scalefactor variable from VBA to LISP.

    HTH

    Bart

    ***Code Snippit Begin*****

    ***VBA
    Public Sub ScaleFactor()
    Dim sx As Double

    'prompts user for input of scalefactor
    g_dblSX = CDbl(InputBox("Enter ScaleFactor for inserting Symbols!"))
    sx = g_dblSX

    'sets the AutoCAD system variable to the user input scalefactor to be passed to LISP
    ThisDrawing.SetVariable "USERR1", g_dblSX

    'excecutes the scalefactor LISP routine so LISP will have the current scalefactor
    'for symbol insertions in LISP

    ThisDrawing.SendCommand "scalefactor" & vbCr
    End Sub



    ***LISP
    (defun c:scalefactor ()
    (setq sx(getvar "USERR1"))
    )

    (c:scalefactor)


    ***END Code Snippit
     
    Bart1123, Jul 19, 2004
    #2
  3. ThisDrawing.SendCommand "(setq Height " & Format(vbaheight, "0.0") & ")" & vbCrLf

    It should work similarly for a list


    you have a variable in VB called HEIGHT with a value of 2.00....Is there a function to hand this
    over to LISP,so that you now have a LISP varible HEIGHT which has a value of 2.00.....Second stupid
    question.....Say you have a VB Array with 5 members....Is there an easy way to make this ARRAY
    available to LISP in the form of a list?....
     
    Allen Johnson, Jul 19, 2004
    #3
  4. jbryant4

    perry Guest

    That technique works, and I use it but you might also check out Franks Vlisp
    class object which has been discussed here recently.
     
    perry, Jul 19, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.