<div dir="ltr">Hi Bo, <div><br></div><div>Do this in your code </div><div><br></div><div>polydata->GetPointData()->SetScalars(colors);<br></div><div><br></div><div>What Casey said is right but that would be needed if you want to color faces. In your code, you have to set colors on the points because that's where we look for it. </div>
<div><br></div><div>- Aashish</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 25, 2014 at 1:11 PM, Aashish Chaudhary <span dir="ltr"><<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Let me have a look at it. Will report back to you soon. <span class="HOEnZb"><font color="#888888"><div>
<br></div><div>- Aashish</div><div><br></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 25, 2014 at 10:26 AM, Bo Yu <span dir="ltr"><<a href="mailto:yubo1983@gmail.com" target="_blank">yubo1983@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Thank you, Aashish, I tried to set name of a vtkDataArray, but that didn't make change,I still only see model with no color (or white color). if you have time could you please check my code below?</span><div style="font-family:arial,sans-serif;font-size:13px">


I just create a simple triangle and try to paint it to red use colorByScale.</div><div style="font-family:arial,sans-serif;font-size:13px">However, It seems I can not change the color mode of "rep" in the last three lines. It always have the value as "Solid color"....</div>


<div style="font-family:arial,sans-serif;font-size:13px">Sorry, I just start to learn ves, and thank you so much for your reply and patient. </div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">


Sincerely yours,</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Bo Yu<br><div>/////////////////////</div><div><div>/////testing</div><div>

    // Setup points</div>
<div>    vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();</div><div>    vtkSmartPointer<vtkCellArray> vertices = vtkSmartPointer<vtkCellArray>::New();</div><div>    points->InsertNextPoint(0.0, 0.0, 0.0);</div>


<div>    points->InsertNextPoint(1.0, 0.0, 0.0);</div><div>    points->InsertNextPoint(0.0, 1.0, 0.0);</div><div>    </div><div>    // Setup colors</div><div>    unsigned char red[3] = {1, 0, 0};</div><div>    vtkSmartPointer<vtkUnsignedCharArray> colors = vtkSmartPointer<vtkUnsignedCharArray>::New();</div>


<div>    colors->SetNumberOfComponents(3);</div><div>    colors->SetName("Colors");</div><div>    colors->InsertNextTupleValue(red);</div><div>    </div><div>    vtkDataArray *colorArray = vtkDataArray::SafeDownCast(colors);</div>


<div>    colorArray->SetName("ColorsArray");  ////set color array name</div><div><br></div><div>    vtkSmartPointer<vtkCellArray> triangles =vtkSmartPointer<vtkCellArray>::New();</div><div>    vtkSmartPointer<vtkTriangle> triangle = vtkSmartPointer<vtkTriangle>::New();</div>


<div>    triangle->GetPointIds()->SetId(0, 0);</div><div>    triangle->GetPointIds()->SetId(1, 1);</div><div>    triangle->GetPointIds()->SetId(2, 2);</div><div>    triangles->InsertNextCell(triangle);</div>


<div>    </div><div>    vtkSmartPointer<vtkPolyData> polydata = vtkSmartPointer<vtkPolyData>::New();</div><div>    </div><div>    polydata->SetPoints(points);</div><div>    polydata->SetPolys(triangles);</div>


<div>    polydata->GetCellData()->SetScalars(colors);</div><div>    ////////////</div><div>    </div><div>    vesKiwiPolyDataRepresentation::Ptr rep = std::tr1::dynamic_pointer_cast<vesKiwiPolyDataRepresentation>(self->mKiwiApp->dataRepresentations()[0]);</div>


<div>    rep->setPolyData(polydata);//(currentPolydata->getPolydata(), newColorLookupTable);</div><div>    rep->colorByScalars("ColorsArray");  //colorArray->GetName()//(1.0, 0.0, 0.0, 1.0);</div></div>


<div>////////////////////////////////////////////</div><div><br></div><div><br></div><div>-   -!  I forgot to cc to mail list.</div></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Feb 25, 2014 at 11:37 PM, Aashish Chaudhary <span dir="ltr"><<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Bo, <div><br></div><div>If I remember it correctly, you can name your scalar array "foo" and then pass that array name to the Kiwi (have a look at the documentation for the exact signature)</div>


<div>
<br></div><div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">vtkDataArray* da = ....;</span></div><div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">da->SetArrayName("foo"); </span></div>



<div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></span></div></div><div class="gmail_extra"><div><div><br><br><div class="gmail_quote">On Tue, Feb 25, 2014 at 9:34 AM, Bo Yu <span dir="ltr"><<a href="mailto:yubo1983@gmail.com" target="_blank">yubo1983@gmail.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi, I am so sorry to interrupt again.</div><div>This time I want to paint the polydata with different colors in each region. I found there is a method called </div>



<div><span style="color:rgb(68,85,136);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">void</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap"> </span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">vesKiwiPolyDataRepresentation</span><span style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">::</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">colorByScalars</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">(</span><span style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">const</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap"> </span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">std</span><span style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">::</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">string</span><span style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">&</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap"> </span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">arrayName</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">)</span><br>




</div><div>, which seem similar to the one I used before to set color of a polydata in VTK.</div><div>polydata->GetCellData()->SetScalars(vtkDataArray *da).</div><div><br></div><div>But why the input is a string called arrayName? If you know, Could you tell me how to use this method or give me some simple examples?</div>




<div><br></div><div>Thanks in advance.</div><span><font color="#888888"><div><br></div><div>Bo Yu </div><div><br></div><br></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br>| Aashish Chaudhary <br>| R&D Engineer         <br>| Kitware Inc.            <br>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>    
</font></span></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>| Aashish Chaudhary <br>| R&D Engineer         <br>| Kitware Inc.            <br>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>    
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>| Aashish Chaudhary <br>| R&D Engineer         <br>| Kitware Inc.            <br>| <a href="http://www.kitware.com">www.kitware.com</a>    
</div>