<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>In case someone finds this useful...</p>
    <p>Source:
<a class="moz-txt-link-freetext" href="http://www.paraview.org/Wiki/VTK/Examples/Python/PolyData/RuledSurfaceFilter">http://www.paraview.org/Wiki/VTK/Examples/Python/PolyData/RuledSurfaceFilter</a></p>
    <p>Trick: vtkRuledSurfaceFilter requires the vtkPolyData it works on
      to have Lines (set with SetLines(cells) method) NOT Polygons</p>
    <p>---<br>
      import vtk<br>
       <br>
      # create a rendering window and renderer<br>
      ren = vtk.vtkRenderer()<br>
      ren.SetBackground(0.1, 0.2, 0.4)<br>
      renWin = vtk.vtkRenderWindow()<br>
      renWin.AddRenderer(ren)<br>
      renWin.FullScreenOn()<br>
       <br>
      # create a renderwindowinteractor<br>
      iren = vtk.vtkRenderWindowInteractor()<br>
      iren.SetRenderWindow(renWin)<br>
      iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())<br>
       <br>
      #Create the points fot the lines.<br>
      points = vtk.vtkPoints()<br>
      points.InsertPoint(0, 0, 0, 1)<br>
      points.InsertPoint(1, 0, 0, 0)<br>
      points.InsertPoint(2, 1, 0, 0)<br>
      points.InsertPoint(3, 0, 1, 1)<br>
      points.InsertPoint(4, 1, 1, 1)<br>
      points.InsertPoint(5, 1, 1, 0)<br>
      <br>
      line1 = vtk.vtkPolyLine()<br>
      line1.GetPointIds().SetNumberOfIds(3)<br>
      line1.GetPointIds().SetId(0, 0)<br>
      line1.GetPointIds().SetId(1, 1)<br>
      line1.GetPointIds().SetId(2, 2)<br>
      <br>
      line2 = vtk.vtkPolyLine()<br>
      line2.GetPointIds().SetNumberOfIds(3)<br>
      line2.GetPointIds().SetId(0, 3)<br>
      line2.GetPointIds().SetId(1, 4)<br>
      line2.GetPointIds().SetId(2, 5)<br>
      <br>
      #Create a cellArray containing the lines<br>
      lines =vtk.vtkCellArray()<br>
      lines.InsertNextCell(line1)<br>
      lines.InsertNextCell(line2)<br>
       <br>
      #Create the vtkPolyData to contain the points and cellArray with
      the lines<br>
      polydata = vtk.vtkPolyData()<br>
      polydata.SetPoints(points)<br>
      polydata.SetLines(lines)<br>
      <br>
      print polydata<br>
       <br>
      #Create the ruledSurfaceFilter from the polydata containing the
      lines<br>
      ruledSurfaceFilter = vtk.vtkRuledSurfaceFilter()<br>
      ruledSurfaceFilter.SetInputData(polydata)<br>
      ruledSurfaceFilter.SetResolution(21, 21)<br>
      ruledSurfaceFilter.SetRuledModeToResample()<br>
      ruledSurfaceFilter.Update()<br>
       <br>
      #Create the mapper with the ruledSufaceFilter as input<br>
      mapper = vtk.vtkPolyDataMapper()<br>
      mapper.SetInputData(ruledSurfaceFilter.GetOutput())<br>
      mapper.Update()<br>
       <br>
      #create the actor with the mapper<br>
      actor = vtk.vtkActor()<br>
      actor.SetMapper(mapper)<br>
       <br>
      #add the actor to the display<br>
      ren.AddActor(actor)<br>
       <br>
      # enable user interface interactor<br>
      iren.Initialize()<br>
      renWin.Render()<br>
      iren.Start()</p>
    <p>---</p>
    <p>Regards,</p>
    <p>Paul</p>
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 08/06/2016 16:00, Paul Kibet Korir
      wrote:<br>
    </div>
    <blockquote
      cite="mid:1c9ed0b2-9f9e-5b54-f400-6c6ddc6ccf47@ebi.ac.uk"
      type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=windows-1252">
      <p>Hellos,</p>
      <p>The <a moz-do-not-send="true"
href="http://www.vtk.org/doc/release/7.0/html/classvtkRuledSurfaceFilter.html#a68bd60190bef5e8d9b15f79c0576e189">vtkRuledSurfaceFilter
          documentation</a> states that this filter "...can also be used
        to create surfaces from contours". </p>
      <p>Can someone please share an example on how this can be
        achieved? I've tried many things to no avail.<br>
      </p>
      <br>
      <div class="moz-signature">-- <br>
        With kind regards,<br>
        <br>
        <strong>Dr. Paul K Korir, PhD</strong><br>
        <i>Scientific Programmer</i><br>
        EMBL-EBI<br>
        Main Building, A2-35,<br>
        WTGC, Hinxton, Cambridge CB10 1SD<br>
        P: +44 1223 49 44 22<br>
        F: +44 1223 49 44 68</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>

Search the list archives at: <a class="moz-txt-link-freetext" href="http://markmail.org/search/?q=vtkusers">http://markmail.org/search/?q=vtkusers</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/vtkusers">http://public.kitware.com/mailman/listinfo/vtkusers</a>
</pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      With kind regards,<br>
      <br>
      <strong>Dr. Paul K Korir, PhD</strong><br>
      <i>Scientific Programmer</i><br>
      EMBL-EBI<br>
      Main Building, A2-35,<br>
      WTGC, Hinxton, Cambridge CB10 1SD<br>
      P: +44 1223 49 44 22<br>
      F: +44 1223 49 44 68</div>
  </body>
</html>