vtkAssembly 装配关系获取

在装配中VTK没有给方法获取父项或者模型在世界坐标矩阵的获取。

通过vtkAssemblyPath::AddNode()可以记录装配关系。

1、添加装配-每次装配添加(AddAssemblyPartNew)同时添加vtkAssemblyPath

this->m_render->AddActor(theAssembly);
RotateXYZNew(partId, Matrix[3], Matrix[4], Matrix[5]);
TranslateXYZNew(partId, Matrix[0], Matrix[1], Matrix[2]);

thevtkAssemblyPath = vtkSmartPointer::New();
// 添加根 Assembly
thevtkAssemblyPath->AddNode(theAssembly, theAssembly->GetMatrix());

2、通过全局thevtkAssemblyPath获取装配结构

3、遍历装配节点信息

vtkCollectionSimpleIterator it;
thevtkAssemblyPath->InitTraversal(it);
while (vtkAssemblyNode* node = thevtkAssemblyPath->GetNextNode(it)) {

    vtkMatrix4x4* worldMatrix = node->

你可能感兴趣的:(OCC+VTK,算法,开发语言,c++)