Yes, what I wanted to mean with &quot;is Strange&quot; is that letting the input without appending works fine, so it means that it has its scalars.<br>In other words, I printed the scalars of &quot;otherPolyData&quot; and &quot;myPolyData&quot; before appending, and I obtain desired results. So it means that they have scalars.<div>

<br></div><div>So I don&#39;t know what is happening here. Maybe I have to add something more to satisfy conditions for using the filter, but I don&#39;t know. </div><div>Some help?<br><br>Thank you!</div><div><br></div>
<div>
<br><br><div class="gmail_quote">2012/8/3 Alex Malyushytskyy <span dir="ltr">&lt;<a href="mailto:alexmalvtk@gmail.com" target="_blank">alexmalvtk@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">&gt;&gt; appendGreenSubdAndRedBlue-&gt;AddInput(otherPolyData);   // what is extrange is that if I comment this line, it works fine<br>
&gt;&gt; appendGreenSubdAndRedBlue-&gt;AddInput(myPolyData);<br>
<br>
</div>there is nothing strange, if you comment this line there is no<br>
modification were made,<br>
so output is the same as input.<br>
<br>
why it removes scalar?<br>
otherPolyData probably does not the same scalar. From documentation:<br>
<br>
&quot;All geometry is extracted and appended, but point and cell attributes<br>
(i.e., scalars, vectors, normals) are extracted and appended only if<br>
all datasets have the point and/or cell attributes available. (For<br>
example, if one dataset has point scalars but another does not, point<br>
scalars will not be appended.)&quot;<br>
<br>
Regards,<br>
  Alex<br>
<div><div class="h5"><br>
<br>
On Thu, Aug 2, 2012 at 4:25 AM, Gonzalo Amadio &lt;<a href="mailto:gonzaloamadio@gmail.com">gonzaloamadio@gmail.com</a>&gt; wrote:<br>
&gt; Hello everyone. Is there some reason whereby vtkAppendPolyData delete the<br>
&gt; scalars when I append 2 polydatas?<br>
&gt;<br>
&gt; Here is my code.<br>
&gt;<br>
&gt;&gt; myPolyData-&gt;ShallowCopy(otherPolyData);<br>
&gt;&gt;         SubdividePolyData(myPolyData);   /// Here I modified the polydata,<br>
&gt;&gt; so I need to assign it again the scalar array.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;         // The problem I think is here in this lines, where I assign the<br>
&gt;&gt; scalar array<br>
&gt;&gt; vtkIntArray* scalars = vtkIntArray::New();<br>
&gt;&gt; scalars-&gt;SetNumberOfComponents(1);<br>
&gt;&gt; scalars-&gt;SetNumberOfValues(myPolyData-&gt;GetNumberOfCells());<br>
&gt;&gt; scalars-&gt;SetNumberOfTuples(myPolyData-&gt;GetNumberOfCells());<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; for (int i = 0; i &lt; myPolyData-&gt;GetNumberOfCells(); i++)<br>
&gt;&gt; scalars-&gt;SetValue(i, 1);<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; myPolyData-&gt;GetCellData()-&gt;SetScalars(scalars);<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;         vtkSmartPointer&lt;vtkAppendPolyData&gt; appendGreenSubdAndRedBlue =<br>
&gt;&gt; vtkSmartPointer&lt;vtkAppendPolyData&gt;::New();<br>
&gt;&gt; appendGreenSubdAndRedBlue-&gt;AddInput(otherPolyData);   // what is extrange<br>
&gt;&gt; is that if I comment this line, it works fine<br>
&gt;&gt; appendGreenSubdAndRedBlue-&gt;AddInput(myPolyData);<br>
&gt;&gt; appendGreenSubdAndRedBlue-&gt;Update();<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; vtkPolyData * finalPolyData = appendGreenSubdAndRedBlue-&gt;GetOutput();<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;         vtkIntArray* scalarArray =<br>
&gt;&gt; static_cast&lt;vtkIntArray*&gt;(finalPolyData-&gt;GetCellData()-&gt;GetScalars());<br>
&gt;&gt;         std::cout  &lt;&lt; scalarArray-&gt;GetNumberOfTuples() &lt;&lt; std::endl;<br>
&gt;&gt; //This line gives me an error<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; The error that I obtain is the following :<br>
&gt;<br>
&gt; File :     vtkAbstractArray.h -  line 104<br>
&gt;<br>
&gt;   vtkIdType GetNumberOfTuples()<br>
&gt;     {return (this-&gt;MaxId + 1)/this-&gt;NumberOfComponents;}<br>
&gt;<br>
&gt; error:<br>
&gt;<br>
&gt; name               type                          value<br>
&gt; this        vtkAbstractArray * const           0x0<br>
&gt;<br>
&gt;<br>
&gt; I can assign &quot;manually&quot; again the scalars to the finalPolyData, but it is<br>
&gt; suppose that the scalars remains when I append them.<br>
&gt;<br>
&gt; Thank you!<br>
&gt;<br>
&gt; --<br>
&gt; --------<br>
&gt; Gonzalo<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>--------<br>Gonzalo Amadio<br><br>
</div>