Model.removesubmodel#

Model.removesubmodel(submodel_type, id, shortname, remove)#

Deletes a solversubmodel or include file, optionally removing all of its contents as well.

If both id and shortname are empty, this function removes all solversubmodels and include files from the database (but does not delete the contents). If the contents are not deleted, they move to the parent include file.

Parameters:
  • submodel_type (hwString) – Use solversubmodel to remove a solver submodel or includefile to remove an include file.

  • id (unsigned int) – The entity ID. If id=0, then use shortname.

  • shortname (hwString) – The short name of the solver submodel or include file. This can be empty if id is specified other than 0.

  • remove (int) –

    0 - Do not remove the contents of the object when deleting.

    1 - If either id or shortname selects a single object, then all of the contents of that object will be deleted from the database.

Example#

Remove the “ solversubmodel “ entity with ID 10 and delete its contents#
import hm
import hm.entities as ent

model = hm.Model()

model.removesubmodel(submodel_type="solversubmodels", id=10, shortname="", remove=1)