<div>Dear All,</div>
<div>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.</div>
<div>For example VTKData\Data\Viewpoint\iflamigm.3ds file has 33 mesh list and 4 materials.</div>
<div>I tried many different methods to do that but I couldn't get the result I want.</div>
<div><font size="2">
<p>vtk3DSImporter *importer = vtk3DSImporter::New();</p>
<p><font size="2">importer->SetFileName('iflamigm.3ds');</font></p><font size="2">
<p>importer->ComputeNormalsOn();</p>
<p>importer->Read();</p>
<p>vtk3DSMesh* mesh = importer->MeshList;</p></font></font></div>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<div>First approach I imported the file using <font size="2">vtk3DSImporter , then I appended the 33 meshlist in one <font size="2">vtkAppendPolyData object </font></font></div>
<div><font size="2"><font size="2"><font size="2">vtkAppendPolyData* append = vtkAppendPolyData::New(); then us</font></font></font><font size="2"><font size="2">ing loop for </font></font><font size="2"></font></div>
<div><font size="2"><font size="2"><font size="2">append->AddInput(<font size="2">mesh->aPolyData); </font></font></font></font></div>
<div><font size="2">mesh = (vtk3DSMesh *) mesh->next;</font></div>
<div>Then I used </div>
<div><font size="2">polyDataTransfer = vtkTransformPolyDataFilter::New();</font></div>
<div><font size="2"><font size="2">polyDataTransfer->SetInputConnection(append->GetOutputPort());</font></font></div>
<div><font size="2"><font size="2">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...</font></font></div>
<div><font size="2"><font size="2"></font></font> </div>
<div><font size="2"><font size="2">The second approach that I tried is to cr</font></font><font size="2"><font size="2">eate an actor collection object which its actors contains both the geometery data and colored data. </font></font></div>
<div><font size="2"><font size="2"><font size="2">vtkActorCollection* actorCollec=vtkActorCollection::New(); then us<font size="2"><font size="2">ing loop for </font></font></font></font></font></div>
<div><font size="2">actorCollec->AddItem(mesh->anActor);</font></div>
<div><font size="2">mesh = (vtk3DSMesh *) mesh->next;</font></div>
<div><font size="2"><font size="2"><font size="2">Then I used </font></font></font></div>
<div><font size="2"><font size="2">
<div><font size="2">polyDataTransfer = vtkTransformPolyDataFilter::New();</font></div>
<div>and looped for all actors in the collection and assign thier mappers to polyDataTransfer </div>
<div><font color="#0000ff" size="2"><font color="#0000ff" size="2">for</font></font><font size="2">(</font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2"> i=0;i<</font><font color="#0000ff" size="2"><font color="#0000ff" size="2">this</font></font><font size="2">->actorCollec->GetNumberOfItems();i++)</font></div>
<div> p<font size="2">olyDataTransfer->AddInputConnection(</font><font color="#0000ff" size="2"><font color="#0000ff" size="2">this</font></font><font size="2">->actorCollec->GetNextActor()->GetMapper()->GetOutputPort());</font></div>
<div><font size="2">The problem here is when trying to calculate </font><font size="2">the model </font><font size="2">boundaries, dimensions, I'm getting zeros !!! as if there is no object to slice.</font></div>
<div><font size="2"><font size="2">vtkImplicitModeller* </font></font><font size="2"><font size="2">imageModeller = vtkImplicitModeller::New();</font></font></div>
<div><font size="2"><font size="2"><font size="2">imageModeller->SetInputConnection(polyDataTransfer->GetOutputPort());</font></font></font></div>
<div><font size="2"><font color="#0000ff" size="2"><font color="#0000ff" size="2">double</font></font><font size="2"> Bounds[6];</font></font></div>
<div><font size="2"><font size="2">imageModeller->GetModelBounds(Bounds); // Bounds is zeros.</font></font></div>
<div><font size="2"><font size="2"></font></font> </div></font></font></div></blockquote>
<div dir="ltr"><font size="2"><font size="2">So I'm wondering if any body can help me to figure out how can I correctly </font></font><font size="2"><font size="2">do this.</font></font></div>
<div dir="ltr">Any Idea is highly appreciated..</div>
<div dir="ltr">Thanks.</div>