How-to: Get edge length

Get length of a edge using A3DCurveLength which computes the length of a curve with interval of edge

A3DSDKAdvancedTools.h — HOOPS Exchange 2023 documentation

A3DTopoEdgeData sData;
A3D_INITIALIZE_DATA(A3DTopoEdgeData, sData);
A3DTopoEdgeGet(pEdge, &sData);
const A3DCrvBase* p3DCurve = nullptr;
if (sData.m_p3dCurve != nullptr)
		p3DCurve = sData.m_p3dCurve;
else
{  
	const A3DEntity* pBrep; // A3DRiBrepModel
	A3DRiBrepModelData sRiBrepData;
	A3D_INITIALIZE_DATA(A3DRiBrepModelData, sRiBrepData);
	A3DRiBrepModelGet(pBrep, &sRiBrepData);
	A3DTopoEdgeGetOrCompute3DCurve(sRiBrepData.m_pBrepData, pEdge, &p3DCurve);
}
if (p3DCurve)
{
	double curveLength = 0.0;
	A3DCurveLength(p3DCurve, sData.m_bHasTrimDomain ? &sData.m_sInterval : NULL, &curveLength);
    // Apply A3DTopoContextData::m_dScale, scale of representation item and product occurence
    doubel edgelength = curveLength * scale;
}