<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
Hi there,<br><br>I'm having some trouble with mapping a vtkDoubleArray onto an existing geometry. The original data set consists of an Ensight model with various data sets. This is my code:<br><br><span style="font-family: Courier New,Courier,Monospace;">// get original array count</span><br><span style="font-family: Courier New,Courier,Monospace;"></span><span style="font-family: Courier New,Courier,Monospace;"></span><span style="font-family: Courier New,Courier,Monospace;">int arrayCount = vEnsightReader-&gt;GetOutput()-&gt;GetPointData()-&gt;GetNumberOfArrays();</span><br style="font-family: Courier New,Courier,Monospace;"><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">// add generated array to stack</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vGeneratedArray-&gt;SetName("Temporal gradient");</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vEnsightReader-&gt;GetOutput()-&gt;GetPointData()-&gt;AddArray(vGeneratedArray);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">if(vEnsightReader-&gt;GetOutput()-&gt;GetPointData()-&gt;SetActiveAttribute(arrayCount, 0) != arrayCount)</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">&nbsp;&nbsp;&nbsp; AfxMessageBox("Array not set!");</span><br style="font-family: Courier New,Courier,Monospace;"><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">// remove current actor from scene, so it can be updated<br>render-&gt;RemoveActor( vContourActor );</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourActor-&gt;Delete();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper-&gt;Delete();</span><br style="font-family: Courier New,Courier,Monospace;"><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper = vtkPolyDataMapper::New();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper-&gt;SetInput(vGeomFilter-&gt;GetOutput());</span><br style="font-family: Courier New,Courier,Monospace;"><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vGeneratedArray-&gt;GetRange(range);</span><br style="font-family: Courier New,Courier,Monospace;"><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">lut-&gt;SetHueRange(0.6667,0.0);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">lut-&gt;SetTableRange(range);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">lut-&gt;Build();</span><br style="font-family: Courier New,Courier,Monospace;"><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper-&gt;SetColorModeToMapScalars();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper-&gt;SetScalarModeToUsePointFieldData();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;"></span><span style="font-family: Courier New,Courier,Monospace;">vContourMapper-&gt;ColorByArrayComponent(vEnsightReader-&gt;GetPointArrayName(arrayCount),0);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper-&gt;SetLookupTable(lut);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper-&gt;SetScalarRange(range);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper-&gt;InterpolateScalarsBeforeMappingOff();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper-&gt;ImmediateModeRenderingOn();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper-&gt;Update();</span><br style="font-family: Courier New,Courier,Monospace;"><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourActor = vtkActor::New();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourActor-&gt;SetMapper( vContourMapper );</span><br style="font-family: Courier New,Courier,Monospace;"><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">render-&gt;AddActor( vContourActor );</span><br style="font-family: Courier New,Courier,Monospace;"><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vScalarBar = vtkScalarBarActor::New();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vScalarBar-&gt;SetLookupTable(lut);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vScalarBar-&gt;SetTitle("Temporal gradient");</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vScalarBar-&gt;GetLabelTextProperty()-&gt;SetFontFamilyToArial();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vScalarBar-&gt;GetLabelTextProperty()-&gt;SetFontSize(6);</span><br style="font-family: Courier New,Courier,Monospace;"><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">render-&gt;AddActor(vScalarBar);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">&nbsp;&nbsp;&nbsp; </span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">render-&gt;ResetCameraClippingRange();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">renWin-&gt;Render();</span><br style="font-family: Courier New,Courier,Monospace;"><br>All objects exist and are tested. The generated array has a valid range and array values as well.<br><br><span style="font-family: Geneva,Arial,Sans-serif;">The problem is that the output does not give any color in the output, though with previously existing data sets this is not a problem. If I comment SetScalarModeToUsePointFieldData() then it seems to work, but with the wrong data set.<br><br>Obviously I'm doing something wrong, so what do I need to change to solve this? Thanks in advance!<br></span><br /><hr />With Windows Live for mobile, your contacts travel with you. <a href='http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_Refresh_mobile_052008' target='_new'>Connect on the go.</a></body>
</html>