Skip to content

BuildingElementService

Implementation of the build element service

BuildingElementService

Canonical path: BuildingElementService.BuildingElementService

Definition of class BuildingElementService

read_build_ele_from_pyp staticmethod

read_build_ele_from_pyp(
    file_name: str,
) -> tuple[bool, ModuleType | None, BuildingElement | None]

Create BuildingElement and python module based on .pyp file

This method gets only the BuildingElement and the python module of the script, the .pyp file refers to. The resulting BuildingElement contains parameters with their default values.

Use this method in the script of a main element (e.g. PythonPartGroup) to get the BuildingElement of the subordinate elements (e.g. PythonParts in the group).

Parameters:

  • file_name (str) –

    full path to the .pyp file

Returns:

  • bool

    True, if import was successful, False otherwise

  • ModuleType | None

    Python module representing the PythonPart script (.py file)

  • BuildingElement | None

    The BuildingElement with parameters and their default values

read_data_from_pyp staticmethod

read_data_from_pyp(
    file_name: str,
    str_table: BuildingElementStringTable,
    is_library_preview: bool,
    material_str_table: BuildingElementMaterialStringTable,
    sub_file_name: str = "",
    init_with_last_input: bool = True,
    add_sub_file_name: str = "",
) -> Tuple[
    Optional[bool],
    Optional[ModuleType],
    List[BuildingElement],
    List[BuildingElementControlProperties],
    BuildingElementComposite,
    str,
    str,
]

Read the data from the pyp file and check the version

Parameters:

  • file_name (str) –

    Name of the pyp file

  • str_table (BuildingElementStringTable) –

    String table

  • is_library_preview (bool) –

    Called for library preview

  • material_str_table (BuildingElementMaterialStringTable) –

    Material string table

  • sub_file_name (str, default: '' ) –

    File with the sub elements

  • init_with_last_input (bool, default: True ) –

    Initialize with the data from the last input (only if ReadLastInput is set in the script)

  • add_sub_file_name (str, default: '' ) –

    additional sub file

Returns:

  • Optional[bool]

    True, if import was successful, False otherwise

  • Optional[ModuleType]

    Python module representing the PythonPart script (.py file)

  • List[BuildingElement]

    List with BuildingElement objects containing parameter values

  • List[BuildingElementControlProperties]

    List with Control properties

  • BuildingElementComposite

    Building element composite object

  • str

    Base name the .pyp file (without the directory path and the '.pyp' extension)

  • str

    Absolute path of the .pyp file

write_data_to_default_favorite_file staticmethod

write_data_to_default_favorite_file(build_ele_list: List[BuildingElement])

Write the data to the default favorite file

Parameters: