Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

https://docs.techsoft3d.com/hps/latest/api_ref/cs/class_h_p_s_1_1_exchange_1_1_c_a_d_model.html

Details

Once you have imported a model using HPS::Exchange::File::Import(...) there is a mapping between HPS::Exchange::CADModel and the PRC in memory, and also between HPS::Exchange::CADModel and HPS::Model.

From a CADModel you can browse the structure to find HPS::Exchange::Component and for each component you can query:

HPS::Exchange::CADModel structure reproduce the PRC structure. It is a component tree.

Here is a representation of a simple PRC and how it would map with HOOPS Visualize data:

...

Code example

Code Block

breakoutModewide
languagecpp
//Simple function that take HPS::CADModel as input //Go through a ModelFile //Convert entity to Exchange entity //Finally use Echange API to compute physical properties void traversePRCAndExportPhysicalProperties(HPS::CADModel modelFile) { ComponentArray productOccurences = modelFile.GetSubcomponents(); std::ofstream fichier("C:\\result.txt", std::ios::out | std::ios::trunc); fichier << "Exchange traverse report" << std::endl; fichier << "ProductOccurences: " << productOccurences.size() << std::endl; for (int i = 0; i < productOccurences.size(); ++i) { ComponentArray PartDefinition = productOccurences[i].GetSubcomponents(); fichier << "\tProductOccurences#" << i << " contains " << PartDefinition.size() << " Part Definition" << std::endl; for (int j = 0; j < PartDefinition.size(); ++j) { ComponentArray RepresentationItem = PartDefinition[j].GetSubcomponents(); fichier << "\t\tPartDefinition#" << j << " contains " << RepresentationItem.size() << " RI" << std::endl; for (int k = 0; k < RepresentationItem.size(); ++k) { ComponentArray RIBrepModels = RepresentationItem[k].GetSubcomponents(); fichier << "\t\t\tReprensetationItem#" << k << " contains " << RIBrepModels.size() << " RIBrepModels" << std::endl; for (int l = 0; l < RIBrepModels.size(); ++l) { fichier << "\t\t\t BrepModel#" << l << std::endl; if (RIBrepModels[l].GetComponentType() == Component::ComponentType::ExchangeRIBRepModel) { const A3DRiBrepModel* pRiBrepModel = (A3DRiBrepModel*)((Exchange::Component)RIBrepModels[l]).GetExchangeEntity(); A3DPhysicalPropertiesData physPropData; A3D_INITIALIZE_DATA(A3DPhysicalPropertiesData, physPropData); A3DVector3dData v3d; A3D_INITIALIZE_DATA(A3DVector3dData, v3d); v3d.m_dX = 1; v3d.m_dY = 1; v3d.m_dZ = 1; A3DUns32 iRet = A3DComputePhysicalProperties(pRiBrepModel, NULL, &physPropData); if (iRet == A3D_SUCCESS) fichier << "\t\t\t\t Center gravity: " << physPropData.m_sGravityCenter.m_dX << "; " << physPropData.m_sGravityCenter.m_dY << "; " << physPropData.m_sGravityCenter.m_dZ << std::endl; if (physPropData.m_bVolumeComputed) fichier << "\t\t\t\t Volume: " << physPropData.m_dVolume << std::endl; fichier << "\t\t\t\t Surface: " << physPropData.m_dSurface << std::endl; } } } } // Part Definition }// Product occurence}For more information, check out our forum post.