If vtkStripper works most of the time, but not all the time, it might be a tolerance issue.  What I mean is, the endpoints for the line segments might not match exactly.<div><br></div><div>You could try using vtkCleanPolyData with SetTolerance(1e-6) before vtkStripper.  This will merge all nearly-coincident points.</div>

<div><br></div><div>  David</div><div><br><div><br><div class="gmail_quote">On Thu, Jan 6, 2011 at 6:55 AM, Nicolas Sarrasin <span dir="ltr">&lt;<a href="mailto:nsarrasin@phenix-systems.com">nsarrasin@phenix-systems.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5">

  
    
  
  <div bgcolor="#ffffff" text="#003333">
    <font size="-1"><font face="Tahoma">Yes of course !<br>
        <br>
        That&#39;s why I&#39;m writing &quot;</font></font><small>For most of case it
      works well&quot;, 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&#39;t appear, as it&#39;s
      shown in the pictures I linked.<br>
      <br>
    </small>Le 06/01/2011 14:47, David Gobbi a écrit :
    <blockquote type="cite">
      <pre>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 href="mailto:nsarrasin@phenix-systems.com" target="_blank">&lt;nsarrasin@phenix-systems.com&gt;</a> wrote:
</pre>
      <blockquote type="cite">
        <pre>Hi all,
I&#39;m trying to convert a set of line into one only vtkPolyLine. (original
post here :
<a href="http://vtk.1045678.n5.nabble.com/construct-a-vtkPolyLine-PolyGon-from-a-set-of-vtkLines-td3325716.html" target="_blank">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&#39;m actually encounter a problem on a
case.

The input polydata
(<a href="http://img525.imageshack.us/img525/8370/vtkconvertioninit.png" target="_blank">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 href="http://img502.imageshack.us/img502/8773/vtkconvertionres.png" target="_blank">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[])
{
    vtkSmartPointer&lt;vtkXMLPolyDataReader&gt; reader =
vtkSmartPointer&lt;vtkXMLPolyDataReader&gt;::New();
    reader-&gt;SetFileName(&quot;./wire.vtp&quot;);

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

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

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

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

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

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

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

    vtkSmartPointer&lt;vtkXMLPolyDataWriter&gt; writer =
vtkSmartPointer&lt;vtkXMLPolyDataWriter&gt;::New();
    writer-&gt;SetFileName(&quot;./new_wire.vtp&quot;);
    writer-&gt;SetInput(new_data);
    writer-&gt;Write();
****
</pre></blockquote></blockquote></div></div></div>
<br></blockquote></div><br></div></div>