[Paraview] writing spheres, cones, etc.

Benjamin Auffarth auffarth at csc.kth.se
Sun Feb 13 14:22:26 EST 2011


Hi,
 thanks Andy, for the information about python and povray. Pvpython and
pvbatch sound good. Maybe the matlab interface also provides what I need.
Indeed, I need to automate the process to read in text files with
coordinates and set then objects at these coordinates. I am now half-way
through parsing the text file and setting the objects in C++ and I don't
want to change again to a different language. Could somebody provide an
example of how to write a povray file with the current camera view in C++?
thanks,
Benjamin.

----
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


On Sun, Feb 13, 2011 at 7:26 PM, Andy Bauer <andy.bauer at kitware.com> wrote:

> 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/146423b5/attachment.htm>


More information about the ParaView mailing list