<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR-BE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Dear vtk users,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US>I am using a vtkUnsignedCharArray to define the color of triangles belonging to a VtkUnstructuredGrid (code snippet 1). Everything works well for rendering and the mesh is correctly displayed. However, if I change the color of some of the triangles after rendering, which can be done by modifying the Tuple for the specific triangles in the colors array, the view does not get updated and colors are not changed. I have tried many functions of the mapper, but nothing seems to work except allocating a new mapper and linking it to the VtkUnstructuredGrid object (see code snippet 2) . I think this is a strange behavior.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US>If anyone faced a similar behavior, I would be interested to get in touch.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US>-Michel Delanaye<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>geonX SA <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US>//Code snippet 1<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white'>vtkUnsignedCharArray</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'> colors = </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white'>vtkUnsignedCharArray</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>.New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; colors.Allocate(Model.VtkUNS.GetNumberOfCells(),1000);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; colors.SetNumberOfComponents(3);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; colors.SetName(</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white'>&quot;Colors&quot;</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Model.VtkUNS.GetCellData().SetScalars(colors);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white'>for</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'> (</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white'>int</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'> j = 0; j &lt; Model.VtkUNS.GetNumberOfCells(); j++)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; colors.InsertNextTupleValue(p_default_color);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white'>Marshal</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>.FreeHGlobal(p_default_color);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white'>vtkDataSetMapper</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'> mapper = </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white'>vtkDataSetMapper</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>.New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _visualization_triangulation.SetMapper(mapper);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mapper.ImmediateModeRenderingOn();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mapper.SetInput(Model.VtkUNS);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mapper.ImmediateModeRenderingOn();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mapper.ScalarVisibilityOn();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US>&#8230; do rendering etc<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US>// Code snippet 2<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white'>vtkUnsignedCharArray</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'> colors = (</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white'>vtkUnsignedCharArray</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>) Model.VtkUNS.GetCellData().GetArray(</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white'>&quot;Colors&quot;</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>, </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white'>ref</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'> index);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white'>foreach</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'> (</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white'>long</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'> i </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white'>in</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'> f.VtkTriangleIdList)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;colors.SetTupleValue((</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white'>long</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>)i, p_picking_color);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white'>vtkDataSetMapper</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'> mapper = </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white'>vtkDataSetMapper</span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>.New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _visualization_triangulation.SetMapper(mapper);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mapper.SetInput(Model.VtkUNS);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mapper.ImmediateModeRenderingOn();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mapper.ScalarVisibilityOn();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:green'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:green'>&#8230;</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>