[vtkusers] writing only the point data information for vtp

Chiranjib Sur sur.chiranjib at gmail.com
Thu Mar 12 00:53:10 EDT 2015


Hi Bill,
Thanks for your quick reply. I gave a try on your suggestion, but could not
get the thing I wanted. May be the following description (what I intend to
do) will be helpful.

Here is the code snippets:

   //VTk writer
   vtkSmartPointer<vtkXMLPolyDataWriter> w =
vtkSmartPointer<vtkXMLPolyDataWriter>::New();

   // VTK points
   vtkSmartPointer<vtkPoints> polyPoints =
vtkSmartPointer<vtkPoints>::New();

   // Set the precision for the new points
   polyPoints->SetDataType( VTK_DOUBLE );

   // VTK PolyData
   vtkSmartPointer<vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::New();

   // Generate points for the polydata
     .....
   //

   polydata->SetPoints( newPoints );

  // Set the writer to write the polydata

  #if VTK_MAJOR_VERSION <= 5
         w->SetInput( polydata );
   #else
         w->SetInputData( polydata );
  #endif

// set filename
w->SetFileName("myFile.vtp");

// Write the poly data into file
   w->Write();

------------------------------------------------------------------
At this stage : myFile.vtp file contains :

<Points>...</ Points>
<CellData>...</ CellData>
<Verts>...</ Verts>
<Lines>...</ Lines>
<Strips>...</ Strips>
<Polys>...</ Polys>


I just need to print the part under the tag <Points>...</ Points>  and
nothing else.

Any suggestions ?

Thank in advance,
Chiranjib



On Thu, Mar 12, 2015 at 12:13 AM, Bill Lorensen <bill.lorensen at gmail.com>
wrote:

> You might be able to create another vtkPolyData and just set its
> PointData to the PointData of your original polydata.
>
> On Wed, Mar 11, 2015 at 12:36 PM, Chiranjib Sur <sur.chiranjib at gmail.com>
> wrote:
> > Hi All,
> > I am using the class vtkXMLPolyDataWriter to write polydata in my vtp
> file.
> > Is there any way, that I can write only the PointData and  ignore the
> rest
> >
> > <CellData>...</ CellData>
> > <Points>...</ Points>
> > <Verts>...</ Verts>
> > <Lines>...</ Lines>
> > <Strips>...</ Strips>
> > <Polys>...</ Polys>
> >
> > If I want to do this, do I have to write my own writer class ?
> >
> > Thanks,
> > Chiranjib
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Search the list archives at: http://markmail.org/search/?q=vtkusers
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> >
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150312/19b69901/attachment.html>


More information about the vtkusers mailing list