<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->GetOutput()->GetPointData()->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->SetName("Temporal gradient");</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vEnsightReader->GetOutput()->GetPointData()->AddArray(vGeneratedArray);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">if(vEnsightReader->GetOutput()->GetPointData()->SetActiveAttribute(arrayCount, 0) != arrayCount)</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;"> 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->RemoveActor( vContourActor );</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourActor->Delete();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper->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->SetInput(vGeomFilter->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->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->SetHueRange(0.6667,0.0);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">lut->SetTableRange(range);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">lut->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->SetColorModeToMapScalars();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper->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->ColorByArrayComponent(vEnsightReader->GetPointArrayName(arrayCount),0);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper->SetLookupTable(lut);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper->SetScalarRange(range);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper->InterpolateScalarsBeforeMappingOff();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper->ImmediateModeRenderingOn();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vContourMapper->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->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->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->SetLookupTable(lut);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vScalarBar->SetTitle("Temporal gradient");</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vScalarBar->GetLabelTextProperty()->SetFontFamilyToArial();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">vScalarBar->GetLabelTextProperty()->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->AddActor(vScalarBar);</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;"> </span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">render->ResetCameraClippingRange();</span><br style="font-family: Courier New,Courier,Monospace;"><span style="font-family: Courier New,Courier,Monospace;">renWin->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>