API - RGB-colors go wild?

Jan 15, 2004 1 Replies

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


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-

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required