API - RGB-colors go wild?

Discussion in 'SolidWorks' started by KimSky, Jan 15, 2004.

  1. KimSky

    KimSky Guest

    Hi,

    Take a look at the short code snippet below... Why is it that the
    'GetMaterialPropertyValues' -function won't return the same values as the
    ones I've just put in with the 'SetMaterialPropertyValues '-function? For
    example: My input looks like this [0.1, 0.5, 1, 0, 0, 0, 0, 0, 0] the
    output look like this: [0, 0.1, 0, 0.5, 0, 1 0, 0, 0]

    vSelRAL(0) = CDbl(0.1)
    'Red
    vSelRAL(1) = CDbl(0.5)
    'Green
    vSelRAL(2) = CDbl(1)
    'Blue
    vSelRAL(3) = CDbl(0)
    'Ambient
    vSelRAL(4) = CDbl(0)
    'Diffuse
    vSelRAL(5) = CDbl(0)
    'Specular
    vSelRAL(6) = CDbl(0)
    'Shininess
    vSelRAL(7) = CDbl(0)
    'Transparency
    vSelRAL(8) = CDbl(0)
    'Emission

    Set ModelExt = Model.Extension

    ModelExt.SetMaterialPropertyValues vSelRAL,
    swThisConfiguration, vConfigs

    tempvar =
    ModelExt.GetMaterialPropertyValues(swThisConfiguration, vConfigs)

    If Not IsEmpty(tempvar) Then
    For k = 0 To UBound(tempvar)
    MsgBox tempvar(k)
    Next k
    End If

    Anyone?

    TIA, KimSky
     
    KimSky, Jan 15, 2004
    #1
  2. KimSky

    Heikki Leivo Guest

    Hello Kim,

    How have you declared vSelRAL? I recommend to try following:

    - declare an array of doubles, eg. Dim dblSelRAL(0 to 8) as Double
    - Assign material property values to the double array
    - Declare a variant, eg Dim vSelRAL as Variant
    - Assign the double array to the variant, eg. vSelRAL = dblSelRal

    Then pass the variant to the method.

    I don't know if this is the reason for the error but it's worth of trying!

    -h-
     
    Heikki Leivo, Jan 15, 2004
    #2
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.