How to save the vtkPoints to CSV file format?

Hi all :slight_smile:

I have a question about vtkPoints to CSV file format.

My code is:
vtkNew m_vtkPLYReader;
vtkNew m_vtkPCDPoints;

m_vtkPLYReader->SetFileName(path.c_str()); // Load ply file

//How to save vtkPoints to CSV?

But I don’t know how to save CSV file format.

I have tested with example code as below:

Please advise for me :cry:

Thank you :slight_smile:

Hello, what did you get when you tried to run the examples?

Hi @Paulo_Carvalho
I’m so sorry for my late reply.

I don’t understand your question.
Could you please explain again in detail?

You tried to run these examples below. Yes or no?

I already ran these examples and there were no problems.

Fine. So you simply need to change their code in order to conform to CSV format, which is quite straightforward, very similar to the second example.

Here’s an example of a CSV file (first line instructs MS Excel that the comma is the column separator):

1997,Ford,E350,"ac, abs, moon",30100.00
1999,Chevy,"Venture ""Extended Edition""",,49000.00
1996,Jeep,Grand Cherokee,"MUST SELL!
air, moon roof, loaded",479699.00

Ah… I’m sorry. I don’t understand your reply.

My purpose is to save the CSV file from the ‘vtkPoints’.

I have already tested as follow:

  1. Loading CSV file by ‘vtkDelimitedTextReader’ and updating to ‘vtkRenderWindow’.
  2. Loading PLY file by ‘vtkPLYReader’ and updating to ‘vtkRenderWindow’.
  3. Loading PLY or CSV file and updating to ‘vtkPoints’, and saving PLY format file.

I can get the ‘vtkPoints’ from the ‘vtkPLYReader’ or ‘vtkDelimitedTextReader’.

But, I still don’t know how to save the CSV file from ‘vtkPoints’.