Hi,<br><br>I'm trying to write this example ( <a href="http://www.vtk.org/Wiki/VTK/Tutorials/TriangleGeometryVertices">http://www.vtk.org/Wiki/VTK/Tutorials/TriangleGeometryVertices</a> ) in python language.<br><br>When you open the VTK rendering window occurs Segmentation fault.<br>
<br>I tried to open the file (.vtp) in the Paraview, when click on Apply, the Paraview closes.<br><br>Regards,<br>Paulo<br><br><br><b>The code:<br></b><br>from vtk import *<br><br>X = [1.0, 0.0, 0.0]<br>Y = [0.0, 0.0, 1.0]<br>
Z = [0.0, 0.0, 0.0]<br> <br>points = vtkPoints()<br>vertices = vtkCellArray()<br><br>ids = vtkIdList()<br>ids.SetNumberOfIds(3)<br><br>for i in xrange(3):<br> ids.SetId(i, i)<br> points.InsertNextPoint(X[i],Y[i],Z[i])<br>
vertices.InsertNextCell(ids)<br> <br>writer = vtkXMLPolyDataWriter()<br>
writer.SetFileName ( ".//TriangleVerts.vtp")<br>
writer.SetInput(polydata)<br>
writer.Write()<br><br>polydata = vtkPolyData()<br>polydata.SetPoints(points)<br>polydata.SetVerts(vertices)<br>polydata.Update()<br><br>mapper = vtkPolyDataMapper()<br>mapper.SetInput(polydata)<br><br>actor = vtkActor()<br>
actor.SetMapper(mapper)<br> <br>ren = vtkRenderer()<br>ren.AddActor(actor)<br><br>renWin = vtkRenderWindow()<br>renWin.AddRenderer( ren )<br><br>iren = vtkRenderWindowInteractor()<br>iren.SetRenderWindow(renWin)<br><br>renWin.Render()<br>
<br><br><b>VTP File Content:</b><br><br><br><?xml version="1.0"?><br><VTKFile type="PolyData" version="0.1" byte_order="LittleEndian" compressor="vtkZLibDataCompressor"><br>
<PolyData><br> <Piece NumberOfPoints="3" NumberOfVerts="3" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="0" ><br>
<PointData><br> </PointData><br> <CellData><br> </CellData><br> <Points><br> <DataArray type="Float32" Name="Points" NumberOfComponents="3" format="appended" RangeMin="0" RangeMax="1" offset="0" /><br>
</Points><br> <Verts><br> <DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="48" /><br>
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="108" /><br>
</Verts><br> <Lines><br> <DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="156" /><br>
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="172" /><br>
</Lines><br> <Strips><br> <DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="188" /><br>
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="204" /><br>
</Strips><br> <Polys><br> <DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="220" /><br>
<DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="236" /><br>
</Polys><br> </Piece><br> </PolyData><br> <AppendedData encoding="base64"><br> _AQAAAACAAAAkAAAAEAAAAA==eJxjYGiwZ8AJIHIAHX4Bfw==AQAAAACAAAAwAAAAGQAAAA==eJxjYICAFXqXL8XXM8ABIwMqgPEBffcDXA==AQAAAACAAAAYAAAAEAAAAA==eJxjYoAAFijNBqUBALgADQ==AAAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAACAAAAAAAAA<br>
</AppendedData><br></VTKFile><br><br><br>