2025.6.1
This commit is contained in:
60
exchange/exchangesource/MeshViewer/model/he/model_file.cpp
Normal file
60
exchange/exchangesource/MeshViewer/model/he/model_file.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* 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 "model_file.h"
|
||||
|
||||
#include "part.h"
|
||||
#include "product_occurrence.h"
|
||||
|
||||
namespace he
|
||||
{
|
||||
namespace structure
|
||||
{
|
||||
ModelFile::ModelFile(A3DAsmModelFile* mdlFile)
|
||||
{
|
||||
A3D_INITIALIZE_DATA(A3DAsmModelFileData, data);
|
||||
status = A3DAsmModelFileGet(mdlFile, &data);
|
||||
if (status != A3D_SUCCESS)
|
||||
return;
|
||||
status = A3DMiscCascadedAttributesCreate(&attributes);
|
||||
}
|
||||
|
||||
ModelFile::~ModelFile()
|
||||
{
|
||||
A3DAsmModelFileGet(nullptr, &data);
|
||||
}
|
||||
|
||||
int ModelFile::collect(std::vector<Part>& parts)
|
||||
{
|
||||
if (status)
|
||||
return 1;
|
||||
A3DMiscCascadedAttributes* mdl_attribs = nullptr;
|
||||
A3DMiscCascadedAttributesCreate(&mdl_attribs);
|
||||
|
||||
for (const auto po_entity : sub_levels())
|
||||
{
|
||||
A3DMiscCascadedAttributes* new_attributes = nullptr;
|
||||
if (create_cascaded_attributes(po_entity, mdl_attribs, new_attributes) != 0)
|
||||
return 1;
|
||||
if (A3DMiscCascadedAttributesEntityReferencePush(new_attributes, po_entity, nullptr) != 0)
|
||||
continue;
|
||||
ProductOccurrence po(po_entity, new_attributes);
|
||||
po.collect(parts, nullptr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<A3DEntity*> ModelFile::sub_levels() const
|
||||
{
|
||||
return std::vector<A3DEntity*>(data.m_ppPOccurrences, data.m_ppPOccurrences + data.m_uiPOccurrencesSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user