函数:
ZwEntityProjectToPlaneAreaGet
支持版本:
ZW3D 2026 SP1及以上
代码:
cpp
void 零件_查询_测量_投影面积()
{
szwEntityHandle entityHandle = {};
ZF_CALL(ZwEntityGetByPick("选择造型", ezwEntityInputOption::ZW_INPUT_SHAPE, 0, &entityHandle));
szwEntityHandle planeHandle = {};
ZF_CALL(ZwEntityGetByPick("选择平面", ezwEntityInputOption::ZW_INPUT_DATUM_PLANE, 0, &planeHandle));
szwProjectAreaOption option{};
option.count = 1;
option.entityHandleList = &entityHandle;//造型
option.plane = planeHandle;//平面
option.addCurveFlag = ZW_PROJECT_AREA_FLAG_ALL_CURVES;//全部曲线
szwProjectAreaProp areaProp{};
ZF_CALL(ZwEntityProjectToPlaneAreaGet(option, &areaProp));
WriteMessage("最大投影面积 = %.2f", areaProp.area);
WriteMessage("X最大距离 = %.2f", areaProp.xMaxLen);
WriteMessage("Y最大距离 = %.2f", areaProp.yMaxLen);
ZF_CALL(ZwEntityHandleFree(&entityHandle));//内存释放
ZF_CALL(ZwEntityHandleFree(&planeHandle));
}
