How to create shattered assembly parts & XML from monolithic assembly

Introduction

Although shattered assembly can be created from some native CAD formats whose sub-components reside in individual files such as CATIA V5, Creo - Pro/E, NX or SolidWorks, it is not possible to create from a monolithic assembly file such as IFC, Revit or 3DXML.
This article introduces a sample which creates shattered assembly from a monolithic assembly file using HOOPS Exchange and LibConverter of HOOPS Communicator. Created shattered parts and master XML file can be loaded using HOOPS Communicator WebViewer APIs: loadSubtreeFromXmlFile and loadSubtreeFromScsXmlFile

You can study advantage of the shattered approach over the monolithic workflow from here

Sample project

Download sample project from following Git repository:

Setup and Usage

Please refer README.MD in the Git repository.

Tips

HOOPS Exchange with LibConverter

This sample imports a monolithic assembly file and traversed it using HOOPS Exchange. The traverse process exports a master XML file and create individual part models. Part models are converter to SC (SCZ) and SCS files using LibConverter of HOOPS Communicator.

Usage of HOOPS Exchange with LibConverter is introduced here

Traverse model file using Visitor pattern

This sample uses Visitor pattern contained in HOOPS Exchange samples to traverse imported model.
Usage of the the Visitor pattern is introduced here

Instanced parts

Instanced parts are only represented once but show up multiple times in the hierarchy.
By setting false to SetTraverseInstance, the Visitor pattern accesses only the first part instance so that it creates a part SC of instanced parts.

	A3DVisitorContainer sA3DVisitorContainer(CONNECT_TRANSFO);
	sA3DVisitorContainer.SetTraverseInstance(false);

ProductOccurrence deep copy

It is necessary to create a copy of part ProductOccurrence using A3DAsmProductOccurrenceDeepCopy before creating individual part PRC.

	A3DAsmProductOccurrence* pCopyPO;
	iRet = A3DAsmProductOccurrenceDeepCopy(pPartPO, &pCopyPO);

(Same part ProductOccurrence cannot be refereed from both master and part model files)

3 Likes

Since a new usability API: Tree Traversal API was released in the HOOPS Exchange 2024, I’ve added a new sample project (convertScShattered_TreeNode) in the GitHub using the new APIs instead of Visitor pattern.
https://docs.techsoft3d.com/exchange/latest/guide/tree_traversal.html

2 Likes