<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Dear developper,<br>
<br>
I write some scripts that exports data into a STL file.<br>
The issue comes when I try to use a STLWriter. I've tried several
ways:<br>
- compute data in the paraview field, I mean using filters provided
by the python tool from paraview<br>
- compute data and export them using VTK filters<br>
- compute data using VTK and export it using a trivialProducer +
writer.<br>
<br>
The STL file is just empty, only :<br>
"solid ascii<br>
endsolid"<br>
when writing down in ASCII mode.<br>
<br>
Is there a bug somewhere? Are the data incorrect to be written using
STL writer?<br>
Thanks for your help.<br>
Laurent.<br>
<br>
<br>
________________<br>
#Here is the code:<br>
<br>
from paraview.simple import *<br>
from paraview.vtk import *<br>
from paraview.util import *<br>
from math import *<br>
import paraview.vtk.io as vtk_io<br>
<br>
MathObject = vtk.vtkMath()<br>
<br>
exportCylinderFilename = ""D:/Work/Axis.stl"<br>
<br>
#1st method using paraview filters<br>
LineSourcePV = Line(guiName = "Axis")<br>
LineSourcePV.Point1 = LineUp[0],LineUp[1], LineUp[2] #points are OK<br>
LineSourcePV.Point2 = LineDown[0],LineDown[1], LineDown[2]<br>
<br>
tube = Tube()<br>
tube.Radius = 2<br>
tube.NumberofSides = 32<br>
tube.UpdatePipeline()<br>
tube.Capping = 1<br>
SetActiveSource(tube)<br>
Show(tube)<br>
#In the GUI, I get a cylinder with 34 cells and 288 points. So data
are ok.<br>
<br>
stlWriter = PSTLWriter()<br>
stlWriter.FileName = exportCylinderFilename <br>
stlWriter.Input = tube<br>
stlWriter.FileType = 1<br>
stlWriter.UpdatePipeline()<br>
#I get one empty file<br>
<br>
writer = servermanager.writers.PSTLWriter( Input=tube,
FileName=exportCylinderFilename , FileType=1)<br>
writer.UpdatePipeline()<br>
#I get the same empty file<br>
<br>
#2nd method using VTK filters<br>
Linesource = vtk.vtkLineSource()<br>
Linesource.SetPoint1(LineUpTibia)<br>
Linesource.SetPoint2(LineDownTibia)<br>
Linesource.SetResolution(1)<br>
Linesource.Update()<br>
<br>
tube2 = vtk.vtkTubeFilter()<br>
tube2.SetInput(Linesource.GetOutput())<br>
tube2.SetRadius(1)<br>
tube2.SetNumberOfSides(32)<br>
tube2.CappingOn()<br>
tube2.Update()<br>
print "nb cells: ", tube2.GetOutput().GetNumberOfCells()<br>
<br>
stlWriter2 = vtk_io.vtkSTLWriter()<br>
stlWriter2.SetFileName("D:/Work/stl2.stl")<br>
stlWriter2.SetInputConnection(tube2.GetOutputPort())<br>
stlWriter2.SetFileTypeToASCII()<br>
stlWriter2.Update()<br>
#I get the same empty file<br>
<br>
<br>
<div class="moz-signature">-- <br>
<font size="1">Please consider environmental impact before
printing documents</font></div>
</body>
</html>