Skip to content

ElementsByAttributeService

Canonical path: NemAll_Python_BaseElements.ElementsByAttributeService

Service for selecting elements in the current document based on the value of a specific attribute. The ID of this attribute must be given during the service initialization. The service is a singleton, meaning that there can only exist one instance of it.

Examples:

Initialize the service as follows:

>>> AllplanBaseElements.ElementsByAttributeService.GetInstance().Init(attribute_id, document)

Then select elements whose attribute value is equal to the desired one, as follows:

>>> elements = AllplanBaseElements.ElementsByAttributeService.GetInstance().GetElements(attribute_value)

Methods:

  • GetElements

    dummy, is only needed for the creation of the documentation by MkDocs

  • GetInstance

    Get the instance

  • Init

    Initialize the service.

GetElements overloaded

GetElements(attributeValue: float) -> BaseElementAdapterList

Get the elements for the double attribute value

Parameters:

  • attributeValue (float) –

    Attribute value

Returns:

GetElements(attributeValue: int) -> BaseElementAdapterList

Get the elements for the integer attribute value

Parameters:

  • attributeValue (int) –

    Attribute value

Returns:

GetElements(attributeValue: str) -> BaseElementAdapterList

Get the elements for the string attribute value

Parameters:

  • attributeValue (str) –

    Attribute value

Returns:

GetInstance staticmethod

GetInstance() -> ElementsByAttributeService

Get the instance

Returns:

Init

Init(attributeID: int, doc: DocumentAdapter)

Initialize the service.

Parameters:

  • attributeID (int) –

    Attribute ID. Used for creating fast element access by an attribute value of this ID

  • doc (DocumentAdapter) –

    Document