I use Communicator::Exporter::WriteXML to generate an xml file that contains many sub-nodes inside the parts. I want to extract from the xml only the assembly and parts hierarchy, just like the CATProduct file opened in Catia software to show the tree structure, how to determine what type each node of the xml belongs to I need to filter the xml bom structure that contains the ProductOccurence Id of the corresponding node, or do I use Communicator::Exporter::WriteXMLBOM
like this:
In addition, whether the source model file in different formats, the generated xml file needs to be filtered in different ways to ensure that the corresponding software opens the same bom structure and the final xml filtered hierarchy, and does not contain the node information of the lower level
Hi,
can you elaborate a bit more on your question? Do you want to know how to parse the XML structure in that file so that you can display your own model tree and/or process this file on the server?
You can find some information on the XML format we use here:
https://docs.techsoft3d.com/communicator/latest/build/prog_guide/viewing/data_model/stream_cache/shattered-workflows.html
For parsing the XML data in JS I’m personally using the npm package xml2js.
Let me know if this answers your question.
Thanks,
Guido
Sorry, maybe I didn’t describe it clearly, I’m a c++ developer and I want to use Communicator::Exporter::WriteXML to generate XML files when the model is converted lightly with libconverter, but I don’t know which ProductOccurence nodes in the XML are assemblies and which are Parts, which are other types of nodes, I only want the Bom structure at the assembly/parts level, how do I distinguish?
I did misunderstand. Sorry about that.
If you need a simplified representation of the cad model with parts clearly enumerated per subassembly than WriteXMLBOM should give you that information. WriteXML gives you a more indepth representation of the CAD hierachy that will require more parsing to make sense of. The structure of the generated XML file closely follows the internal HOOPS Exchange representation of a CAD model.
In short each part or partInstance in the assembly will have the “IsPart” property set to true. If its an instance it will also have an InstanceRef property referring to the actual part.
I hope this helps,
Guido