922 lines
39 KiB
C++
922 lines
39 KiB
C++
/***********************************************************************************************************************
|
|
*
|
|
* Copyright (c) 2010 - 2025 by Tech Soft 3D, Inc.
|
|
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
|
|
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
|
|
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
|
|
* employees of Tech Soft 3D, Inc. is granted only under a written non-disclosure agreement, expressly prescribing the
|
|
* scope and manner of such use.
|
|
*
|
|
***********************************************************************************************************************/
|
|
|
|
#include <A3DSDKIncludes.h>
|
|
#include "PRC2XML.h"
|
|
#include <set>
|
|
#include <string>
|
|
|
|
A3DStatus traverseDisplayFilters(A3DUns32 uiSize, A3DAsmFilter** ppFilters, _TiXmlElement* setting);
|
|
A3DStatus traverseGraphScene(const A3DGraphSceneDisplayParametersData& sData, _TiXmlElement* setting);
|
|
|
|
//######################################################################################################################
|
|
A3DStatus traverseMaterialProperties(const A3DEntity* pEntity, _TiXmlElement* xmlfather)
|
|
{
|
|
_TiXmlElement* xml = new _TiXmlElement("A3DMiscMaterialPropertiesData");
|
|
A3DMiscMaterialPropertiesData sMaterialPropertiesData;
|
|
A3D_INITIALIZE_DATA(A3DMiscMaterialPropertiesData, sMaterialPropertiesData);
|
|
|
|
A3DStatus iRet = A3DMiscGetMaterialProperties(pEntity, &sMaterialPropertiesData);
|
|
if(iRet == A3D_SUCCESS)
|
|
{
|
|
xml->SetDoubleAttribute("m_dDensity", sMaterialPropertiesData.m_dDensity);
|
|
xml->SetAttribute("m_pcMaterialName", sMaterialPropertiesData.m_pcMaterialName ? sMaterialPropertiesData.m_pcMaterialName:"NULL");
|
|
xml->SetAttribute("m_ePhysicType", sMaterialPropertiesData.m_ePhysicType);
|
|
|
|
_TiXmlElement* xmlphysics = nullptr;
|
|
|
|
switch (sMaterialPropertiesData.m_ePhysicType)
|
|
{
|
|
case A3DPhysicType_Fiber:
|
|
xmlphysics = new _TiXmlElement("A3DMiscMaterialFiberData");
|
|
xmlphysics->SetDoubleAttribute("m_dYoungModulus_X", sMaterialPropertiesData.m_sFiber.m_dYoungModulus_X);
|
|
xmlphysics->SetDoubleAttribute("m_dYoungModulus_Y", sMaterialPropertiesData.m_sFiber.m_dYoungModulus_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dPoissonRatio_XY", sMaterialPropertiesData.m_sFiber.m_dPoissonRatio_XY);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_XY", sMaterialPropertiesData.m_sFiber.m_dShearModulus_XY);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_YZ", sMaterialPropertiesData.m_sFiber.m_dShearModulus_YZ);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion_X", sMaterialPropertiesData.m_sFiber.m_dThermalExpansion_X);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion_Y", sMaterialPropertiesData.m_sFiber.m_dThermalExpansion_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dTensileStressLimit_X", sMaterialPropertiesData.m_sFiber.m_dTensileStressLimit_X);
|
|
xmlphysics->SetDoubleAttribute("m_dCompressiveStressLimit_X", sMaterialPropertiesData.m_sFiber.m_dCompressiveStressLimit_X);
|
|
xmlphysics->SetDoubleAttribute("m_dTensileStressLimit_Y", sMaterialPropertiesData.m_sFiber.m_dTensileStressLimit_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dCompressiveStressLimit_Y", sMaterialPropertiesData.m_sFiber.m_dCompressiveStressLimit_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dShearStressLimit_XY", sMaterialPropertiesData.m_sFiber.m_dShearStressLimit_XY);
|
|
xmlphysics->SetDoubleAttribute("m_dShearStressLimit_YZ", sMaterialPropertiesData.m_sFiber.m_dShearStressLimit_YZ);
|
|
break;
|
|
|
|
case A3DPhysicType_HoneyComb:
|
|
xmlphysics = new _TiXmlElement("A3DMiscMaterialHoneyCombData");
|
|
xmlphysics->SetDoubleAttribute("m_dYoungModulus", sMaterialPropertiesData.m_sHoneyComb.m_dYoungModulus);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_XZ", sMaterialPropertiesData.m_sHoneyComb.m_dShearModulus_XZ);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_YZ", sMaterialPropertiesData.m_sHoneyComb.m_dShearModulus_YZ);
|
|
xmlphysics->SetDoubleAttribute("m_dShearStressLimit_XZ", sMaterialPropertiesData.m_sHoneyComb.m_dShearStressLimit_XZ);
|
|
xmlphysics->SetDoubleAttribute("m_dShearStressLimit_YZ", sMaterialPropertiesData.m_sHoneyComb.m_dShearStressLimit_YZ);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion", sMaterialPropertiesData.m_sHoneyComb.m_dThermalExpansion);
|
|
break;
|
|
|
|
case A3DPhysicType_Isotropic:
|
|
xmlphysics = new _TiXmlElement("A3DMiscMaterialIsotropicData");
|
|
xmlphysics->SetDoubleAttribute("m_dYoungModulus", sMaterialPropertiesData.m_sIsotropic.m_dYoungModulus);
|
|
xmlphysics->SetDoubleAttribute("m_dPoissonRatio", sMaterialPropertiesData.m_sIsotropic.m_dPoissonRatio);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus", sMaterialPropertiesData.m_sIsotropic.m_dShearModulus);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion", sMaterialPropertiesData.m_sIsotropic.m_dThermalExpansion);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalConductivity", sMaterialPropertiesData.m_sIsotropic.m_dThermalConductivity);
|
|
xmlphysics->SetDoubleAttribute("m_dSpecificHeat", sMaterialPropertiesData.m_sIsotropic.m_dSpecificHeat);
|
|
xmlphysics->SetDoubleAttribute("m_dYieldStrength", sMaterialPropertiesData.m_sIsotropic.m_dYieldStrength);
|
|
xmlphysics->SetDoubleAttribute("m_dTensileStrength", sMaterialPropertiesData.m_sIsotropic.m_dTensileStrength);
|
|
break;
|
|
|
|
case A3DPhysicType_Orthotropic2D:
|
|
xmlphysics = new _TiXmlElement("A3DMiscMaterialOrthotropic2DData");
|
|
xmlphysics->SetDoubleAttribute("m_dYoungModulus_X", sMaterialPropertiesData.m_sOrthotropic2D.m_dYoungModulus_X);
|
|
xmlphysics->SetDoubleAttribute("m_dYoungModulus_Y", sMaterialPropertiesData.m_sOrthotropic2D.m_dYoungModulus_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dPoissonRatio_XY", sMaterialPropertiesData.m_sOrthotropic2D.m_dPoissonRatio_XY);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_XY", sMaterialPropertiesData.m_sOrthotropic2D.m_dShearModulus_XY);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_XZ", sMaterialPropertiesData.m_sOrthotropic2D.m_dShearModulus_XZ);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_YZ", sMaterialPropertiesData.m_sOrthotropic2D.m_dShearModulus_YZ);
|
|
xmlphysics->SetDoubleAttribute("m_dTensileStressLimit_X", sMaterialPropertiesData.m_sOrthotropic2D.m_dTensileStressLimit_X);
|
|
xmlphysics->SetDoubleAttribute("m_dCompressiveStressLimit_X", sMaterialPropertiesData.m_sOrthotropic2D.m_dCompressiveStressLimit_X);
|
|
xmlphysics->SetDoubleAttribute("m_dTensileStressLimit_Y", sMaterialPropertiesData.m_sOrthotropic2D.m_dTensileStressLimit_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dCompressiveStressLimit_Y", sMaterialPropertiesData.m_sOrthotropic2D.m_dCompressiveStressLimit_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion_X", sMaterialPropertiesData.m_sOrthotropic2D.m_dThermalExpansion_X);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion_Y", sMaterialPropertiesData.m_sOrthotropic2D.m_dThermalExpansion_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dTensileStrainLimit_X", sMaterialPropertiesData.m_sOrthotropic2D.m_dTensileStrainLimit_X);
|
|
xmlphysics->SetDoubleAttribute("m_dCompressiveStrainLimit_X", sMaterialPropertiesData.m_sOrthotropic2D.m_dCompressiveStrainLimit_X);
|
|
xmlphysics->SetDoubleAttribute("m_dTensileStrainLimit_Y", sMaterialPropertiesData.m_sOrthotropic2D.m_dTensileStrainLimit_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dCompressiveStrainLimit_Y", sMaterialPropertiesData.m_sOrthotropic2D.m_dCompressiveStrainLimit_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dShearStressLimit_XY", sMaterialPropertiesData.m_sOrthotropic2D.m_dShearStressLimit_XY);
|
|
break;
|
|
|
|
case A3DPhysicType_Orthotropic3D:
|
|
xmlphysics = new _TiXmlElement("A3DMiscMaterialOrthotropic3DData");
|
|
xmlphysics->SetDoubleAttribute("m_dYoungModulus_X", sMaterialPropertiesData.m_sOrthotropic3D.m_dYoungModulus_X);
|
|
xmlphysics->SetDoubleAttribute("m_dYoungModulus_Y", sMaterialPropertiesData.m_sOrthotropic3D.m_dYoungModulus_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dYoungModulus_Z", sMaterialPropertiesData.m_sOrthotropic3D.m_dYoungModulus_Z);
|
|
xmlphysics->SetDoubleAttribute("m_dPoissonRatio_XY", sMaterialPropertiesData.m_sOrthotropic3D.m_dPoissonRatio_XY);
|
|
xmlphysics->SetDoubleAttribute("m_dPoissonRatio_XZ", sMaterialPropertiesData.m_sOrthotropic3D.m_dPoissonRatio_XZ);
|
|
xmlphysics->SetDoubleAttribute("m_dPoissonRatio_YZ", sMaterialPropertiesData.m_sOrthotropic3D.m_dPoissonRatio_YZ);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_XY", sMaterialPropertiesData.m_sOrthotropic3D.m_dShearModulus_XY);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_XZ", sMaterialPropertiesData.m_sOrthotropic3D.m_dShearModulus_XZ);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_YZ", sMaterialPropertiesData.m_sOrthotropic3D.m_dShearModulus_YZ);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion_X", sMaterialPropertiesData.m_sOrthotropic3D.m_dThermalExpansion_X);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion_Y", sMaterialPropertiesData.m_sOrthotropic3D.m_dThermalExpansion_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion_Z", sMaterialPropertiesData.m_sOrthotropic3D.m_dThermalExpansion_Z);
|
|
xmlphysics->SetDoubleAttribute("m_dTensileStressLimit_X", sMaterialPropertiesData.m_sOrthotropic3D.m_dTensileStressLimit_X);
|
|
xmlphysics->SetDoubleAttribute("m_dCompressiveStressLimit_X", sMaterialPropertiesData.m_sOrthotropic3D.m_dCompressiveStressLimit_X);
|
|
xmlphysics->SetDoubleAttribute("m_dTensileStressLimit_Y", sMaterialPropertiesData.m_sOrthotropic3D.m_dTensileStressLimit_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dCompressiveStressLimit_Y", sMaterialPropertiesData.m_sOrthotropic3D.m_dCompressiveStressLimit_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dShearStressLimit_XY", sMaterialPropertiesData.m_sOrthotropic3D.m_dShearStressLimit_XY);
|
|
xmlphysics->SetDoubleAttribute("m_dShearStressLimit_XZ", sMaterialPropertiesData.m_sOrthotropic3D.m_dShearStressLimit_XZ);
|
|
xmlphysics->SetDoubleAttribute("m_dShearStressLimit_YZ", sMaterialPropertiesData.m_sOrthotropic3D.m_dShearStressLimit_YZ);
|
|
break;
|
|
|
|
case A3DPhysicType_Anisotropic:
|
|
xmlphysics = new _TiXmlElement("A3DMiscMaterialAnisotropicData");
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_XX", sMaterialPropertiesData.m_sAnisotropic.m_dShearModulus_XX);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_XY", sMaterialPropertiesData.m_sAnisotropic.m_dShearModulus_XY);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_XZ", sMaterialPropertiesData.m_sAnisotropic.m_dShearModulus_XZ);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_YY", sMaterialPropertiesData.m_sAnisotropic.m_dShearModulus_YY);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_YZ", sMaterialPropertiesData.m_sAnisotropic.m_dShearModulus_YZ);
|
|
xmlphysics->SetDoubleAttribute("m_dShearModulus_ZZ", sMaterialPropertiesData.m_sAnisotropic.m_dShearModulus_ZZ);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion_X", sMaterialPropertiesData.m_sAnisotropic.m_dThermalExpansion_X);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion_Y", sMaterialPropertiesData.m_sAnisotropic.m_dThermalExpansion_Y);
|
|
xmlphysics->SetDoubleAttribute("m_dThermalExpansion_Z", sMaterialPropertiesData.m_sAnisotropic.m_dThermalExpansion_Z);
|
|
xmlphysics->SetDoubleAttribute("m_dTensileStressLimit", sMaterialPropertiesData.m_sAnisotropic.m_dTensileStressLimit);
|
|
xmlphysics->SetDoubleAttribute("m_dCompressiveStressLimit", sMaterialPropertiesData.m_sAnisotropic.m_dCompressiveStressLimit);
|
|
xmlphysics->SetDoubleAttribute("m_dShearStressLimit", sMaterialPropertiesData.m_sAnisotropic.m_dShearStressLimit);
|
|
break;
|
|
|
|
case A3DPhysicType_None:
|
|
default:
|
|
break;
|
|
}
|
|
|
|
if(xmlphysics)
|
|
xml->LinkEndChild(xmlphysics);
|
|
|
|
A3DMiscGetMaterialProperties(NULL, &sMaterialPropertiesData);
|
|
}
|
|
|
|
xmlfather->LinkEndChild(xml);
|
|
return A3D_SUCCESS;
|
|
}
|
|
|
|
|
|
//######################################################################################################################
|
|
A3DStatus traverseLayer(A3DAsmLayerEntity* pLayer, _TiXmlElement* setting)
|
|
{
|
|
A3DStatus iRet = A3D_SUCCESS;
|
|
|
|
if (pLayer)
|
|
{
|
|
A3DAsmLayerEntityData oData;
|
|
A3D_INITIALIZE_DATA(A3DAsmLayerEntityData, oData);
|
|
iRet = A3DAsmLayerEntityGet(pLayer, &oData);
|
|
|
|
_TiXmlElement* layer = new _TiXmlElement("Layer");
|
|
if (iRet == A3D_SUCCESS)
|
|
{
|
|
layer->SetAttribute("Name", oData.m_pcLayerName ? oData.m_pcLayerName : "null");
|
|
layer->SetAttribute("LayerID", oData.m_uiLayerID);
|
|
if (oData.m_pcNote)
|
|
layer->SetAttribute("Note", oData.m_pcNote);
|
|
switch (oData.m_eDisplayStatus)
|
|
{
|
|
case kA3DLayerDisplayShow:
|
|
layer->SetAttribute("DisplayStatus", "Show");
|
|
break;
|
|
case kA3DLayerDisplayHide:
|
|
layer->SetAttribute("DisplayStatus", "Hide");
|
|
break;
|
|
case kA3DLayerDisplayIsolate:
|
|
layer->SetAttribute("DisplayStatus", "Isolate");
|
|
break;
|
|
case kA3DLayerDisplayUnknown:
|
|
layer->SetAttribute("DisplayStatus", "Unknown");
|
|
break;
|
|
}
|
|
if (oData.m_uiReferenceEntitiesSize != 0)
|
|
{
|
|
_TiXmlElement* Reference = new _TiXmlElement("ReferenceEntities");
|
|
for (A3DUns32 j = 0; j < oData.m_uiReferenceEntitiesSize; ++j)
|
|
{
|
|
traverseEntityReference(oData.m_ppReferenceEntities[j], Reference);
|
|
}
|
|
layer->LinkEndChild(Reference);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
layer->SetAttribute("error", A3DMiscGetErrorMsg(iRet));
|
|
}
|
|
setting->LinkEndChild(layer);
|
|
A3DAsmLayerEntityGet(NULL, &oData);
|
|
}
|
|
return iRet;
|
|
}
|
|
|
|
//######################################################################################################################
|
|
A3DStatus traverseLayers(A3DUns32 uiSize, A3DAsmLayerEntity** ppLayers, _TiXmlElement* setting)
|
|
{
|
|
for (A3DUns32 ui = 0; ui < uiSize; ++ui)
|
|
traverseLayer(ppLayers[ui], setting);
|
|
return A3D_SUCCESS;
|
|
}
|
|
|
|
//######################################################################################################################
|
|
static A3DStatus stTraversePartDef(const A3DAsmPartDefinition* pPart, _TiXmlElement* xmlfather)
|
|
{
|
|
A3DStatus iRet = A3D_SUCCESS;
|
|
A3DAsmPartDefinitionData sData;
|
|
A3D_INITIALIZE_DATA(A3DAsmPartDefinitionData, sData);
|
|
|
|
_TiXmlElement* part = new _TiXmlElement("A3DAsmPartDefinitionData");
|
|
setAttributePRC2XMLID(pPart, part);
|
|
traverseSource(pPart, part);
|
|
|
|
iRet = A3DAsmPartDefinitionGet(pPart, &sData);
|
|
if(iRet == A3D_SUCCESS)
|
|
{
|
|
A3DUns32 ui;
|
|
part->SetAttribute("m_bInactivateAnnotations", sData.m_bInactivateAnnotations ? "true" : "false");
|
|
|
|
iRet = traverseBoundingBox(&sData.m_sBoundingBox, part);
|
|
|
|
for(ui = 0; ui < sData.m_uiAnnotationsSize; ++ui)
|
|
traverseAnnotation(sData.m_ppAnnotations[ui], part);
|
|
|
|
for(ui = 0; ui < sData.m_uiViewsSize; ++ui)
|
|
traverseView(sData.m_ppViews[ui], part);
|
|
|
|
for(ui = 0; ui < sData.m_uiRepItemsSize; ++ui)
|
|
traverseRepItem(sData.m_ppRepItems[ui], part);
|
|
|
|
// traverse the drawing !!!!!!!
|
|
for (ui = 0; ui < sData.m_uiDrawingModelsSize; ++ui)
|
|
traverseDrawing(sData.m_ppDrawingModels[ui], part);
|
|
|
|
A3DAsmPartDefinitionGet(NULL, &sData);
|
|
}
|
|
else
|
|
{
|
|
part->SetAttribute("error", A3DMiscGetErrorMsg(iRet));
|
|
}
|
|
|
|
traverseMaterialProperties(pPart, part);
|
|
xmlfather->LinkEndChild(part);
|
|
return A3D_SUCCESS;
|
|
}
|
|
|
|
//######################################################################################################################
|
|
static A3DStatus stTraverseFilter(const A3DAsmFilter* pFilter, _TiXmlElement* setting)
|
|
{
|
|
A3DStatus iRet = A3D_SUCCESS;
|
|
A3DAsmFilterData sData;
|
|
A3D_INITIALIZE_DATA(A3DAsmFilterData, sData);
|
|
|
|
_TiXmlElement* filter = new _TiXmlElement("A3DAsmFilterData");
|
|
traverseSource(pFilter, filter);
|
|
|
|
iRet = A3DAsmFilterGet(pFilter, &sData);
|
|
if(iRet == A3D_SUCCESS)
|
|
{
|
|
filter->SetAttribute("active", (int) sData.m_bIsActive);
|
|
A3DAsmFilterGet(NULL, &sData);
|
|
}
|
|
else
|
|
{
|
|
filter->SetAttribute("error", A3DMiscGetErrorMsg(iRet));
|
|
}
|
|
|
|
setting->LinkEndChild(filter);
|
|
return iRet;
|
|
}
|
|
|
|
//######################################################################################################################
|
|
static A3DStatus stTraverseUg(const A3DAsmProductOccurrence* pOccurrence, _TiXmlElement* occurrence)
|
|
{
|
|
A3DAsmProductOccurrenceDataUg sDataUg;
|
|
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceDataUg, sDataUg);
|
|
A3DStatus const iRet = A3DAsmProductOccurrenceGetUg(pOccurrence, &sDataUg);
|
|
if (iRet == A3D_SUCCESS)
|
|
{
|
|
_TiXmlElement* occurrencedataug = new _TiXmlElement("A3DAsmProductOccurrenceDataUg");
|
|
|
|
occurrencedataug->SetAttribute("m_psRootFilePath", sDataUg.m_psRootFilePath ? sDataUg.m_psRootFilePath : "NULL");
|
|
occurrencedataug->SetAttribute("m_psFileName", sDataUg.m_psFileName ? sDataUg.m_psFileName : "NULL");
|
|
occurrencedataug->SetAttribute("m_psRefSet", sDataUg.m_psRefSet ? sDataUg.m_psRefSet : "NULL");
|
|
occurrencedataug->SetAttribute("m_psPartUID", sDataUg.m_psPartUID ? sDataUg.m_psPartUID : "NULL");
|
|
occurrencedataug->SetAttribute("m_psInstanceFileName", sDataUg.m_psInstanceFileName ? sDataUg.m_psInstanceFileName : "NULL");
|
|
occurrencedataug->SetAttribute("m_uiInstanceTag", sDataUg.m_uiInstanceTag);
|
|
|
|
// Process RefSets
|
|
if (sDataUg.m_uiChildrenByRefsetsSize || sDataUg.m_uiSolidsByRefsetsSize)
|
|
{
|
|
_TiXmlElement* refsetList = new _TiXmlElement("RefSets");
|
|
|
|
// Children by RefSet
|
|
for (A3DUns32 iRefSet = 0; iRefSet < sDataUg.m_uiChildrenByRefsetsSize; ++iRefSet)
|
|
{
|
|
const A3DElementsByRefsetUg &pRefsetData = sDataUg.m_asChildrenByRefsets[iRefSet];
|
|
|
|
// Init XML Element if first occurrence
|
|
_TiXmlElement* refset = new _TiXmlElement("RefSet");
|
|
refset->SetAttribute("Name", pRefsetData.m_psRefset);
|
|
|
|
// Add children
|
|
for (A3DUns32 i = 0; i < pRefsetData.m_uiElementsSize; ++i)
|
|
{
|
|
_TiXmlElement * refsetChild = new _TiXmlElement("Child");
|
|
refsetChild->SetAttribute("id", pRefsetData.m_auiElements[i]);
|
|
refset->LinkEndChild(refsetChild);
|
|
}
|
|
|
|
refsetList->LinkEndChild(refset);
|
|
}
|
|
|
|
// Solids by RefSet
|
|
for (A3DUns32 iRefSet = 0; iRefSet < sDataUg.m_uiSolidsByRefsetsSize; ++iRefSet)
|
|
{
|
|
const A3DElementsByRefsetUg &pRefsetData = sDataUg.m_asSolidsByRefsets[iRefSet];
|
|
|
|
// Init XML Element if first occurrence
|
|
_TiXmlElement* refset = new _TiXmlElement("RefSet");
|
|
refset->SetAttribute("Name", pRefsetData.m_psRefset);
|
|
|
|
// Add Solids
|
|
for (A3DUns32 i = 0; i < pRefsetData.m_uiElementsSize; ++i)
|
|
{
|
|
_TiXmlElement * refsetChild = new _TiXmlElement("Solid");
|
|
refsetChild->SetAttribute("id", pRefsetData.m_auiElements[i]);
|
|
refset->LinkEndChild(refsetChild);
|
|
}
|
|
|
|
refsetList->LinkEndChild(refset);
|
|
}
|
|
|
|
occurrencedataug->LinkEndChild(refsetList);
|
|
}
|
|
|
|
occurrence->LinkEndChild(occurrencedataug);
|
|
|
|
CHECK_RET(A3DAsmProductOccurrenceGetUg(NULL, &sDataUg));
|
|
}
|
|
|
|
return iRet;
|
|
}
|
|
|
|
//######################################################################################################################
|
|
static void stTraverseSLWType(A3DEProductOccurrenceTypeSLW usType, _TiXmlElement* occurrencedataslw)
|
|
{
|
|
const A3DUTF8Char* psType = nullptr;
|
|
switch (usType)
|
|
{
|
|
case A3DEProductOccurrenceTypeSLW_ContainerTess:
|
|
{
|
|
psType = "A3DEProductOccurrenceTypeSLW_ContainerTess";
|
|
break;
|
|
}
|
|
case A3DEProductOccurrenceTypeSLW_Container:
|
|
{
|
|
psType = "A3DEProductOccurrenceTypeSLW_Container";
|
|
break;
|
|
}
|
|
case A3DEProductOccurrenceTypeSLW_Part:
|
|
{
|
|
psType = "A3DEProductOccurrenceTypeSLW_Part";
|
|
break;
|
|
}
|
|
case A3DEProductOccurrenceTypeSLW_Assembly:
|
|
{
|
|
psType = "A3DEProductOccurrenceTypeSLW_Assembly";
|
|
break;
|
|
}
|
|
case A3DEProductOccurrenceTypeSLW_Drawing:
|
|
{
|
|
psType = "A3DEProductOccurrenceTypeSLW_Drawing";
|
|
break;
|
|
}
|
|
case A3DEProductOccurrenceTypeSLW_Unknown:
|
|
{
|
|
psType = "A3DEProductOccurrenceTypeSLW_Unknown";
|
|
break;
|
|
}
|
|
case A3DEProductOccurrenceTypeSLW_PartTesselated:
|
|
{
|
|
psType = "A3DEProductOccurrenceTypeSLW_PartTesselated";
|
|
break;
|
|
}
|
|
case A3DEProductOccurrenceTypeSLW_AssemblyTesselated:
|
|
{
|
|
psType = "A3DEProductOccurrenceTypeSLW_AssemblyTesselated";
|
|
break;
|
|
}
|
|
case A3DEProductOccurrenceTypeSLW_StandalonePart:
|
|
{
|
|
psType = "A3DEProductOccurrenceTypeSLW_StandalonePart";
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
occurrencedataslw->SetAttribute("m_usType", psType ? psType : "NULL");
|
|
}
|
|
|
|
//######################################################################################################################
|
|
static void stTraverseSLWAttachment(A3DUns32 usSize, A3DAsmAttachmentsInfosSLW* pAttachments, _TiXmlElement* occurrencedataslw)
|
|
{
|
|
_TiXmlElement* attachmentList = new _TiXmlElement("Attachments");
|
|
for (A3DUns32 iAttachment = 0; iAttachment < usSize; ++iAttachment)
|
|
{
|
|
_TiXmlElement* attachment = new _TiXmlElement("Attachment");
|
|
|
|
A3DAsmAttachmentsInfosSLW sCurrentAttachment = pAttachments[iAttachment];
|
|
attachment->SetAttribute("m_iConfigID", sCurrentAttachment.m_iConfigID);
|
|
attachment->SetAttribute("m_psReplacedFilePath", sCurrentAttachment.m_psReplacedFilePath ? sCurrentAttachment.m_psReplacedFilePath : "NULL");
|
|
|
|
std::string sCurrentAttachmentPath("[");
|
|
for (A3DUns32 iPathInAssemblyTree = 0; iPathInAssemblyTree < sCurrentAttachment.m_uiPathsInAssemblyTreeSize; ++iPathInAssemblyTree)
|
|
{
|
|
sCurrentAttachmentPath += sCurrentAttachment.m_ppsPathsInAssemblyTree[iPathInAssemblyTree];
|
|
if (iPathInAssemblyTree != sCurrentAttachment.m_uiPathsInAssemblyTreeSize - 1)
|
|
sCurrentAttachmentPath += ", ";
|
|
}
|
|
sCurrentAttachmentPath += "]";
|
|
|
|
attachment->SetAttribute("PathsInAssemblyTree", !sCurrentAttachmentPath.empty() ? sCurrentAttachmentPath.c_str() : "NULL");
|
|
|
|
|
|
attachmentList->LinkEndChild(attachment);
|
|
}
|
|
|
|
occurrencedataslw->LinkEndChild(attachmentList);
|
|
}
|
|
|
|
//######################################################################################################################
|
|
static A3DStatus stTraverseSLW(const A3DAsmProductOccurrence* pOccurrence, _TiXmlElement* occurrence)
|
|
{
|
|
A3DAsmProductOccurrenceDataSLW sDataSLW;
|
|
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceDataSLW, sDataSLW);
|
|
A3DStatus const iRet = A3DAsmProductOccurrenceGetSLW(pOccurrence, &sDataSLW);
|
|
if (iRet == A3D_SUCCESS)
|
|
{
|
|
_TiXmlElement* occurrencedataslw = new _TiXmlElement("A3DAsmProductOccurrenceDataSlw");
|
|
|
|
occurrencedataslw->SetAttribute("m_psNodeSlwID", sDataSLW.m_psNodeSlwID ? sDataSLW.m_psNodeSlwID : "NULL");
|
|
occurrencedataslw->SetAttribute("m_iIndexCfg", sDataSLW.m_iIndexCfg);
|
|
occurrencedataslw->SetAttribute("m_psCfgName", sDataSLW.m_psCfgName ? sDataSLW.m_psCfgName : "NULL");
|
|
|
|
stTraverseSLWType(sDataSLW.m_usType, occurrencedataslw);
|
|
|
|
if (sDataSLW.m_uiAttachementsSize)
|
|
{
|
|
stTraverseSLWAttachment(sDataSLW.m_uiAttachementsSize, sDataSLW.m_psAttachements, occurrencedataslw);
|
|
}
|
|
|
|
occurrence->LinkEndChild(occurrencedataslw);
|
|
|
|
CHECK_RET(A3DAsmProductOccurrenceGetSLW(NULL, &sDataSLW));
|
|
}
|
|
|
|
return iRet;
|
|
}
|
|
|
|
//######################################################################################################################
|
|
A3DStatus traverseEntityReference(const A3DMiscEntityReference* pEntityReference, _TiXmlElement* setting)
|
|
{
|
|
A3DStatus iRet = A3D_SUCCESS;
|
|
A3DMiscEntityReferenceData sData;
|
|
A3D_INITIALIZE_DATA(A3DMiscEntityReferenceData, sData);
|
|
|
|
_TiXmlElement* entityreference = new _TiXmlElement("A3DMiscEntityReferenceData");
|
|
traverseSource(pEntityReference, entityreference);
|
|
|
|
iRet = A3DMiscEntityReferenceGet(pEntityReference, &sData);
|
|
if (iRet != A3D_SUCCESS || sData.m_pEntity == NULL)
|
|
{
|
|
entityreference->SetAttribute("error", sData.m_pEntity ? A3DMiscGetErrorMsg(iRet) : A3DMiscGetErrorMsg(A3D_INVALID_ENTITY_NULL));
|
|
setting->LinkEndChild(entityreference);
|
|
return iRet;
|
|
}
|
|
_TiXmlElement* entity = new _TiXmlElement("m_pEntity");
|
|
setAttributePRC2XMLID(sData.m_pEntity, entity);
|
|
entityreference->LinkEndChild(entity);
|
|
|
|
if (sData.m_pCoordinateSystem != NULL)
|
|
iRet = traverseCSys(sData.m_pCoordinateSystem, entityreference);
|
|
|
|
A3DEEntityType eType = kA3DTypeUnknown;
|
|
iRet = A3DEntityGetType(sData.m_pEntity, &eType);
|
|
if (iRet != A3D_SUCCESS)
|
|
{
|
|
entityreference->SetAttribute("error_A3DEntityGetType", iRet);
|
|
setting->LinkEndChild(entityreference);
|
|
return iRet;
|
|
}
|
|
|
|
if (eType == kA3DTypeMiscReferenceOnTopology)
|
|
{
|
|
A3DMiscReferenceOnTopologyData sReferenceOnTopologyData;
|
|
A3D_INITIALIZE_DATA(A3DMiscReferenceOnTopologyData, sReferenceOnTopologyData);
|
|
if(A3DMiscReferenceOnTopologyGet((A3DMiscReferenceOnTopology*) sData.m_pEntity, &sReferenceOnTopologyData) != A3D_SUCCESS)
|
|
{
|
|
entityreference->SetAttribute("error_A3DMiscReferenceOnTopologyGet", iRet);
|
|
setting->LinkEndChild(entityreference);
|
|
return iRet;
|
|
}
|
|
if (sReferenceOnTopologyData.m_pBrepData)
|
|
{
|
|
setAttributePRC2XMLID(sReferenceOnTopologyData.m_pBrepData, entity);
|
|
}
|
|
|
|
switch(sReferenceOnTopologyData.m_eTopoItemType)
|
|
{
|
|
case kA3DTypeTopoEdge:
|
|
entityreference->SetAttribute("topotype", "Edge");
|
|
if(sReferenceOnTopologyData.m_uiSize != 3)
|
|
{
|
|
entityreference->SetAttribute("ref_count", "error");
|
|
break;
|
|
}
|
|
entityreference->SetAttribute("face_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[0]);
|
|
entityreference->SetAttribute("loop_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[1]);
|
|
entityreference->SetAttribute("edge_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[2]);
|
|
break;
|
|
case kA3DTypeTopoCoEdge:
|
|
entityreference->SetAttribute("topotype", "CoEdge");
|
|
if(sReferenceOnTopologyData.m_uiSize != 3)
|
|
{
|
|
entityreference->SetAttribute("ref_count", "error");
|
|
break;
|
|
}
|
|
entityreference->SetAttribute("face_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[0]);
|
|
entityreference->SetAttribute("loop_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[1]);
|
|
entityreference->SetAttribute("coedge_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[2]);
|
|
break;
|
|
case kA3DTypeTopoFace:
|
|
entityreference->SetAttribute("topotype", "Face");
|
|
if(sReferenceOnTopologyData.m_uiSize != 1)
|
|
{
|
|
entityreference->SetAttribute("ref_count", "error");
|
|
break;
|
|
}
|
|
entityreference->SetAttribute("face_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[0]);
|
|
break;
|
|
case kA3DTypeTopoUniqueVertex:
|
|
entityreference->SetAttribute("topotype", "Unique Vertex");
|
|
if(sReferenceOnTopologyData.m_uiSize != 4)
|
|
{
|
|
entityreference->SetAttribute("ref_count", "error");
|
|
break;
|
|
}
|
|
entityreference->SetAttribute("face_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[0]);
|
|
entityreference->SetAttribute("loop_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[1]);
|
|
entityreference->SetAttribute("edge_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[2]);
|
|
entityreference->SetAttribute("vertex_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[3]);
|
|
break;
|
|
case kA3DTypeTopoMultipleVertex:
|
|
entityreference->SetAttribute("topotype", "Multiple Vertex");
|
|
if(sReferenceOnTopologyData.m_uiSize%3 != 0)
|
|
{
|
|
entityreference->SetAttribute("ref_count", "error");
|
|
break;
|
|
}
|
|
entityreference->SetAttribute("ref_count", "todo");
|
|
entityreference->SetAttribute("face_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[0]);
|
|
entityreference->SetAttribute("loop_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[1]);
|
|
entityreference->SetAttribute("edge_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[2]);
|
|
entityreference->SetAttribute("vertex_indice", sReferenceOnTopologyData.m_puiAdditionalIndexes[3]);
|
|
break;
|
|
default:
|
|
entityreference->SetAttribute("linked_item_topo_reference", "unexpected");
|
|
break;
|
|
}
|
|
A3DMiscReferenceOnTopologyGet(nullptr, &sReferenceOnTopologyData);
|
|
}
|
|
else if(eType == kA3DTypeMiscReferenceOnCsysItem)
|
|
{
|
|
A3DMiscReferenceOnCsysItemData sA3DMiscReferenceOnCSYSITemData;
|
|
A3D_INITIALIZE_DATA(A3DMiscReferenceOnCsysItemData, sA3DMiscReferenceOnCSYSITemData);
|
|
iRet = A3DMiscReferenceOnCsysItemGet(sData.m_pEntity, &sA3DMiscReferenceOnCSYSITemData);
|
|
if(iRet!=A3D_SUCCESS || !sA3DMiscReferenceOnCSYSITemData.m_pCoordinateSystem)
|
|
{
|
|
entityreference->SetAttribute("error_A3DMiscReferenceOnCsysItemGet",
|
|
sA3DMiscReferenceOnCSYSITemData.m_pCoordinateSystem ? A3DMiscGetErrorMsg(iRet) : A3DMiscGetErrorMsg(A3D_INVALID_ENTITY_NULL));
|
|
setting->LinkEndChild(entityreference);
|
|
A3DMiscReferenceOnCsysItemGet(nullptr, &sA3DMiscReferenceOnCSYSITemData);
|
|
return iRet;
|
|
}
|
|
A3DRootBaseData sCSYSRootData;
|
|
A3D_INITIALIZE_DATA(A3DRootBaseData, sCSYSRootData);
|
|
if( A3DRootBaseGet(sA3DMiscReferenceOnCSYSITemData.m_pCoordinateSystem, &sCSYSRootData)== A3D_SUCCESS)
|
|
{
|
|
entityreference->SetAttribute("cys_name", (sCSYSRootData.m_pcName && sCSYSRootData.m_pcName[0] != '\0')?sCSYSRootData.m_pcName:"NULL");
|
|
entityreference->SetAttribute("index", sA3DMiscReferenceOnCSYSITemData.m_uiIndex);
|
|
}
|
|
A3DMiscReferenceOnCsysItemGet(nullptr, &sA3DMiscReferenceOnCSYSITemData);
|
|
}
|
|
else
|
|
{
|
|
A3DRootBaseData sBaseData;
|
|
A3D_INITIALIZE_DATA(A3DRootBaseData, sBaseData);
|
|
iRet = A3DRootBaseGet(sData.m_pEntity,&sBaseData);
|
|
if(iRet == A3D_SUCCESS)
|
|
{
|
|
if(sBaseData.m_pcName && sBaseData.m_pcName[0] != '\0')
|
|
entityreference->SetAttribute("name", sBaseData.m_pcName);
|
|
A3DRootBaseGet(NULL,&sBaseData);
|
|
}
|
|
|
|
if (eType == kA3DTypeRiPolyBrepModel)
|
|
{
|
|
A3DMiscReferenceOnTessData sReferenceOnTessData;
|
|
A3D_INITIALIZE_DATA(A3DMiscReferenceOnTessData, sReferenceOnTessData);
|
|
if (A3DMiscReferenceOnTessGet(pEntityReference, &sReferenceOnTessData) == A3D_SUCCESS)
|
|
{
|
|
if (sReferenceOnTessData.m_pPolyBrepModel)
|
|
{
|
|
setAttributePRC2XMLID(sReferenceOnTessData.m_pPolyBrepModel, entity);
|
|
}
|
|
|
|
switch(sReferenceOnTessData.m_eTopoItemType)
|
|
{
|
|
case kA3DTypeTessFace:
|
|
entityreference->SetAttribute("topotype", "Face");
|
|
if (sReferenceOnTessData.m_uiSize == 0)
|
|
entityreference->SetAttribute("ref_count", "error");
|
|
|
|
for (A3DUns32 iFace=0;iFace<sReferenceOnTessData.m_uiSize;iFace++)
|
|
entityreference->SetAttribute("face_indice", sReferenceOnTessData.m_puiAdditionalIndexes[iFace]);
|
|
break;
|
|
case kA3DTypeTessEdge:
|
|
entityreference->SetAttribute("topotype", "Edge");
|
|
if (sReferenceOnTessData.m_uiSize != 3)
|
|
entityreference->SetAttribute("ref_count", "error");
|
|
else
|
|
{
|
|
entityreference->SetAttribute("face_indice", sReferenceOnTessData.m_puiAdditionalIndexes[0]);
|
|
entityreference->SetAttribute("loop_indice", sReferenceOnTessData.m_puiAdditionalIndexes[1]);
|
|
entityreference->SetAttribute("edge_indice", sReferenceOnTessData.m_puiAdditionalIndexes[2]);
|
|
}
|
|
break;
|
|
case kA3DTypeTessVertex:
|
|
entityreference->SetAttribute("topotype", "Vertex");
|
|
if (sReferenceOnTessData.m_uiSize != 4)
|
|
entityreference->SetAttribute("ref_count", "error");
|
|
else
|
|
{
|
|
entityreference->SetAttribute("face_indice" , sReferenceOnTessData.m_puiAdditionalIndexes[0]);
|
|
entityreference->SetAttribute("loop_indice" , sReferenceOnTessData.m_puiAdditionalIndexes[1]);
|
|
entityreference->SetAttribute("edge_indice" , sReferenceOnTessData.m_puiAdditionalIndexes[2]);
|
|
entityreference->SetAttribute("vertex_indice", sReferenceOnTessData.m_puiAdditionalIndexes[3]);
|
|
}
|
|
break;
|
|
default: break;
|
|
}
|
|
|
|
A3DMiscReferenceOnTessGet(NULL, &sReferenceOnTessData);
|
|
}
|
|
}
|
|
else if(eType == kA3DTypeRiPlane)
|
|
{
|
|
A3DMiscMarkupLinkedItem* pLinkedItem = NULL;
|
|
A3DRiPlaneSupportGet((const A3DRiPlane*) sData.m_pEntity, &pLinkedItem);
|
|
if( pLinkedItem)
|
|
{
|
|
_TiXmlElement* entityreferencesupport = new _TiXmlElement("SUPPORT");
|
|
entityreference->LinkEndChild(entityreferencesupport);
|
|
traverseEntityReference(pLinkedItem, entityreferencesupport);
|
|
}
|
|
}
|
|
else if(eType == kA3DTypeRiCurve)
|
|
{
|
|
A3DMiscMarkupLinkedItem* pLinkedItem = NULL;
|
|
A3DRiCurveSupportGet((const A3DRiCurve*) sData.m_pEntity, &pLinkedItem);
|
|
if( pLinkedItem)
|
|
{
|
|
_TiXmlElement* entityreferencesupport = new _TiXmlElement("SUPPORT");
|
|
entityreference->LinkEndChild(entityreferencesupport);
|
|
traverseEntityReference(pLinkedItem, entityreferencesupport);
|
|
}
|
|
}
|
|
}
|
|
A3DMiscEntityReferenceGet(NULL, &sData);
|
|
|
|
setting->LinkEndChild(entityreference);
|
|
return iRet;
|
|
}
|
|
|
|
//######################################################################################################################
|
|
static A3DStatus traverseMaterialAndVis(const A3DMaterialAndVisualisationInfos& oMatVis, _TiXmlElement* setting)
|
|
{
|
|
setting->SetAttribute("m_bIsSuppressed", oMatVis.m_bIsSuppressed);
|
|
setting->SetAttribute("m_usLayer", oMatVis.m_usLayer);
|
|
setting->SetAttribute("m_usBehaviour", oMatVis.m_usBehaviour);
|
|
setting->SetAttribute("m_ucType", oMatVis.m_ucType);
|
|
|
|
for (A3DUns32 i = 0; i < oMatVis.m_uiPathInAssemblyTreeSize; i++)
|
|
{
|
|
A3DUTF8Char* acValue = oMatVis.m_ppPathInAssemblyTree[i];
|
|
char acBuffer[32];
|
|
sprintf(acBuffer, "m_ppPathInAssemblyTree_%d", i);
|
|
|
|
setting->SetAttribute(acBuffer, acValue ? acValue : "");
|
|
}
|
|
|
|
if (oMatVis.m_pMaterial)
|
|
traverseMaterial(*oMatVis.m_pMaterial, setting);
|
|
|
|
if (oMatVis.m_pTransform)
|
|
traverseCartesianTransformationData(*oMatVis.m_pTransform, setting);
|
|
|
|
return A3D_SUCCESS;
|
|
}
|
|
|
|
//######################################################################################################################
|
|
static A3DStatus stTraversePOccurrence(const A3DAsmProductOccurrence* pOccurrence, _TiXmlElement* setting)
|
|
{
|
|
A3DStatus iRet = A3D_SUCCESS;
|
|
A3DAsmProductOccurrenceData sData;
|
|
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sData);
|
|
|
|
_TiXmlElement* occurrence = new _TiXmlElement("A3DAsmProductOccurrenceData");
|
|
static std::set<const A3DAsmProductOccurrence*> occurrenceSet;
|
|
|
|
occurrenceSet.emplace(pOccurrence);
|
|
setAttributePRC2XMLID(pOccurrence, occurrence);
|
|
traverseSource(pOccurrence, occurrence);
|
|
|
|
A3DRootBaseData sRootBaseData;
|
|
A3D_INITIALIZE_DATA(A3DRootBaseData, sRootBaseData);
|
|
iRet = A3DRootBaseGet(pOccurrence, &sRootBaseData);
|
|
|
|
if (iRet == A3D_SUCCESS)
|
|
{
|
|
if (sRootBaseData.m_pcName && sRootBaseData.m_pcName[0] != '\0')
|
|
occurrence->SetAttribute("m_pcName", sRootBaseData.m_pcName);
|
|
|
|
A3DRootBaseGet(NULL, &sRootBaseData);
|
|
}
|
|
|
|
iRet = A3DAsmProductOccurrenceGet(pOccurrence, &sData);
|
|
if (iRet == A3D_SUCCESS)
|
|
{
|
|
A3DUns32 ui;
|
|
|
|
occurrence->SetAttribute("m_ucBehaviour", (int)(sData.m_ucBehaviour));
|
|
occurrence->SetAttribute("m_eProductLoadStatus", (int)(sData.m_eProductLoadStatus));
|
|
|
|
occurrence->SetAttribute("m_uiProductFlags", (int)(sData.m_uiProductFlags));
|
|
occurrence->SetAttribute("m_bUnitFromCAD", (int)(sData.m_bUnitFromCAD));
|
|
occurrence->SetDoubleAttribute("m_dUnit", (double)(sData.m_dUnit));
|
|
occurrence->SetDoubleAttribute("m_dDensityVolumeUnit", sData.m_dDensityVolumeUnit);
|
|
occurrence->SetDoubleAttribute("m_dDensityMassUnit", sData.m_dDensityMassUnit);
|
|
occurrence->SetAttribute("m_eModellerType", sData.m_eModellerType);
|
|
occurrence->SetAttribute("m_bInactivateAnnotations", sData.m_bInactivateAnnotations ? "true" : "false");
|
|
|
|
traverseTransformation(sData.m_pLocation, occurrence);
|
|
|
|
if (sData.m_uiDisplayFilterSize && sData.m_ppDisplayFilters)
|
|
{
|
|
_TiXmlElement* displayfilters = new _TiXmlElement("DisplayFilters");
|
|
traverseDisplayFilters(sData.m_uiDisplayFilterSize, sData.m_ppDisplayFilters, displayfilters);
|
|
occurrence->LinkEndChild(displayfilters);
|
|
}
|
|
|
|
if (sData.m_uiLayersSize && sData.m_ppLayers)
|
|
{
|
|
_TiXmlElement* layers = new _TiXmlElement("Layers");
|
|
traverseLayers(sData.m_uiLayersSize, sData.m_ppLayers, layers);
|
|
occurrence->LinkEndChild(layers);
|
|
}
|
|
|
|
if (sData.m_pPrototype)
|
|
{
|
|
_TiXmlElement* occurrenceproto = new _TiXmlElement("m_pPrototype");
|
|
setAttributePRC2XMLID(sData.m_pPrototype, occurrenceproto);
|
|
if (occurrenceSet.find(sData.m_pPrototype) == occurrenceSet.end())
|
|
stTraversePOccurrence(sData.m_pPrototype, occurrenceproto); // recurse only if not already treated (i.e not already inserted)
|
|
|
|
occurrence->LinkEndChild(occurrenceproto);
|
|
}
|
|
//else // this is commented but beware http://docs.techsoft3d.com/exchange/latest/build/group__a3d__productoccurrence.html#ga497615eb89393c2aba37cce2e2323f4d
|
|
{
|
|
A3DUTF8Char* mPOPath = NULL;
|
|
|
|
iRet = A3DAsmProductOccurrenceGetFilePathName(pOccurrence, &mPOPath);
|
|
if (iRet == A3D_SUCCESS)
|
|
occurrence->SetAttribute("A3DAsmProductOccurrenceGetFilePathName", mPOPath != NULL ? mPOPath : "");
|
|
else
|
|
occurrence->SetAttribute("A3DAsmProductOccurrenceGetFilePathName", iRet);
|
|
A3DAsmProductOccurrenceGetFilePathName(NULL, &mPOPath);
|
|
|
|
mPOPath = NULL;
|
|
iRet = A3DAsmProductOccurrenceGetOriginalFilePathName(pOccurrence, &mPOPath);
|
|
if (iRet == A3D_SUCCESS)
|
|
occurrence->SetAttribute("A3DAsmProductOccurrenceGetOriginalFilePathName", mPOPath != NULL ? mPOPath : "");
|
|
else
|
|
occurrence->SetAttribute("A3DAsmProductOccurrenceGetOriginalFilePathName", iRet);
|
|
A3DAsmProductOccurrenceGetOriginalFilePathName(NULL, &mPOPath);
|
|
}
|
|
|
|
if (sData.m_pExternalData)
|
|
{
|
|
_TiXmlElement* occurrenceexternaldata = new _TiXmlElement("m_pExternalData");
|
|
setAttributePRC2XMLID(sData.m_pExternalData, occurrenceexternaldata);
|
|
if (occurrenceSet.find(sData.m_pExternalData) == occurrenceSet.end())
|
|
stTraversePOccurrence(sData.m_pExternalData, occurrenceexternaldata); // recurse only if not already treated (i.e not already inserted)
|
|
|
|
occurrence->LinkEndChild(occurrenceexternaldata);
|
|
}
|
|
|
|
for (ui = 0; ui < sData.m_uiPOccurrencesSize; ++ui)
|
|
stTraversePOccurrence(sData.m_ppPOccurrences[ui], occurrence);
|
|
|
|
for (ui = 0; ui < sData.m_uiEntityReferenceSize; ++ui)
|
|
traverseEntityReference(sData.m_ppEntityReferences[ui], occurrence);
|
|
|
|
for (ui = 0; ui < sData.m_uiAnnotationsSize; ++ui)
|
|
traverseAnnotation(sData.m_ppAnnotations[ui], occurrence);
|
|
|
|
for (ui = 0; ui < sData.m_uiSceneDisplayParameterSize; ++ui)
|
|
traverseGraphScene(sData.m_psSceneDisplayParameters[ui], occurrence);
|
|
|
|
for (ui = 0; ui < sData.m_uiViewsSize; ++ui)
|
|
traverseView(sData.m_ppViews[ui], occurrence);
|
|
|
|
if (sData.m_pPart)
|
|
stTraversePartDef(sData.m_pPart, occurrence);
|
|
|
|
if (sData.m_pEntityFilter)
|
|
stTraverseFilter(sData.m_pEntityFilter, occurrence);
|
|
|
|
for (ui = 0; ui < sData.m_uiFeatureBasedEntitiesSize; ++ui)
|
|
traverseFeatureTree(sData.m_ppFeatureBasedEntities[ui], occurrence);
|
|
|
|
for (ui = 0; ui < sData.m_uiConstraintsSize; ++ui)
|
|
traverseConstraint(sData.m_ppConstraints[ui], occurrence);
|
|
|
|
traversePublicationSet(sData.m_pPublicationSet, occurrence);
|
|
|
|
for (ui = 0; ui < sData.m_uiMaterialAndVisualisationSetupSize; ++ui)
|
|
{
|
|
_TiXmlElement* materialandvis = new _TiXmlElement("m_psMaterialAndVisualisationSetup");
|
|
traverseMaterialAndVis(sData.m_psMaterialAndVisualisationSetup[ui], materialandvis);
|
|
occurrence->LinkEndChild(materialandvis);
|
|
}
|
|
|
|
//----------- Export Specific information per CAD format -----------
|
|
switch (sData.m_eModellerType)
|
|
{
|
|
case kA3DModellerUnigraphics:
|
|
{
|
|
stTraverseUg(pOccurrence, occurrence);
|
|
break;
|
|
}
|
|
case kA3DModellerSlw:
|
|
{
|
|
stTraverseSLW(pOccurrence, occurrence);
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
|
|
CHECK_RET(A3DAsmProductOccurrenceGet(NULL, &sData));
|
|
}
|
|
else
|
|
{
|
|
occurrence->SetAttribute("error", A3DMiscGetErrorMsg(iRet));
|
|
}
|
|
|
|
traverseMaterialProperties(pOccurrence, occurrence);
|
|
|
|
setting->LinkEndChild(occurrence);
|
|
|
|
return iRet;
|
|
}
|
|
|
|
//######################################################################################################################
|
|
A3DStatus traverseModel(const A3DAsmModelFile* pModelFile, _TiXmlElement* setting)
|
|
{
|
|
A3DStatus iRet = A3D_SUCCESS;
|
|
A3DAsmModelFileData sData;
|
|
A3D_INITIALIZE_DATA(A3DAsmModelFileData, sData);
|
|
|
|
_TiXmlElement* model = new _TiXmlElement("A3DAsmModelFileData");
|
|
setAttributePRC2XMLID(pModelFile, model);
|
|
traverseSource(pModelFile, model);
|
|
|
|
iRet = A3DAsmModelFileGet(pModelFile , &sData);
|
|
if(iRet == A3D_SUCCESS)
|
|
{
|
|
A3DUns32 ui;
|
|
|
|
model->SetAttribute("m_bUnitFromCAD", sData.m_bUnitFromCAD);
|
|
model->SetDoubleAttribute("m_dUnit", sData.m_dUnit);
|
|
model->SetAttribute("m_eModellerType", sData.m_eModellerType);
|
|
|
|
dumpRelationships(sData.m_pBIMData, model);
|
|
|
|
for(ui = 0; ui < sData.m_uiPOccurrencesSize; ++ui)
|
|
stTraversePOccurrence(sData.m_ppPOccurrences[ui], model);
|
|
|
|
CHECK_RET(A3DAsmModelFileGet(NULL, &sData));
|
|
}
|
|
else
|
|
{
|
|
model->SetAttribute("error", A3DMiscGetErrorMsg(iRet));
|
|
}
|
|
|
|
setting->LinkEndChild(model);
|
|
return iRet;
|
|
}
|