setting variant and object properties when using dll in lisp

Discussion in 'AutoCAD' started by James Maeding, Feb 12, 2005.

  1. This is related to my post a few days ago...

    I am familiar with making a dll and creating an object from it in lisp.
    I have no problems with properties that are just numbers and strings.

    I cannot seem to create a dll that accepts an array or an object from lisp.

    In my VB class, I have these two properties declared:

    Private mobjLDTApp As AeccApplication
    Private mvarPVIs() As Variant

    the set props are:

    Public Property Set LDTApp(ByRef objLDTApp As AeccApplication)
    Set mobjLDTApp = objLDTApp
    MsgBox ("Set Civ Des App")
    End Property

    Property Let NewPVIs(ByRef varNewPVIs As Variant)
    mvarNewPVIs = varNewPVIs
    MsgBox ("Set NewPVIs")
    End Property

    I threw in the msgbox code to tell me if the props were set.

    In lisp, make the object:
    (SETQ LDTMANIP (vlax-create-object "LDTUtil.LDTManip"))

    I am passing the object in with:
    (SETQ AECCAPP (VL-CATCH-ALL-APPLY 'VLA-GETINTERFACEOBJECT (LIST (VLAX-GET-ACAD-OBJECT) "AECC.APPLICATION.4")))
    (vlax-put-property LDTMANIP "LDTApp" AECCAPP)

    I am making the variant array of doubles with this, NEWPVIS is a list of 3 element lists, like '((1000 100 10)(1200 114
    10)(1500 130 10)(1800 120 10)) :
    (SETQ PVIARRAY (vlax-make-safearray vlax-vbdouble '(0 . 2) (cons 0 (- (length NEWPVIS) 1))))
    (SETQ INDEX 0)
    (FOREACH PVI NEWPVIS
    (vlax-safearray-put-element PVIARRAY 0 INDEX (NTH 0 PVI))
    (vlax-safearray-put-element PVIARRAY 1 INDEX (NTH 1 PVI))
    (vlax-safearray-put-element PVIARRAY 2 INDEX (NTH 2 PVI))
    (SETQ INDEX (+ 1 INDEX))
    )
    (SETQ VAR-PVIARRAY (vlax-make-variant PVIARRAY))

    and I pass it to the LDTMANIP object with:
    (vlax-put-property LDTMANIP "NewPVIs" VAR-PVIARRAY)

    I am getting type mismatch errors on both, I am at a loss.
    Did I format the variant correctly?
    For the AECCAPP, do I need to modify it somehow or did I send it wrong?
    Any help is much appreciated.
    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Feb 12, 2005
    #1
  2. James,

    try to use vlax-put instead of vlax-put-property and
    vlax-invoke instead of vlax-invoke-method.

    I think then you don't have to pass safearrays. Should
    work when passing the Lisp lists, but I think you have to
    change

    Private mvarPVIs() As Variant

    to

    Private mvarPVIs As Variant

    Stephan
     
    Stephan Koster, Feb 14, 2005
    #2
  3. ah, excellent suggestions, I'lll try that.

    As for the Private mvarPVIs() As Variant, I did that because I thought you had to for dynamic arrays.
    Sounds like if its a variant, its flexible enough to become an array.
    Thanks for the reply.

    Stephan Koster <Stephan.Koster@[NoSpam-RemoveThis]web.de>
    |>James,
    |>
    |>try to use vlax-put instead of vlax-put-property and
    |>vlax-invoke instead of vlax-invoke-method.
    |>
    |>I think then you don't have to pass safearrays. Should
    |>work when passing the Lisp lists, but I think you have to
    |>change
    |>
    |>Private mvarPVIs() As Variant
    |>
    |>to
    |>
    |>Private mvarPVIs As Variant
    |>
    |>Stephan

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Feb 14, 2005
    #3
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.