[vtkusers] How to manage a large VRML file
Hugo Valdebenito
hugo at maptek.cl
Tue Oct 26 09:18:32 EDT 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101026/02e490bd/attachment.htm>
More information about the vtkusers
mailing list