[vtkusers] best way to save vtkpolydata for ANSYS

David Doria daviddoria+vtk at gmail.com
Fri Dec 25 12:46:17 EST 2009


On Fri, Dec 25, 2009 at 11:57 AM, Ali Habib <ali.mahmoud.habib at gmail.com> wrote:
> Dear All.
>
> how to save vtkpolydata to be suitable for using in ANSYS
>
> I used vtkstlwriter as following:
>
>             vtkSTLWriter writer = vtkSTLWriter::NEW();
>             writer->SetInput(triangle2.GetOutput());
>             writer->SetFileName("test");
>
> but when load test file using vtk give the following warning :
>
> ENDFACET  is not a recognized  BEGIN command ,abbreviation, or macro this
> command will be ignored
>
> Best regards
>

A couple of things:

1) you should use smart pointers:
vtkSmartPointer<vtkSTLWriter> writer = vtkSmartPointer<vtkSTLWriter>::New();
instead of
vtkSTLWriter writer = vtkSTLWriter::NEW();  // I'm not sure NEW()
works here? Shouldn't it be New()?

2) what type is triangle2?

3) I'm assuming you called writer->Write() ?

I'd suggest making the smallest possible example of using vtkSTLWriter
(we need an example of this anyway :) ) and seeing if you get the same
behavior. Do something very controlled like add a few points and
vertices or a triangle or something and see what happens.

Thanks,

David



More information about the vtkusers mailing list