Model.hm_ce_read_mcf#

Model.hm_ce_read_mcf(mcfName)#

Begins the process of reading a main connector file. Must be followed by a call to Model.hm_ce_close_mcf().

Parameters:

mcfName (hwString) – The full file path and name of the .mcf file, enclosed in quotes.

Returns:

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)

get_all_data = []
for result in resultlist:
    get_all_data.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:
        get_all_data.append([
        "entity= ", link.entity,
        "link_flag= ", link.link_flag,
        "link_rule= ", link.link_rule,
    ]
    )

print("Data:", get_all_data)

model.hm_ce_close_mcf()