Shorten method VLA?

Discussion in 'AutoCAD' started by BillZ, Nov 2, 2004.

  1. BillZ

    BillZ Guest

    R2005:

    Is there a better way to get the real returned from the display color properties in stead of:

    (setq cur_col
    (vlax-variant-value
    (vlax-make-variant
    (vlax-get-property
    (vla-get-display
    (vla-get-preferences
    (vlax-get-acad-object))) Dtype)
    vlax-vbLong)
    )
    )

    This works but I have a feeling my inexperience is keeping me from a shorter method.

    TIA

    Bill
     
    BillZ, Nov 2, 2004
    #1
  2. BillZ

    Doug Broad Guest

    vlax-variant-value and vlax-make-variant are inverse
    functions of one another. You can eliminate them both.

    (vlax-get-property (vla-get-display.....acad-object)))..)
     
    Doug Broad, Nov 2, 2004
    #2
  3. BillZ

    Jürg Menzi Guest

    Hi Bill
    Not really...
    Because 'vla-get-GraphicsWinModelBackgrndColor' etc. returns an OLE_COLOR type.
    Vlisp doesn't handle this type so you've to change it to a long:
    [code
    (vlax-variant-value
    (vlax-variant-change-type
    (vla-get-GraphicsWinModelBackgrndColor
    (vla-get-display
    (vla-get-preferences (vlax-get-acad-object))
    )
    )
    vlax-vbLong
    )
    )
    [/code]

    Cheers
     
    Jürg Menzi, Nov 2, 2004
    #3
  4. BillZ

    BillZ Guest

    Thanks Doug,
    But it bombs like that.

    Code:
    Command: (vlax-get-property (vla-get-display (vla-get-preferences
    (vlax-get-acad-object)))"GraphicsWinModelBackgrndColor")
    #<variant 19 0>
    Bill
     
    BillZ, Nov 2, 2004
    #4
  5. BillZ

    BillZ Guest

    Okay thanks.

    I couldn't remember why I did it that way but now it comes back.

    Bill
     
    BillZ, Nov 2, 2004
    #5
  6. BillZ

    BillZ Guest

    P.S.

    vlax-variant-change-type

    worked fine in my code, thanks for the tip.


    Bill
     
    BillZ, Nov 2, 2004
    #6
  7. BillZ

    Jürg Menzi Guest

    Hi Bill

    Glad to help you...¦-)

    Cheers
     
    Jürg Menzi, Nov 2, 2004
    #7
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.