diff --git a/Source/Model/Writer/v100/NMR_ModelWriterNode100_Mesh.cpp b/Source/Model/Writer/v100/NMR_ModelWriterNode100_Mesh.cpp index 9add5edbe..d723d16b1 100644 --- a/Source/Model/Writer/v100/NMR_ModelWriterNode100_Mesh.cpp +++ b/Source/Model/Writer/v100/NMR_ModelWriterNode100_Mesh.cpp @@ -131,6 +131,19 @@ namespace NMR { writeStartElement(XML_3MF_ELEMENT_MESH); m_pProgressMonitor->SetProgressIdentifier(ProgressIdentifier::PROGRESS_WRITENODES); + + // Write id of referenced volume data, if any + if (m_bWriteVolumetricExtension) { + auto pVolumeData = m_pModelMeshObject->getVolumeData(); + if (pVolumeData) { + PPackageResourceID pID = pVolumeData->getPackageResourceID(); + if (pID->getPath() != m_pModel->currentPath()) + throw CNMRException(NMR_ERROR_MODELRESOURCE_IN_DIFFERENT_MODEL); + writePrefixedIntAttribute(XML_3MF_NAMESPACEPREFIX_VOLUMETRIC, XML_3MF_ATTRIBUTE_MESH_VOLUMEDATA, pID->getModelResourceID()); + } + } + + // Write Vertices writeStartElement(XML_3MF_ELEMENT_VERTICES); for (nNodeIndex = 0; nNodeIndex < nNodeCount; nNodeIndex++) { diff --git a/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp b/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp index 43333782a..4f01e6c5b 100644 --- a/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp +++ b/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp @@ -865,8 +865,15 @@ namespace NMR { implicitWriter.writeImplicitFunctions(); } - void CModelWriterNode100_Model::writeMultiProperties() + void CModelWriterNode100_Model::writeVolumeData() { + CModelWriterNode_VolumeData volumeWriter(m_pModel, m_pXMLWriter, + m_pProgressMonitor); + volumeWriter.writeToXML(); + } + + void CModelWriterNode100_Model::writeMultiProperties() + { nfUint32 nCount = m_pModel->getMultiPropertyGroupCount(); for (nfUint32 nIndex = 0; nIndex < nCount; nIndex++) @@ -915,6 +922,9 @@ namespace NMR { if (m_bWriteImplicitExtension) { writeImplicitFunctions(); } + if (m_bWriteVolumetricExtension) { + writeVolumeData(); + } if (m_bWriteObjects) writeObjects(); }