[Paraview] writing spheres, cones, etc.

Andy Bauer andy.bauer at kitware.com
Sun Feb 13 13:26:42 EST 2011


Hi,

Is there a reason you want to code up in C++?  You can create spheres and
cones (under the Source menu) in ParaView and set their parameters like
center, resolution, size, etc.  There are also other common geometries like
cylinders, boxes, etc.  You can save the results in a POV file by choosing
Export and choosing POV as the file type.  If you want to automate the
process you can record a python script as well which can be modified to
change the filter parameters and then run it with either pvpython or
pvbatch.

Andy

On Sun, Feb 13, 2011 at 10:29 AM, Benjamin Auffarth <auffarth at csc.kth.se>wrote:

> Hi,
>  I am new to using VTK and paraview, so excuse me if my question is too
> obvious. I've been looking into several manuals and the online VTK wiki, but
> couldn't find exactly what I was looking for.
>  I want to visualize abstract shapes, mainly spheres and cones. After
> looking into different formats, such as legacy VTK, and trying to create
> these shapes from polygons, I am now using VTK from C++ to create the shapes
> I want.  However my problem is now that I don't know how to store them
> (except for taking a screenshot). Is there a writer I can use for that?
>  Also: once I am satisfied with my visualization, I would like to be able
> to export to povray. It would be very convenient to be turn my objects until
> I have a good viewpoint and then export with camera and light sources
> accordingly to pov format. Could somebody give a simple example how this is
> possible?
> Thanks a lot,
> Benjamin.
>
>  My template now looks like this and is based on examples in the wiki:
>
> int main(int argc, char** argv[])
> {
>     std::vector<vtkSmartPointer<vtkPolyDataAlgorithm> >
> geometricObjectSources;
>
> geometricObjectSources.push_back(vtkSmartPointer<vtkSphereSource>::New());
>
> geometricObjectSources.push_back(vtkSmartPointer<vtkCylinderSource>::New());
>
>     std::vector<vtkSmartPointer<vtkRenderer> > renderers;
>     std::vector<vtkSmartPointer<vtkPolyDataMapper> > mappers;
>     std::vector<vtkSmartPointer<vtkActor> > actors;
>
>     // Visualize
>     vtkSmartPointer<vtkRenderer> renderer =
> vtkSmartPointer<vtkRenderer>::New();
>     vtkSmartPointer<vtkRenderWindow> renderWindow =
> vtkSmartPointer<vtkRenderWindow>::New();
>     renderWindow->AddRenderer(renderer);
>     vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
> vtkSmartPointer<vtkRenderWindowInteractor>::New();
>     renderWindowInteractor->SetRenderWindow(renderWindow);
>
>     // Create a source, renderer, mapper, and actor
>     // for each object
>     for(unsigned int i = 0; i < geometricObjectSources.size(); i++){
>         geometricObjectSources[i]->Update();
>
>         mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());
>
> mappers[i]->SetInputConnection(geometricObjectSources[i]->GetOutputPort());
>
>
>         actors.push_back(vtkSmartPointer<vtkActor>::New());
>         actors[i]->SetMapper(mappers[i]);
>
>         renderer->AddActor(actors[i]);
>     }
>
>   renderWindow->Render();
>   renderWindowInteractor->Start();
>
>   //// Here I want to write my objects into a file
>   //// or: turn the object and then export to povray with camera according
> to viewpoint
>
>   return EXIT_SUCCESS;
> }
>
>
> ----
> Benjamin Auffarth
> KTH, Computational Biology and Neurocomputing (CBN),
> Albanova Universitetscentrum, Roslagstullsbacken 35,
> S-100 44 Stockholm, Sweden
> room 162:021B, tel. +46 8 790 8699
>
> _______________________________________________
> 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 ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110213/704e1dde/attachment.htm>


More information about the ParaView mailing list