[vtkusers] vtkSTLWriter after vtkQuadricDecimation

Mike Jackson imikejackson at gmail.com
Wed Sep 5 15:24:52 EDT 2007


STL files are just a bunch of Triangles. There is NO connectivity  
information in a standard STL file. If you use the vtkSTLReader then  
that will read you STL file and convert it to vtkPolyData.

Basically, you better have a _good_ reason to store something in an  
STL file, like you are getting a "3D print" of your model. otherwise  
it is quicker and more space preserving to use something like .vtp  
(vtkPolyData) files.


-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Sep 5, 2007, at 3:19 PM, <vmh104-vtk at yahoo.com> wrote:

> That's what I believe my code does I've tried other vtk decimatoion
> filters too. I'm wondering if it's because STL files have no
> connectivity information... how do I add the connectivity back in?
>
>
> --- Mike Jackson <imikejackson at gmail.com> wrote:
>
>> STLWriter only works on Triangles. You are most likely producing
>> QUADS. You need to triangulate the quads (vtkTriangleFilter) first,
>> then pass the triangulated output to the STL writer..
>>
>> Try that and see what happens.
>>
>> -- 
>> Mike Jackson   Senior Research Engineer
>> Innovative Management & Technology Services
>>
>>
>> On Sep 5, 2007, at 1:50 PM, <vmh104-vtk at yahoo.com> wrote:
>>
>>> Hi,
>>>
>>> Pretty new at this. I'm sure I'm doing something stupid but I can't
>>
>>> see
>>> it. Trying to write an STL decimator using tcl vtk, In the example
>>> below decimated GetActualReduction does return a good number and
>>> according to the doc: "Gets the actual reduction. This value is
>> only
>>> valid after the filter has executed". However when I pass this to
>>> vtkSTLWriter the outfile is about as large as the infile. WHat am I
>>> doing wrong?
>>>
>>> Thx,
>>>
>>> Vincent
>>>
>>> vtkSTLReader sr
>>>     sr SetFileName E:/test.stl
>>>
>>> vtkTriangleFilter triangles1
>>>    triangles1 SetInputConnection [sr  GetOutputPort]
>>>    triangles1 Update
>>>
>>> vtkQuadricDecimation decimated
>>>    decimated SetInputConnection [triangles1 GetOutputPort]
>>>    decimated SetTargetReduction .01
>>>    decimated AttributeErrorMetricOn
>>>    decimated UpdateWholeExtent
>>>
>>> vtkSTLWriter stl
>>>    stl SetInputConnection [decimated GetOutputPort]
>>>    stl SetFileName E:/out.stl
>>>    stl SetFileType 2
>>>    stl Write
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> This is the private VTK discussion list.
>>> Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/
>>> Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>




More information about the vtkusers mailing list