(forwarding this to the list at-large, for archival)<br><br><div class="gmail_quote">I had the same problem, and eventually wound up adding a Cell array entitled &quot;BlockID&#39;.. The resulting code that i&#39;m using looks like this (pardon the macros you don&#39;t have):
<br><br><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEBUGMSG(2, &quot;Constructing a vtkEnSightWriter to save data&quot;);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptr_ens = vtkEnSightWriter::New();
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ezViz_RegisterNewVtkObject(scene, ptr_ens);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // We need this magical &quot;BlockID&quot; scalar celldata field</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (data-&gt;GetCellData()) {
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (data-&gt;GetCellData()-&gt;GetArray(&quot;BlockId&quot;)) {</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FoundCellData = true;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span>
<br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (FoundCellData == false) {</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEBUGMSG(2, &quot;Creating \&quot;BlockId\&quot; Cell Array...&quot;);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Looks like we have to create it.. crap</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkIntArray *bids = vtkIntArray::New();</span>

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bids-&gt;SetName(&quot;BlockId&quot;);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(i=0; i&lt;data-&gt;GetNumberOfCells(); i++)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bids-&gt;InsertNextValue(1);</span>

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data-&gt;GetCellData()-&gt;SetScalars(bids);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (data-&gt;IsA(&quot;vtkUnstructuredGrid&quot;)) {
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEBUGMSG(2, &quot;Converting data to Unstructured Grid...&quot;);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkDataSetTriangleFilter *tri = vtkDataSetTriangleFilter::New();
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ezViz_RegisterNewVtkObject(scene, tri);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tri-&gt;SetInput(data);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tri-&gt;Update();</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data = tri-&gt;GetOutput();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int blockids[2];</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blockids[0] = 1;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blockids[1] = 0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptr_ens-&gt;SetNumberOfBlocks(1);
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptr_ens-&gt;SetBlockIDs(blockids);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptr_ens-&gt;SetTimeStep(0);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptr_ens-&gt;SetInput(vtkUnstructuredGrid::SafeDownCast(data));</span>

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptr_ens-&gt;SetFileName(scene-&gt;output_filename);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEBUGMSG1(1, &quot;Saving to \&quot;%s\&quot;&quot;, scene-&gt;output_filename);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptr_ens-&gt;Write();
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptr_ens-&gt;WriteCaseFile(1);</span><div><div></div><div class="Wj3C7c"><br style="font-family: courier new,monospace;">
<br><br><div class="gmail_quote">
On Nov 29, 2007 6:17 AM, Eduardo Camargo &lt;<a href="mailto:camargo@lncc.br" target="_blank">camargo@lncc.br</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br>Did anyone of you write EnSight files and did not have problems with
 BlockID?<br><br>Regards, Eduardo<br><br><br><br>Martin
Baumann schrieb:<br><br>&gt; Hi,<br>&gt; I am trying to save EnSight
data files with the following code:<br>&gt;  string in_file  =
&quot;test.asc&quot;;<br>&gt;  string out_file =
&quot;ensight.ens&quot;;<br>&gt;  ///
**********************************************/<br>&gt;  /// read
Legacy-Format variables/<br>&gt;  ///
**********************************************/<br>&gt; 
vtkUnstructuredGridReader* _reader = vtkUnstructuredGridReader::New();
_reader-&gt;SetFileName(in_file.c_str());<br>&gt; 
_reader-&gt;Update();<br>&gt;  ///
**********************************************/<br>&gt;  /// write
EnSight/<br>&gt;  /// **********************************************/<br>&gt;  vtkEnSightWriter* _ens_writer = vtkEnSightWriter::New();<br>&gt;
 _ens_writer-&gt;SetFileName(out_file.c_str());<br>&gt; 
_ens_writer-&gt;SetInput(_reader-&gt;GetOutput());<br>&gt; 
_ens_writer-&gt;Write();<br>&gt;  _ens_writer-&gt;WriteCaseFile(1);<br>&gt;  <br>&gt; When I run this I get the error<br>&gt;   No BlockID
was found<br>&gt; for some some hundred times.<br>&gt; Still threee
files are created:<br>&gt;   ensight.0.case<br>&gt;  
ensight.0.00000.geo<br>&gt;   ensight.0.00000_n.u_x<br>&gt; - I tried
to find out what the error means. What are BlockIDs used for? - Is there
any information on writing EnSight files with vtk?<br>&gt; - In the
example file (test.asc) there are contained three scalars:  u_x, u_y and
u_z.<br>&gt; Only one (u_x) is written to an EnSight data file. I need
to export  all of the<br>&gt; scalars and vectors if there are any in
the input file. How can I do<br>this?<br>&gt; Regards, M.B.<br>&gt;------------------------------------------------------------------------
_______________________________________________<br>&gt;This is the
private VTK discussion list. <br>&gt;Please keep messages on-topic.
Check the FAQ at:<br><a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><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><font color="#888888"><br><br><br>-- <br>Atenciosamente,
<br><br>Eduardo Camargo<br>Analista de
Sistemas<br>HeMoLab - <a href="http://www.lncc.br/prjhemo" target="_blank">http://www.lncc.br/prjhemo</a><br>Laboratório
Nacional de Computação Científica - LNCC<br></font><br>_______________________________________________<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">

http://www.vtk.org/Wiki/VTK_FAQ</a><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><br></blockquote>

</div><br><br clear="all"><br>-- <br></div></div>----------------------------------------<br><font color="#888888">Randall Hand <br>Visualization Scientist<br>ERDC MSRC-ITL
</font></div><br><br clear="all"><br>-- <br>----------------------------------------<br>Randall Hand <br>Visualization Scientist<br>ERDC MSRC-ITL