<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#003333">
    <font size="-1"><font face="Tahoma">Yes of course !<br>
        <br>
        That's why I'm writing "</font></font><small>For most of case it
      works well", vtkStripper helps me a lot.<br>
      <br>
      But with this example, my convertion fails.<br>
      <br>
      With debug, I found that the secondth (and last) line close the
      arc of circle but when I display it, this doesn't appear, as it's
      shown in the pictures I linked.<br>
      <br>
    </small>Le 06/01/2011 14:47, David Gobbi a &eacute;crit&nbsp;:
    <blockquote
      cite="mid:AANLkTi=CxoKNKbzTM_8atUC_zHUKfGHGt9j-+z7nfbRm@mail.gmail.com"
      type="cite">
      <pre wrap="">Hi Nicolas,

In my last email to you, I recommended the vtkStripper filter for
generating a polyline from line segments.  Did you try it?

Cheers,

   David


On Thu, Jan 6, 2011 at 3:30 AM, Nicolas Sarrasin
<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:nsarrasin@phenix-systems.com">&lt;nsarrasin@phenix-systems.com&gt;</a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">Hi all,
I'm trying to convert a set of line into one only vtkPolyLine. (original
post here :
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://vtk.1045678.n5.nabble.com/construct-a-vtkPolyLine-PolyGon-from-a-set-of-vtkLines-td3325716.html">http://vtk.1045678.n5.nabble.com/construct-a-vtkPolyLine-PolyGon-from-a-set-of-vtkLines-td3325716.html</a>)

I go through all the polylines of vtkPolyData-&gt;GetLines() and then get the
associated points.
For most of case it works well, but I'm actually encounter a problem on a
case.

