Hello everyone. Is there some reason whereby vtkAppendPolyData delete the scalars when I append 2 polydatas?<br><br>Here is my code.<div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<span class="Apple-tab-span" style="white-space:pre">        </span>myPolyData-&gt;ShallowCopy(otherPolyData);<br>        SubdividePolyData(myPolyData);   /// Here I modified the polydata, so I need to assign it again the scalar array.<br>

</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

        <font color="#ff0000">// The problem I think is here in this lines, where I assign the scalar array<br></font><span class="Apple-tab-span" style="white-space:pre">        </span>vtkIntArray* scalars = vtkIntArray::New();<br>

<span class="Apple-tab-span" style="white-space:pre">        </span>scalars-&gt;SetNumberOfComponents(1);<br><span class="Apple-tab-span" style="white-space:pre">        </span>scalars-&gt;SetNumberOfValues(myPolyData-&gt;GetNumberOfCells());<br>

<span class="Apple-tab-span" style="white-space:pre">        </span>scalars-&gt;SetNumberOfTuples(myPolyData-&gt;GetNumberOfCells());<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

 </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="Apple-tab-span" style="white-space:pre">        </span>for (int i = 0; i &lt; myPolyData-&gt;GetNumberOfCells(); i++)<br>

<span class="Apple-tab-span" style="white-space:pre">                </span>scalars-&gt;SetValue(i, 1);<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

 </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="Apple-tab-span" style="white-space:pre">        </span>myPolyData-&gt;GetCellData()-&gt;SetScalars(scalars);<br>

</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

        vtkSmartPointer&lt;vtkAppendPolyData&gt; appendGreenSubdAndRedBlue = vtkSmartPointer&lt;vtkAppendPolyData&gt;::New();<br><span class="Apple-tab-span" style="white-space:pre">        </span>appendGreenSubdAndRedBlue-&gt;AddInput(otherPolyData);  <font color="#ff0000"> // what is extrange is that if I comment this line, it works fine</font><br>

<span class="Apple-tab-span" style="white-space:pre">        </span>appendGreenSubdAndRedBlue-&gt;AddInput(myPolyData);<br><span class="Apple-tab-span" style="white-space:pre">        </span>appendGreenSubdAndRedBlue-&gt;Update();<br>
</blockquote>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<span class="Apple-tab-span" style="white-space:pre">        </span>vtkPolyData * finalPolyData = appendGreenSubdAndRedBlue-&gt;GetOutput();<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

 </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">        vtkIntArray* scalarArray = static_cast&lt;vtkIntArray*&gt;(finalPolyData-&gt;GetCellData()-&gt;GetScalars());<br>

        std::cout  &lt;&lt; scalarArray-&gt;GetNumberOfTuples() &lt;&lt; std::endl; <font color="#ff0000">//This line gives me an error</font></blockquote><div><font color="#ff0000"><br></font></div><div><font color="#ff0000"><br>

</font></div><div><font color="#ff0000">The error that I obtain is the following :</font></div><div><font color="#ff0000"><br></font></div><div><font color="#ff0000"><div><u>File </u>:     vtkAbstractArray.h -  line 104</div>

<div><br></div><div>  vtkIdType GetNumberOfTuples() </div><div>    {return (this-&gt;MaxId + 1)/this-&gt;NumberOfComponents;}</div><div>    </div><div><u>error:</u></div><div><br></div><div>name               type                          value</div>

<div>this        vtkAbstractArray * const           0x0</div></font></div><div><br></div><div><br></div><div>I can assign &quot;manually&quot; again the scalars to the finalPolyData, but it is suppose that the scalars remains when I append them.</div>

<div><br></div><div>Thank you!</div><div><br></div>-- <br>--------<br>Gonzalo <br>
</div>