Obtaining Mass Information for Block Reference and Solid3d

Hi team,

I hope this message finds you well.

I would like to obtain the mass of a reference or a 3dsolid, I am able to retrieve the volume and physical material name of a reference or a 3D solid. however, I am blocked by accessing the density of the physical material.

Is there a way to get mass programmatically or get the density of a physical material using its name?
The following are some code snippets and some screenshots are attached:
"""
BrxComponentDefinition compDef = BrxComponentDefinition::getComponentDefinition(id);
AcString strMaterial = compDef.physicalMaterial();
acutPrintf(L"\n strMaterial:%s", strMaterial.constPtr());
"""

Thank you so much for your support!

Kind regards,
William

/////////////////////////////////////////////
Hi William,

Thank you for your report.

First, I have to say that, unfortunately, due to some technical reasons, we cannot apply fixes to previous BricsCAD versions, such as 23.2.04-2, but only to the current or future versions.

The good news is that there is a dedicated BRX (BIM for now) API. The bad news is that it works with a BIM license for now (RunAsLevel=5):

//SR
BrxComponentDefinition compDef = BrxComponentDefinition::getComponentDefinition(idArray.at(0));
AcString strMaterial = compDef.physicalMaterial();
acutPrintf(L"\n strMaterial:%s", strMaterial.constPtr());

//eug
BrxBimMaterial material;//(strMaterial.constPtr());
BimApi::ResultStatus res = BrxBimMaterial::getMaterial(material, acdbCurDwg(), strMaterial.constPtr());
double density = material.getPhysicalAssets(false).density();
acutPrintf(_T("\n => BrxBimMaterial::material.getPhysicalAssets(false).density() = %lf."), density);
With the latest BricsCAD V23.2.7 release, that code returns 550 with a Bim license (RunAsLevel=5) but -1 with a Mechanical license (RunAsLevel=4).

There is an existing task, but no plans for now:
Implement API to work with material properties
I am going to add this SR number there.

Did this help, please?

Kind regards,
Eugen
/////////////////////////////////////////////