The input polydata
(<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://img525.imageshack.us/img525/8370/vtkconvertioninit.png">http://img525.imageshack.us/img525/8370/vtkconvertioninit.png</a>) is composed
of two lines which trace an arc of circle.
After the convertion, this arc is closed
(<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://img502.imageshack.us/img502/8773/vtkconvertionres.png">http://img502.imageshack.us/img502/8773/vtkconvertionres.png</a>).
It comes from the second line which might not be correct.

Can someone explain me what is going wrong ?

Thanks by advance.

Here is a c++ sample code with the input file attached (wire.vtp).
****
#include &lt;vtkSmartPointer.h&gt;
#include &lt;vtkCellArray.h&gt;
#include &lt;vtkPoints.h&gt;
#include &lt;vtkPolyData.h&gt;
#include &lt;vtkXMLPolyDataReader.h&gt;
#include &lt;vtkXMLPolyDataWriter.h&gt;
#include &lt;vtkPolyLine.h&gt;#include &lt;vtkSmartPointer.h&gt;
#include &lt;vtkCellArray.h&gt;
#include &lt;vtkPoints.h&gt;
#include &lt;vtkPolyData.h&gt;
#include &lt;vtkXMLPolyDataReader.h&gt;
#include &lt;vtkXMLPolyDataWriter.h&gt;
#include &lt;vtkPolyLine.h&gt;

int main (int argc, char *argv[])
{
&nbsp;&nbsp; &nbsp;vtkSmartPointer&lt;vtkXMLPolyDataReader&gt; reader =
vtkSmartPointer&lt;vtkXMLPolyDataReader&gt;::New();
&nbsp;&nbsp; &nbsp;reader-&gt;SetFileName("./wire.vtp");

&nbsp;&nbsp; &nbsp;vtkSmartPointer&lt;vtkPolyData&gt; init_data =
vtkSmartPointer&lt;vtkPolyData&gt;::New();
&nbsp;&nbsp; &nbsp;init_data = reader-&gt;GetOutput();

&nbsp;&nbsp; &nbsp;vtkSmartPointer&lt;vtkPoints&gt; init_points =
vtkSmartPointer&lt;vtkPoints&gt;::New();
&nbsp;&nbsp; &nbsp;init_points=init_data-&gt;GetPoints();

&nbsp;&nbsp; &nbsp;vtkSmartPointer&lt;vtkCellArray&gt; init_lineArray =
vtkSmartPointer&lt;vtkCellArray&gt;::New();
&nbsp;&nbsp; &nbsp;init_lineArray = init_data-&gt;GetLines();

&nbsp;&nbsp; &nbsp;int nblines = init_lineArray-&gt;GetNumberOfCells();

&nbsp;&nbsp; &nbsp;vtkSmartPointer&lt;vtkPolyData&gt; new_data =
vtkSmartPointer&lt;vtkPolyData&gt;::New();
&nbsp;&nbsp; &nbsp;vtkSmartPointer&lt;vtkPoints&gt; new_points =
vtkSmartPointer&lt;vtkPoints&gt;::New();
&nbsp;&nbsp; &nbsp;vtkSmartPointer&lt;vtkPolyLine&gt; polyline =
vtkSmartPointer&lt;vtkPolyLine&gt;::New();
&nbsp;&nbsp; &nbsp;vtkSmartPointer&lt;vtkCellArray&gt; new_lineArray =
vtkSmartPointer&lt;vtkCellArray&gt;::New();

&nbsp;&nbsp; &nbsp;double coords[3];
&nbsp;&nbsp; &nbsp;vtkIdType nbpts=0, *pts=0;
&nbsp;&nbsp; &nbsp;for( init_lineArray-&gt;InitTraversal(); init_lineArray-&gt;GetNextCell(nbpts,
pts);)
&nbsp;&nbsp; &nbsp;{
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;vtkIdType init_ind=0, new_ind=0;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;for(int p=0; p&lt;nbpts; p++)
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;init_ind=pts[p];
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if(init_ind&lt;0)
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;continue;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;init_points-&gt;GetPoint( init_ind, coords);

&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;new_ind=new_points-&gt;InsertNextPoint(coords);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;polyline-&gt;GetPointIds()-&gt;InsertNextId(new_ind);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;}
&nbsp;&nbsp; &nbsp;new_lineArray-&gt;InsertNextCell(polyline);
&nbsp;&nbsp; &nbsp;new_data-&gt;SetPoints(new_points);
&nbsp;&nbsp; &nbsp;new_data-&gt;SetLines(new_lineArray);

&nbsp;&nbsp; &nbsp;vtkSmartPointer&lt;vtkXMLPolyDataWriter&gt; writer =
vtkSmartPointer&lt;vtkXMLPolyDataWriter&gt;::New();
&nbsp;&nbsp; &nbsp;writer-&gt;SetFileName("./new_wire.vtp");
&nbsp;&nbsp; &nbsp;writer-&gt;SetInput(new_data);
&nbsp;&nbsp; &nbsp;writer-&gt;Write();
****

</pre>
      </blockquote>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="content-type">
      <title>Test_Signature</title>
      <hr style="width: 100%; height: 2px;">
      <table style="text-align: left; font-family: Verdana; width:
        500px; height: 110px;" border="0" cellpadding="2"
        cellspacing="0">
        <tbody>
          <tr>
            <td style="text-align: center; width: 80px; font-family:
              Verdana;"><a moz-do-not-send="true"
                href="www.phenix-systems.com"><img style="border: 0px
                  solid; width: 75px; height: 66px;" alt="Logo Phenix
                  Systems"
                  src="cid:part1.05070806.08050506@phenix-systems.com"></a></td>
            <td style="width: 506px; font-family: Verdana;"><small
                style="color: rgb(51, 102, 102);"><span
                  style="font-weight: bold;">Nicolas Sarrasin -
                  Ing&eacute;nieur Developpement 3D CFAO</span><br
                  style="background-color: transparent;">
                <a moz-do-not-send="true" style="background-color:
                  transparent; text-decoration: underline;"
                  href="www.phenix-systems.com">Phenix systems</a><br
                  style="background-color: transparent; font-style:
                  italic;">
                <small><span style="background-color: transparent;
                    font-style: italic;"> Parc Europ&eacute;en d'Entreprises </span><br
                    style="background-color: transparent; font-style:
                    italic;">
                  <span style="background-color: transparent;
                    font-style: italic;"> rue Richard Wagner - 63200
                    Riom FRANCE </span><br style="font-style: italic;">
                  <span style="font-style: italic;"> tel : +33 (0)4 73
                    33 45 85 | fax : +33 (0)4 73 33 45 86 </span></small></small></td>
          </tr>
          <tr style="font-family: Verdana;">
            <td colspan="2" rowspan="1" style="width: 80px;"><font
                size="2" color="#36a629">Pensez environnement&nbsp;!</font><br>
              <font size="1" color="#36a629">N'imprimez ce mail que si
                c'est vraiment n&eacute;cessaire</font></td>
          </tr>
        </tbody>
      </table>
      <br style="font-family: Verdana;">
    </div>
    <br>
    <div class="moz-signature">-- <br>
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="content-type">
      <title>Test_Signature</title>
      <hr style="width: 100%; height: 2px;">
      <table style="text-align: left; font-family: Verdana; width:
        500px; height: 110px;" border="0" cellpadding="2"
        cellspacing="0">
        <tbody>
          <tr>
            <td style="text-align: center; width: 80px; font-family:
              Verdana;"><a href="www.phenix-systems.com"><img
                  style="border: 0px solid; width: 75px; height: 66px;"
                  alt="Logo Phenix Systems"
                  src="cid:part2.02030803.06080008@phenix-systems.com"></a></td>
            <td style="width: 506px; font-family: Verdana;"><small
                style="color: rgb(51, 102, 102);"><span
                  style="font-weight: bold;">Nicolas Sarrasin -
                  Ing&eacute;nieur Developpement 3D CFAO</span><br
                  style="background-color: transparent;">
                <a style="background-color: transparent;
                  text-decoration: underline;"
                  href="www.phenix-systems.com">Phenix systems</a><br
                  style="background-color: transparent; font-style:
                  italic;">
                <small><span style="background-color: transparent;
                    font-style: italic;"> Parc Europ&eacute;en d'Entreprises </span><br
                    style="background-color: transparent; font-style:
                    italic;">
                  <span style="background-color: transparent;
                    font-style: italic;">
                    rue Richard Wagner - 63200 Riom FRANCE </span><br
                    style="font-style: italic;">
                  <span style="font-style: italic;">
                    tel : +33 (0)4 73 33 45 85 | fax : +33 (0)4 73 33 45
                    86 </span></small></small></td>
          </tr>
          <tr style="font-family: Verdana;">
            <td colspan="2" rowspan="1" style="width: 80px;"><font
                size="2" color="#36a629">Pensez environnement&nbsp;!</font><br>
              <font size="1" color="#36a629">N'imprimez ce mail que si
                c'est vraiment n&eacute;cessaire</font></td>
          </tr>
        </tbody>
      </table>
      <br style="font-family: Verdana;">
    </div>
  </body>
</html>