LabelUtilsPE is a protocol extension (PE) that moves label related functionality outside of core Teigha BIM functionality, allowing Teigha BIM member developers to implement their own protocol extension for support of different localizations. For now, a protocol extension with English labels is implemented as an example.
LabelUtilsPE interfaces
• OdString getLabelFor(<Enum>)
Returns labels for built-in enum values. The following enums are supported:
OdBm::BuiltInParameter::Enum
OdBm::BuiltInParameterGroup::Enum
OdBm::DisplayUnitType::Enum
OdBm::ParameterType::Enum
OdBm::UnitSymbolType::Enum
OdBm::UnitType::Enum
OdBm::BuiltInCategory::Enum
• OdString format(const OdBmAUnits& aUnits, OdBm::UnitType::Enum unitType, double value, bool editing = false)
Format value passed is a string corresponding to its unit type (OdBm::UnitType::Enum unitType) and an array of unit type format settings in the database (OdBmAUnits& aUnits).
• OdString format(const OdBmAUnits& aUnits, OdBm::UnitType::Enum unitType, double value, const OdBmFormatOptions&
formatOptions, bool editing = false)
Format value passed is a string corresponding to its unit type (OdBm::UnitType::Enum unitType) and format options (OdBmFormatOptions& formatOptions). Format options contain a flag IsUseDefault, which if true, the function bypasses these format options and takes the format from the unit type format settings in the database (OdBmAUnits& aUnits).
Code locations
• Include\Database\BmLabelUtilsPE.h — Main header defining all supported interfaces.
• Examples\TB_LabelUtilsPE\BmLabelUtilsEnPE.h and .cpp — PE implementation with English language support.
LabelUtilsPE methods usage
To use PE methods, first load the library with the PE implementation, for example to use English PE, the following command should be called:
::odrxDynamicLinker()->loadModule(L"TB_ExLabelUtils");
Then the PE gets linked with the OdBmElement class and can be accessed with the following call:
OdBmLabelUtilsPEPtr pLabelUtils = OdBmElement::desc()->getX(OdBmLabelUtilsPE::desc());
If no PE module was loaded, pLabelUtils will get a null pointer as the result.
LabelUtilsPE usage in BIM
Currently LabelUtilsPE is used for building tables of built-in parameters (ParamDef.caption) and built-in categories (Category.name). If no LabelUtilsPE module is loaded when a database is opened, built-in parameters and category elements will get names that correspond to their enum element names.