[vtkusers] How to manage a large VRML file
Sebastien Jourdain
sebastien.jourdain at kitware.com
Tue Oct 26 16:36:44 EDT 2010
Hi Hugo,
I don't know much about C#, but just in case...
It seems that you only pick the first actor. Are you sure that there
is only one ?
I guess, if you don't provide your renderer to the importer is because
you have other actors into it ?
Have you tried, at least to see if the file can be successfully loaded
by VTK when the importer is fully set ?
Seb
On Tue, Oct 26, 2010 at 9:18 AM, Hugo Valdebenito <hugo at maptek.cl> wrote:
> Hi all,
>
>
> I need to load a large data set, for example a VRML file (500MB), I'm using
> the following code (C#), may not be the best way, with my data set it's not
> work, not show anything :
>
> // VRML Import
> vtkVRMLImporter importer = vtkVRMLImporter.New();
>
> OpenFileDialog dialog = new OpenFileDialog();
> dialog.Filter =
> "VRML files (*.wrl)|*.wrl|All files (*.*)|*.*";
> dialog.InitialDirectory = "\\Desktop";
>
> dialog.Title = "Select a text file";
> dialog.Multiselect = false;
> if (dialog.ShowDialog() != DialogResult.OK)
> {
> return;
> }
>
> importer.SetFileName(dialog.FileName);
> importer.Read();
> importer.Update();
>
> //Convert to vtkDataSet
> vtkDataSet pDataset;
> vtkActorCollection actors = importer.GetRenderer().GetActors();
> actors.InitTraversal();
> pDataset = actors.GetNextActor().GetMapper().GetInput();
>
> //Convert to vtkPolyData
> vtkPolyData polyData = vtkPolyData.SafeDownCast ( pDataset );
> polyData.Update();
>
> // Mapper
> vtkPolyDataMapper solidMapper = vtkPolyDataMapper.New();
> solidMapper.SetInput ( polyData );
> solidMapper.ScalarVisibilityOff();
>
> // Actor
> vtkActor solidActor = vtkActor.New();
> solidActor.SetMapper ( solidMapper );
>
> //Add the actors to the scene
> _renderer.AddActor(solidActor);
> _renderer.SetBackground(1, 1, 1); // Background color dark blue
>
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list