Writing a sphere in a file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Writing a sphere in a file

Panagiotis Foteinos-2
Hi all.

I am attempting to write a sphere in a vtk file. The following snippet:

*************************************************
vtkSmartPointer<vtkSphereSource>  sphereSource = vtkSmartPointer<vtkSphereSource>::New();

sphereSource->SetCenter(0.0, 0.0, 0.0);
sphereSource->SetRadius(1.0);

vtkSmartPointer<vtkPolyDataWriter> writer = vtkSmartPointer<vtkPolyDataWriter>::New();
writer->SetInputData(sphereSource->GetOutput());
writer->SetFileName(filename.c_str());
writer->Update();
*************************************************

creates an empty file.

Any suggestions?

Warm Regards,
Panos

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Writing a sphere in a file

Mathieu Westphal
Hi

- writer->SetInputData(sphereSource->GetOutput());
+ writer->SetInputConnection(sphereSource->GetOutputPort(0));

Regards,

Mathieu Westphal

On Mon, Mar 27, 2017 at 2:37 PM, Panagiotis Foteinos <[hidden email]> wrote:
Hi all.

I am attempting to write a sphere in a vtk file. The following snippet:

*************************************************
vtkSmartPointer<vtkSphereSource>  sphereSource = vtkSmartPointer<vtkSphereSource>::New();

sphereSource->SetCenter(0.0, 0.0, 0.0);
sphereSource->SetRadius(1.0);

vtkSmartPointer<vtkPolyDataWriter> writer = vtkSmartPointer<vtkPolyDataWriter>::New();
writer->SetInputData(sphereSource->GetOutput());
writer->SetFileName(filename.c_str());
writer->Update();
*************************************************

creates an empty file.

Any suggestions?

Warm Regards,
Panos

_______________________________________________
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



_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Writing a sphere in a file

Panagiotis Foteinos-2
Thank you Mathieu.

It works like a charm.

Best,
Panos

On Mon, Mar 27, 2017 at 2:39 PM, Mathieu Westphal <[hidden email]> wrote:
Hi

- writer->SetInputData(sphereSource->GetOutput());
+ writer->SetInputConnection(sphereSource->GetOutputPort(0));

Regards,

Mathieu Westphal

On Mon, Mar 27, 2017 at 2:37 PM, Panagiotis Foteinos <[hidden email]> wrote:
Hi all.

I am attempting to write a sphere in a vtk file. The following snippet:

*************************************************
vtkSmartPointer<vtkSphereSource>  sphereSource = vtkSmartPointer<vtkSphereSource>::New();

sphereSource->SetCenter(0.0, 0.0, 0.0);
sphereSource->SetRadius(1.0);

vtkSmartPointer<vtkPolyDataWriter> writer = vtkSmartPointer<vtkPolyDataWriter>::New();
writer->SetInputData(sphereSource->GetOutput());
writer->SetFileName(filename.c_str());
writer->Update();
*************************************************

creates an empty file.

Any suggestions?

Warm Regards,
Panos

_______________________________________________
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




_______________________________________________
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

circumSphere.PNG (193K) Download Attachment
Loading...