String resources

Inside the PythonPart script it’s possible to access the strings that are defined in the

  • local string table: from the resource file of the PythonPart

  • global string table: from the common resource file

The BuildingElement object (e.g. build_ele) has the member function get_string_tables, which returns a tuple containing the local and the global string table BuildingElementStringTable object such as

local_str_table, global_str_table = build_ele.get_string_tables()

The string can be accessed as follows

msg_text = local_str_table.get_string("1001", "This is a message")

The default value is used if the string for the ID is missing in the resource file. In this case, a message is also displayed in the Allplan trace window about the missing ID value and file name.

Example

The implementation of the string table usage is described in the example ComboboxLocalisedStringValues, which is located in

…\etc\Examples\PythonParts\PaletteExamples\ComboboxLocalisedStringValues.pyp
…\etc\PythonPartsExampleScripts\PaletteExamples\ComboboxLocalisedStringValues.py