<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hey...<br>
<br>
if you want to do some changes in the pipeline during runtime you
have to do this within the pipeline via callbacks in the same
thread where the pipeline runs.<br>
Within the callback you have to call Modified to the object you
have changed and you should call Render() to the
RenderWindowInteractor.<br>
<br>
Regards,<br>
Benjamin Jähn<br>
<br>
Am 28.02.2013 22:01, schrieb Michel Delanaye - Geonx:<br>
</div>
<blockquote cite="mid:034101ce15f6$c4638e40$4d2aaac0$@geonx.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<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]-->
<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> </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> </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> </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> </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> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </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> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> </span><span
style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white"
lang="EN-US">vtkUnsignedCharArray</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> colors = </span><span
style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white"
lang="EN-US">vtkUnsignedCharArray</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">.New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">
colors.Allocate(Model.VtkUNS.GetNumberOfCells(),1000);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> colors.SetNumberOfComponents(3);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> colors.SetName(</span><span
style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white"
lang="EN-US">"Colors"</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">
Model.VtkUNS.GetCellData().SetScalars(colors);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> </span><span
style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white"
lang="EN-US">for</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> (</span><span
style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white"
lang="EN-US">int</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> j = 0; j < Model.VtkUNS.GetNumberOfCells();
j++)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">
colors.InsertNextTupleValue(p_default_color);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> </span><span
style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white"
lang="EN-US">Marshal</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">.FreeHGlobal(p_default_color);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> </span><span
style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white"
lang="EN-US">vtkDataSetMapper</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> mapper = </span><span
style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white"
lang="EN-US">vtkDataSetMapper</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">.New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">
_visualization_triangulation.SetMapper(mapper);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> mapper.ImmediateModeRenderingOn();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> mapper.SetInput(Model.VtkUNS);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> mapper.ImmediateModeRenderingOn();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> mapper.ScalarVisibilityOn();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">… do rendering etc<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </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> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> </span><span
style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white"
lang="EN-US">vtkUnsignedCharArray</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> colors = (</span><span
style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white"
lang="EN-US">vtkUnsignedCharArray</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">) Model.VtkUNS.GetCellData().GetArray(</span><span
style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white"
lang="EN-US">"Colors"</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">, </span><span
style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white"
lang="EN-US">ref</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> index);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> </span><span
style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white"
lang="EN-US">foreach</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> (</span><span
style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white"
lang="EN-US">long</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> i </span><span
style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white"
lang="EN-US">in</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> f.VtkTriangleIdList)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> colors.SetTupleValue((</span><span
style="font-size:9.5pt;font-family:Consolas;color:blue;background:white;mso-highlight:white"
lang="EN-US">long</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">)i, p_picking_color);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> </span><span
style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white"
lang="EN-US">vtkDataSetMapper</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> mapper = </span><span
style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:white;mso-highlight:white"
lang="EN-US">vtkDataSetMapper</span><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">.New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US">
_visualization_triangulation.SetMapper(mapper);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> mapper.SetInput(Model.VtkUNS);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> mapper.ImmediateModeRenderingOn();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"
lang="EN-US"> mapper.ScalarVisibilityOn();<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:9.5pt;font-family:Consolas;color:green"
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:9.5pt;font-family:Consolas;color:green"
lang="EN-US">…</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<br>
</body>
</html>