[vtkusers] slicing a colored 3DS file that have multible Mesh Lists

BS odwbrodwbr at gmail.com
Tue Jun 9 16:59:26 EDT 2009


Dear All,
I'm working on extracting slice from a colored 3DS files, So the slice will
contain a colored version of the intersection area according to the
materials that the object has.
For example VTKData\Data\Viewpoint\iflamigm.3ds file has 33 mesh list and 4
materials.
I tried many different methods to do that but I couldn't get the result I
want.

vtk3DSImporter *importer = vtk3DSImporter::New();

importer->SetFileName('iflamigm.3ds');

importer->ComputeNormalsOn();

importer->Read();

vtk3DSMesh* mesh = importer->MeshList;

First approach I imported the file using vtk3DSImporter , then I appended
the 33 meshlist in one vtkAppendPolyData object
vtkAppendPolyData* append = vtkAppendPolyData::New(); then using loop for
append->AddInput(mesh->aPolyData);
mesh = (vtk3DSMesh *) mesh->next;
Then I used
polyDataTransfer = vtkTransformPolyDataFilter::New();
polyDataTransfer->SetInputConnection(append->GetOutputPort());
And I sliced it and get the intersection slice.. The problem here is that
when I'm appending the mesh lists , I'm appending the polydata only and the
color material of each list is getting lost and there is no way to add it
after appending since the result is one geometry object...

The second approach that I tried is to create an actor collection object
which its actors contains both the geometery data and colored data.
vtkActorCollection* actorCollec=vtkActorCollection::New(); then using loop
for
actorCollec->AddItem(mesh->anActor);
mesh = (vtk3DSMesh *) mesh->next;
Then I used
 polyDataTransfer = vtkTransformPolyDataFilter::New();
and looped for all actors in the collection and assign thier mappers to
polyDataTransfer
for(int i=0;i<this->actorCollec->GetNumberOfItems();i++)
        polyDataTransfer->AddInputConnection(this
->actorCollec->GetNextActor()->GetMapper()->GetOutputPort());
The problem here is when trying to calculate the model boundaries,
dimensions, I'm getting zeros !!! as if there is no object to slice.
vtkImplicitModeller* imageModeller = vtkImplicitModeller::New();
imageModeller->SetInputConnection(polyDataTransfer->GetOutputPort());
double Bounds[6];
imageModeller->GetModelBounds(Bounds);   // Bounds is zeros.


So I'm wondering if any body can help me to figure out how can I correctly do
this.
Any Idea is highly appreciated..
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090609/2ff6094b/attachment.htm>


More information about the vtkusers mailing list