# why vtkpolydata is defferent form the vtkactor read from vrml use vtkVRMLImporter？

**URL:** https://discourse.vtk.org/t/why-vtkpolydata-is-defferent-form-the-vtkactor-read-from-vrml-use-vtkvrmlimporter/16248
**Category:** Support
**Created:** [January 20, 2026, 1:35pm UTC](https://discourse.vtk.org/t/why-vtkpolydata-is-defferent-form-the-vtkactor-read-from-vrml-use-vtkvrmlimporter/16248 "2026-01-20T13:35:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sophia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@sophia](https://discourse.vtk.org/u/sophia)
#### Post date: [January 20, 2026, 1:35pm UTC](https://discourse.vtk.org/t/why-vtkpolydata-is-defferent-form-the-vtkactor-read-from-vrml-use-vtkvrmlimporter/16248/1 "2026-01-20T13:35:52Z")

</div>

when the file is below：

#VRML V2.0 utf8

Transform {  
children [  
Shape {  
geometry Cylinder {  
radius 2.0  
height 40.0  
}  
}  
]  
}

there is different between the vtkpolydata and the vtkactor read from vrml use vtkVRMLImporter？why ？the matrix is initial。is there anyone know about the reason？

key code is this ：

```auto
vtkSmartPointer<vtkVRMLImporter> vrmlImporter =
	vtkSmartPointer<vtkVRMLImporter>::New();

vrmlImporter->SetFileName("d:\\2.wrl");
vrmlImporter->Update();

vtkRenderer* renderer = vrmlImporter->GetRenderer();
vtkRenderWindow* renderWindow = vrmlImporter->GetRenderWindow();

vtkActorCollection* actors = renderer->GetActors();
actors->InitTraversal(); // 初始化遍历器
int cylinderCount = 0;
vtkSmartPointer<vtkAssembly> assembly =
	vtkSmartPointer<vtkAssembly>::New();

vtkSmartPointer<vtkAppendPolyData> appendFilter =
	vtkSmartPointer<vtkAppendPolyData>::New();

while (vtkActor* actor = actors->GetNextActor())
{
	vtkDataSet * data =actor->GetMapper()->GetInput();
	vtkPolyData* polydata = vtkPolyData::SafeDownCast(data);

	cylinderCount++;
	assembly->AddPart(actor);
	appendFilter->AddInputData(polydata);
}

appendFilter->Update();

vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputData(appendFilter->GetOutput());

vtkSmartPointer<vtkActor> Resactor = vtkSmartPointer<vtkActor>::New();
Resactor->SetMapper(mapper);

m_renderer->AddActor(assembly);------actor
m_renderer->AddActor(Resactor);------generated use vtkpolydata get from above 
m_renderer->ResetCamera();

m_renderWindow->Render();

```

---

<div class="post-metadata">

### Author: ![sophia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@sophia](https://discourse.vtk.org/u/sophia)
#### Post date: [January 21, 2026, 2:39am UTC](https://discourse.vtk.org/t/why-vtkpolydata-is-defferent-form-the-vtkactor-read-from-vrml-use-vtkvrmlimporter/16248/2 "2026-01-21T02:39:34Z")

</div>

![1](https://discourse.vtk.org/uploads/default/original/2X/3/395d920548b6c92b89276df5a30c971f823d5607.jpeg)

the left is the assembly read from vrml use vtkVRMLImporter. the right is the Resactor, About the source of assembly and Resactor, please see the code.

---

<div class="post-metadata">

### Author: ![sophia](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@sophia](https://discourse.vtk.org/u/sophia)
#### Post date: [January 27, 2026, 3:04am UTC](https://discourse.vtk.org/t/why-vtkpolydata-is-defferent-form-the-vtkactor-read-from-vrml-use-vtkvrmlimporter/16248/3 "2026-01-27T03:04:07Z")

</div>

```auto
   After reading source code，i found the reason is that the vtkVRMLImporter use vtk pipe line like vtkAlgorithm create cylinder not putting vtkpolydata to vtkmapper，so vtkmapper should get vtkpolydata below this：

```

```auto
	vtkAlgorithmOutput* inputConnection = polyDataMapper->GetInputConnection(0, 0);
	if (inputConnection)
	{
		vtkAlgorithm* producer = inputConnection->GetProducer();
		vtkPolyDataAlgorithm* polyDataAlgorithm = vtkPolyDataAlgorithm::SafeDownCast(producer);
		if (polyDataAlgorithm)
		{
			
			polyDataAlgorithm->Update();
			block = polyDataAlgorithm->GetOutput();
		}
	}

```

```auto
  the block is same as the above picture

```
