This commit is contained in:
ninja
2025-12-15 23:22:33 +08:00
parent 019570564b
commit 8782765fbc
809 changed files with 118753 additions and 18289 deletions

View File

@@ -1,6 +1,6 @@
/***********************************************************************************************************************
*
* Copyright (c) 2010 - 2022 by Tech Soft 3D, Inc.
* 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
@@ -34,7 +34,7 @@ A3DStatus A3DModelFileConnector::Traverse(A3DVisitorContainer* psVisitor, bool b
{
psVisitor->SetCurrentPoFather(NULL);
A3DProductOccurrenceConnector sTreeConnector(m_sModelFileData.m_ppPOccurrences[uI]);
if (sTreeConnector.TraversePO(m_sModelFileData.m_ppPOccurrences[uI], psVisitor, bVisitPrototype) != A3D_SUCCESS)
if (sTreeConnector.TraversePO(psVisitor, bVisitPrototype) != A3D_SUCCESS)
return A3D_ERROR;
}
psVisitor->visitLeave(*this);
@@ -42,291 +42,38 @@ A3DStatus A3DModelFileConnector::Traverse(A3DVisitorContainer* psVisitor, bool b
}
// Traversing the assembly Structure
A3DStatus A3DProductOccurrenceConnector::TraversePO(const A3DAsmProductOccurrence* pOccurrence,
A3DVisitorContainer* psVisitor,
bool bVisitPrototype)
A3DStatus A3DProductOccurrenceConnector::TraversePO(A3DVisitorContainer* psVisitor, bool bVisitPrototype)
{
A3DStatus iRet = A3D_SUCCESS;
CHECK_RET(psVisitor->visitEnter(*this));
//Traverse AnnotationEntity
A3DUns32 uI;
#ifdef CONNECT_PMI
A3DUns32 uNbAnnotationEntity = m_sProductOccurrenceData.m_uiAnnotationsSize;
for (uI = 0; uI < uNbAnnotationEntity; uI++)
if (m_sProductOccurrenceData.m_pPrototype != nullptr || m_sProductOccurrenceData.m_pExternalData != nullptr)
{
A3DMkpAnnotationEntityConnector sAnnotationEntityConnector(m_sProductOccurrenceData.m_ppAnnotations[uI]);
sAnnotationEntityConnector.TraverseAnnotationEntity(psVisitor);
}
if (!uNbAnnotationEntity && m_sProductOccurrenceData.m_pPrototype != NULL)
{
A3DAsmProductOccurrence* pProductPrototype = m_sProductOccurrenceData.m_pPrototype;
while (pProductPrototype)
{
A3DAsmProductOccurrenceData sProductPrototypeData;
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sProductPrototypeData);
CHECK_RET_CALL_A3D_FCTION(A3DAsmProductOccurrenceGet,(pProductPrototype, &sProductPrototypeData));
uNbAnnotationEntity = sProductPrototypeData.m_uiAnnotationsSize;
for (uI = 0; uI < uNbAnnotationEntity; uI++)
{
A3DMkpAnnotationEntityConnector sAnnotationEntityConnector(sProductPrototypeData.m_ppAnnotations[uI]);
sAnnotationEntityConnector.TraverseAnnotationEntity(psVisitor);
}
pProductPrototype = sProductPrototypeData.m_pPrototype;
CHECK_RET_CALL_A3D_FCTION(A3DAsmProductOccurrenceGet,(NULL, &sProductPrototypeData));
}
}
#endif
A3DAsmProductOccurrence* pPo = m_sProductOccurrenceData.m_pPrototype ?
m_sProductOccurrenceData.m_pPrototype : m_sProductOccurrenceData.m_pExternalData;
#ifdef CONNECT_VIEWS
A3DUns32 uNbView = m_sProductOccurrenceData.m_uiViewsSize;
if (!uNbView && m_sProductOccurrenceData.m_pPrototype != NULL)
{
A3DAsmProductOccurrence* pProductPrototype = m_sProductOccurrenceData.m_pPrototype;
while (pProductPrototype)
{
A3DAsmProductOccurrenceData sProductPrototypeData;
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sProductPrototypeData);
CHECK_RET_CALL_A3D_FCTION(A3DAsmProductOccurrenceGet,(pProductPrototype, &sProductPrototypeData));
uNbView = sProductPrototypeData.m_uiViewsSize;
for (uI = 0; uI < uNbView; uI++)
{
A3DMkpViewConnector sMkpViewConnector(sProductPrototypeData.m_ppViews[uI]);
sMkpViewConnector.TraverseView(psVisitor);
}
pProductPrototype = sProductPrototypeData.m_pPrototype;
CHECK_RET_CALL_A3D_FCTION(A3DAsmProductOccurrenceGet,(NULL, &sProductPrototypeData));
}
A3DProductOccurrenceConnector oPoConnector(pPo);
oPoConnector.TraversePO(psVisitor, bVisitPrototype);
}
else if (uNbView)
else
{
for (uI = 0; uI < uNbView; uI++)
for (A3DUns32 i = 0; i < m_sProductOccurrenceData.m_uiPOccurrencesSize; i++)
{
A3DMkpViewConnector sMkpViewConnector(m_sProductOccurrenceData.m_ppViews[uI]);
sMkpViewConnector.TraverseView(psVisitor);
}
}
A3DAsmProductOccurrence* pPo = m_sProductOccurrenceData.m_ppPOccurrences[i];
A3DProductOccurrenceConnector oPoConnector(pPo);
#endif
#ifdef CONNECT_FEATURE
A3DUns32 uNbFeatureBasedEntity = m_sProductOccurrenceData.m_uiFeatureBasedEntitiesSize;
if (!uNbFeatureBasedEntity && m_sProductOccurrenceData.m_pPrototype != NULL)
{
A3DAsmProductOccurrence* pProductPrototype = m_sProductOccurrenceData.m_pPrototype;
while (pProductPrototype)
{
A3DAsmProductOccurrenceData sProductPrototypeData;
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sProductPrototypeData);
CHECK_RET(A3DAsmProductOccurrenceGet(pProductPrototype, &sProductPrototypeData));
uNbFeatureBasedEntity = sProductPrototypeData.m_uiFeatureBasedEntitiesSize;
for (uI = 0; uI < uNbFeatureBasedEntity; uI++)
{
A3DFRMTreeConnector sConnector(sProductPrototypeData.m_ppFeatureBasedEntities[uI]);
sConnector.TraverseFeatureTree(psVisitor);
}
pProductPrototype = sProductPrototypeData.m_pPrototype;
CHECK_RET(A3DAsmProductOccurrenceGet(NULL, &sProductPrototypeData));
oPoConnector.TraversePO(psVisitor, bVisitPrototype);
}
}
else if (uNbFeatureBasedEntity)
{
for (uI = 0; uI < uNbFeatureBasedEntity; uI++)
for (A3DUns32 i = 0; i < m_sProductOccurrenceData.m_uiFeatureBasedEntitiesSize; i++)
{
A3DFRMTreeConnector sConnector(m_sProductOccurrenceData.m_ppFeatureBasedEntities[uI]);
A3DFRMTreeConnector sConnector(m_sProductOccurrenceData.m_ppFeatureBasedEntities[i]);
sConnector.TraverseFeatureTree(psVisitor);
}
}
#endif
A3DAsmPartDefinition* pPart = NULL;
if (!bVisitPrototype)
{
CHECK_RET(GetPart(pPart));
}
else
{
pPart = m_sProductOccurrenceData.m_pPart;
}
if (pPart)
{
void * pEntityInMap = psVisitor->FindInMap(pPart);
psVisitor->SetInMap(pPart, pPart);
A3DPartConnector sPartConnector(pPart);
psVisitor->SetCurrentPoFather(pOccurrence);
sPartConnector.SetProductOccurenceFather(pOccurrence);
// if we haven't found the part in the map or if we traverse the instance
if (pEntityInMap == NULL || psVisitor->TraverseInstances())
{
CHECK_RET(sPartConnector.TraversePart(psVisitor));
}
psVisitor->SetCurrentPoFather(NULL);
}
std::vector<A3DAsmProductOccurrence*> apSons;
if (!bVisitPrototype)
{
CollectSons(apSons);
}
else
{
if (m_sProductOccurrenceData.m_pPrototype)
{
if (psVisitor->FindInMap(m_sProductOccurrenceData.m_pPrototype) == NULL)
{
psVisitor->SetInMap(m_sProductOccurrenceData.m_pPrototype, m_sProductOccurrenceData.m_pPrototype);
A3DProductOccurrenceConnector sPrototypeConnector(m_sProductOccurrenceData.m_pPrototype);
sPrototypeConnector.SetPrototypeType(true);
sPrototypeConnector.TraversePO(m_sProductOccurrenceData.m_pPrototype, psVisitor, bVisitPrototype);
}
}
if (m_sProductOccurrenceData.m_pExternalData)
{
if (psVisitor->FindInMap(m_sProductOccurrenceData.m_pExternalData) == NULL)
{
psVisitor->SetInMap(m_sProductOccurrenceData.m_pExternalData, m_sProductOccurrenceData.m_pExternalData);
A3DProductOccurrenceConnector sExternalConnector(m_sProductOccurrenceData.m_pExternalData);
sExternalConnector.SetExternalType(true);
sExternalConnector.TraversePO(m_sProductOccurrenceData.m_pExternalData, psVisitor, bVisitPrototype);
}
}
unsigned int uSize = m_sProductOccurrenceData.m_uiPOccurrencesSize;
for (uI = 0; uI < uSize; uI++)
{
apSons.push_back(m_sProductOccurrenceData.m_ppPOccurrences[uI]);
}
}
for (uI = 0; uI < apSons.size(); uI++)
{
A3DProductOccurrenceConnector sPoConnector(apSons[uI]);
sPoConnector.SetProductOccurrenceFather(this->GetA3DEntity());
psVisitor->SetCurrentPoFather(pOccurrence);
CHECK_RET(sPoConnector.TraversePO(apSons[uI], psVisitor, bVisitPrototype));
psVisitor->SetCurrentPoFather(NULL);
}
CHECK_RET(psVisitor->visitLeave(*this));
return A3D_SUCCESS;
}
A3DStatus A3DProductOccurrenceConnector::CollectSons(
std::vector<A3DAsmProductOccurrence*>& apSons) const
{
//Get Children or children on Prototype's ....Prototype's
A3DAsmProductOccurrence* pPrototype = m_sProductOccurrenceData.m_pPrototype;
A3DAsmProductOccurrence** ppPo = m_sProductOccurrenceData.m_ppPOccurrences;
unsigned int uSize = m_sProductOccurrenceData.m_uiPOccurrencesSize;
A3DStatus iRet = A3D_SUCCESS;
while (uSize == 0 && pPrototype)
{
A3DAsmProductOccurrenceData sPrototypeData;
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sPrototypeData);
CHECK_RET_CALL_A3D_FCTION(A3DAsmProductOccurrenceGet,(pPrototype, &sPrototypeData));
pPrototype = sPrototypeData.m_pPrototype;
uSize = sPrototypeData.m_uiPOccurrencesSize;
ppPo = sPrototypeData.m_ppPOccurrences;
CHECK_RET_CALL_A3D_FCTION(A3DAsmProductOccurrenceGet,(NULL, &sPrototypeData));
}
unsigned uI;
for (uI = 0; uI < uSize; uI++)
apSons.push_back(ppPo[uI]);
//Get Children on Externals
if (m_sProductOccurrenceData.m_pExternalData)
{
if (apSons.size() == 0)
{
A3DProductOccurrenceConnector sExternalConnector(m_sProductOccurrenceData.m_pExternalData);
CHECK_RET(sExternalConnector.CollectSons(apSons));
}
else
apSons.push_back(m_sProductOccurrenceData.m_pExternalData);
}
return A3D_SUCCESS;
}
A3DStatus A3DProductOccurrenceConnector::GetPart(
A3DAsmPartDefinition*& pPart) const
{
pPart = NULL;
A3DStatus iRet = A3D_SUCCESS;;
if (m_sProductOccurrenceData.m_pPart)
{
pPart = m_sProductOccurrenceData.m_pPart;
return A3D_SUCCESS;
}
A3DAsmProductOccurrence* pProductPrototype = m_sProductOccurrenceData.m_pPrototype;
while (pProductPrototype)
{
A3DAsmProductOccurrenceData sProductPrototypeData;
A3D_INITIALIZE_DATA(A3DAsmProductOccurrenceData, sProductPrototypeData);
CHECK_RET_CALL_A3D_FCTION(A3DAsmProductOccurrenceGet,(pProductPrototype, &sProductPrototypeData));
if (sProductPrototypeData.m_pPart)
{
pPart = sProductPrototypeData.m_pPart;
CHECK_RET_CALL_A3D_FCTION(A3DAsmProductOccurrenceGet,(NULL, &sProductPrototypeData));
return A3D_SUCCESS;
}
else
pProductPrototype = sProductPrototypeData.m_pPrototype;
CHECK_RET_CALL_A3D_FCTION(A3DAsmProductOccurrenceGet,(NULL, &sProductPrototypeData));
}
if (m_sProductOccurrenceData.m_uiPOccurrencesSize == 0)
{
if (m_sProductOccurrenceData.m_pExternalData)
{
A3DProductOccurrenceConnector sExternalconnector(m_sProductOccurrenceData.m_pExternalData);
CHECK_RET(sExternalconnector.GetPart(pPart));
}
}
return A3D_SUCCESS;
}
A3DStatus A3DPartConnector::TraversePart(A3DVisitorContainer* psVisitor) const
{
A3DStatus iRet = A3D_SUCCESS;
CHECK_RET(psVisitor->visitEnter(*this));
//Traverse AnnotationEntity
A3DUns32 uI;
#ifdef CONNECT_PMI
A3DUns32 uNbAnnotationEntity = m_sPartData.m_uiAnnotationsSize;
for (uI = 0; uI < uNbAnnotationEntity; uI++)
{
A3DMkpAnnotationEntityConnector sAnnotationEntityConnector(m_sPartData.m_ppAnnotations[uI]);
sAnnotationEntityConnector.TraverseAnnotationEntity(psVisitor);
}
#endif
#ifdef CONNECT_VIEWS
A3DUns32 uNbView = m_sPartData.m_uiViewsSize;
for (uI = 0; uI < uNbView; uI++)
{
A3DMkpViewConnector sMkpViewConnector(m_sPartData.m_ppViews[uI]);
sMkpViewConnector.TraverseView(psVisitor);
}
#endif
//Traverse RI
for (uI = 0; uI < m_sPartData.m_uiRepItemsSize; uI++)
{
A3DRiConnector sRiConnector(m_sPartData.m_ppRepItems[uI]);
sRiConnector.TraverseRi(psVisitor);
}
CHECK_RET(psVisitor->visitLeave(*this));
return A3D_SUCCESS;
}
@@ -496,7 +243,6 @@ A3DStatus A3DRiPolyWireConnector::TraverseRiPolyWire(A3DVisitorContainer* psVisi
return iRet;
}
// A3DFRMParameter
A3DStatus A3DFRMFeatureConnector::TraverseFeature(A3DVisitorContainer* psVisitor) const
{
@@ -550,7 +296,6 @@ A3DStatus A3DFRMParameterConnector::TraverseParameter(A3DVisitorContainer* psVis
return iRet;
}
// FeatureTree
A3DStatus A3DFRMTreeConnector::TraverseFeatureTree(A3DVisitorContainer* psVisitor) const
{