Hi Some-1,
I got around that! Try the following to assign/change the values for diffuseColor field
material.Fields("diffuseColor").red = 0
material.Fields("diffuseColor").green = 1
material.Fields("diffuseColor").blue = 0.5
Yahaya
Hi Yahaya - I have been trying to do the same. I wonder if you got your code working. I'd love to exchange any useful information together.
Thanks - some-1
Hi there,
I am just a beginner and am trying to change the color of a shape by clicking on it on the scene. I have the following vb.net code in the AxCortona2_ClickEvent:
Dim localmouseposition As Point
Dim Engine As VRMLAutomation.VRMLEngin
Dim chain As VRMLAutomation.MFNode
Dim shape As VRMLAutomation.VRMLNode
Dim appearance As VRMLAutomation.VRMLNode
Dim material As VRMLAutomation.VRMLNode
Dim materialcolour, tempcolor As VRMLAutomation.VRMLField
Engine = AxCortona2.Engine
localmouseposition = AxCortona2.PointToClient(Windows.Forms.Cursor.Position)
chain = Engine.Pick(localmouseposition.X, localmouseposition.Y)
If chain.Count = 0 Then
Exit Sub
End If
shape = chain(chain.Count - 1)
appearance = shape.Fields("appearance").Value
material = appearance.Fields("material").value
materialcolour = material.Fields("diffuseColor").value
tempcolor = Engine.CreateField("SFColor")
tempcolor.Red = 0
tempcolor.Blue = 0
tempcolor.Green = 1
materialcolour.value = tempcolor.value
Nothing happens when I run the code. The program seems to exit the sub once it encounters the 'materialcour ='expression. Could someone pls helpout?
Cheers.
Yahaya