Model.hm_ce_datalist#

Model.hm_ce_datalist(ce_collection)#

This function returns, in a list, all connector data displayed in the table for a single connector on collection and as a list of lists for multiple connectors.

Parameters:

ce_collection (Collection) – The collection containing the connector entities to return data.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResultList - Result list object containing HmQueryResult objects with the following output data:

    • id (Entity)

    • thickness (int)

    • component (str)

    • location (str)

    • config (str)

    • link_info (HmQueryResultList)-Result list object containing HmQueryResult objects with the following output data:

      • entity (Entity)

      • link_flag (str)

      • link_rule (str)

    • state (str)

Example#

Open test.mcf to read all the data and close the file when finished#
import hm
import hm.entities as ent

model = hm.Model()

ce = hm.CollectionByDisplayed(model, ent.Connector)

model.hm_ce_read_mcf(mcfName="test.mcf")

_, resultlist = model.hm_ce_datalist(ce_collection=ce)

ce_data_list = []
for result in resultlist:
    ce_data_list.append([
        ["id= ", result.id],
        ["thickness= ", result.thickness],
        ["component= ", result.component],
        ["location= ", result.location],
        ["config= ", result.config],
        ["state= ", result.state],
    ]
    )

    for link in result.link_info:
        ce_data_list.append([
        "entity= ", link.entity,
        "link_flag= ", link.link_flag,
        "link_rule= ", link.link_rule,
    ]
    )

print("Data:", ce_data_list)

model.hm_ce_close_mcf()