[vtkusers] newbie : file format conversion

DynaBits (Ph. Guglielmetti) guglielmetti at dynabits.com
Mon Mar 17 23:51:24 EST 2003


Hello,
My first VTK project is the simple 3DS + OBJ to VRML converter below

vtkRenderWindow* rw;
if (ext=="3ds")
{
	vtk3DSImporter* imp= vtk3DSImporter::New();
	imp->ComputeNormalsOn();
	imp->SetFileName(in);
	imp->Read();
	rw=imp->GetRenderWindow();
}
else	// we need a reader
{
	rw=vtkRenderWindow::New();
	vtkRenderer* ren=vtkRenderer::New();
	rw->AddRenderer(ren);
	vtkPolyDataMapper* mapper=vtkPolyDataMapper::New();
	if (ext=="obj")
	{
		vtkOBJReader* imp= vtkOBJReader::New();
		imp->SetFileName(inc_str());
		mapper->SetInput(imp->GetOutput());
	}
	vtkActor* actor=vtkActor::New();
	actor->SetMapper(mapper);
	ren->AddActor(actor);
	ren->GetActiveCamera();	// calls ResetCamera 
}
vtkVRMLExporter* exp=vtkVRMLExporter::New();
exp->SetRenderWindow(rw);
exp->SetFileName(out);
exp->Write();

I have 2 problems:
1) VRML output from 3DS doesn't contain the points & polygons, only the
materials...
2) OBJ crashes at exp->Write, since no camera is defined...
What am I missing ? Thanks!

BTW, is there a search engine for this list ? the archives aren't very
handy...

Philippe Guglielmetti, 
DynaBits, Mechanical Design Automation Software


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.461 / Virus Database: 260 - Release Date: 10/03/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.461 / Virus Database: 260 - Release Date: 10/03/2003
 




More information about the vtkusers mailing list