diff --git a/Source/Model/Classes/NMR_Model.cpp b/Source/Model/Classes/NMR_Model.cpp index 679760cd3..f89b44eaf 100644 --- a/Source/Model/Classes/NMR_Model.cpp +++ b/Source/Model/Classes/NMR_Model.cpp @@ -1424,7 +1424,34 @@ namespace NMR { return false; } - return false; + if(sExtension == XML_3MF_NAMESPACE_VOLUMETRICSPEC) + { + for(size_t i = 0; i < m_ObjectLookup.size(); i++) + { + CModelMeshObject *pMeshObject = + dynamic_cast( + m_ObjectLookup[i].get()); + if(pMeshObject == nullptr || + pMeshObject->getMesh() == nullptr) + continue; + + auto volumeData = pMeshObject->getVolumeData(); + if (!volumeData) + continue; + + if (volumeData->hasBoundary() || volumeData->hasColor() || volumeData->getPropertyCount() > 0 || volumeData->hasComposite()) + { + return true; + } + } + } + + if (sExtension == XML_3MF_NAMESPACE_IMPLICITSPEC) + { + if (m_FunctionLookup.size() > 0) + return true; + } + return false; } nfUint32 CModel::getSliceStackCount() { diff --git a/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp b/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp index 08ee924d0..3ae5f689d 100644 --- a/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp +++ b/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp @@ -170,10 +170,20 @@ namespace NMR { if (m_bWriteVolumetricExtension) { writeConstPrefixedStringAttribute(XML_3MF_ATTRIBUTE_XMLNS, XML_3MF_NAMESPACEPREFIX_VOLUMETRIC, XML_3MF_NAMESPACE_VOLUMETRICSPEC); + if (m_pModel->RequireExtension(XML_3MF_NAMESPACE_VOLUMETRICSPEC)) { + if (sRequiredExtensions.size() > 0) + sRequiredExtensions = sRequiredExtensions + " "; + sRequiredExtensions = sRequiredExtensions + XML_3MF_NAMESPACEPREFIX_VOLUMETRIC; + } } if (m_bWriteImplicitExtension) { writeConstPrefixedStringAttribute(XML_3MF_ATTRIBUTE_XMLNS, XML_3MF_NAMESPACEPREFIX_IMPLICIT, XML_3MF_NAMESPACE_IMPLICITSPEC); + if (m_pModel->RequireExtension(XML_3MF_NAMESPACE_IMPLICITSPEC)) { + if (sRequiredExtensions.size() > 0) + sRequiredExtensions = sRequiredExtensions + " "; + sRequiredExtensions = sRequiredExtensions + XML_3MF_NAMESPACEPREFIX_IMPLICIT; + } } if (m_bWriteCustomNamespaces) {