RES: [vtkusers] loading a file
Renato N. Elias
rnelias at nacad.ufrj.br
Fri Nov 2 10:49:26 EDT 2007
Here is a short example how I do this in Qt.
// Action to be taken upon file open
void SimpleView::fileOpen()
{
QString filename = QFileDialog::getOpenFileName(this,
tr("Open
Ensight case file"), ".",
tr("Ensight
case (*.case);;All Files (*)"));
if (!filename.isEmpty()) {
reader = vtkGenericEnSightReader::New();
reader->SetCaseFileName(filename.toStdString().c_str());
reader->Update();
//---------------------------------------------
geom = vtkGeometryFilter::New();
geom->SetInputConnection(reader->GetOutputPort());
//---------------------------------------------
mapper = vtkPolyDataMapper::New();
mapper->SetInputConnection( geom->GetOutputPort() );
//---------------------------------------------
actor = vtkActor::New();
actor->SetMapper( mapper );
//--------------------------------------------
ren->AddActor(actor);
ren->ResetCamera();
ren->GetRenderWindow()->Render();
//---------------------------------------------
a_fileSaveAs->setEnabled(true);
}
}
I hope it helps you
Renato.
-----Mensagem original-----
De: vtkusers-bounces+rnelias=nacad.ufrj.br at vtk.org
[mailto:vtkusers-bounces+rnelias=nacad.ufrj.br at vtk.org] Em nome de Lam Ha
Enviada em: sexta-feira, 2 de novembro de 2007 12:39
Para: vtkusers at vtk.org
Assunto: [vtkusers] loading a file
Hi there
I am new to VTK and have just finished some coding. My application reads a
.stl file and displays it. At the moment I have hardcoded the
filename:
vtkSTLReader *sr = vtkSTLReader::New();
sr->SetFileName("Ear.stl");
Now I would like to have a prompt-window (like the browse-button) from where
I can choose my desired STL-file to be read. So in the end the last line
from above would look like:
sr->SetFileName(filename);
What do I have to do?
Thanks in advance
Lam
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the 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