Model.hm_getmidsurfaceinfo#

Model.hm_getmidsurfaceinfo(query_type, input_collection, output_entity_type=hm.entities.Surface)#

Returns information related to geometric midsurfaces.

Parameters:
  • query_type (hwString) –

    The type of query to perform:

    find_midsurface - Finds midsurfaces corresponding to input_collection components, surfaces or solids. The return is the list of output_entity_type IDs.

    find_parent_geometry - Finds components, surfaces or solids corresponding to input_collection midsurfaces. The return is the list of output_entity_type IDs.

    is_midsurface - Checks if a given input_collection of components or surfaces consists of midsurfaces only, non-midsurfaces only, or both. The return is yes, no, or mixed.

  • input_collection (Collection) – The collection containing the entities. Valid entities are defined by query_type.

  • output_entity_type (EntityFullType) – The type of output entity. Valid values are defined by query_type. If there is only one possible value, this can be omitted.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • Keys valid for query_type="find_midsurface":

      • midsurface_entities (list) - List of midsurface entities.

    • Keys valid for query_type="find_parent_geometry":

      • parent_geometry_entities (list) - List of parent geometry entities.

    • Keys valid for query_type="is_midsurface":

      • is_midsurface (hwString) - Indicates if the input entity is a midsurface (yes), not a midsurface (no), or mixed (mixed).

Examples#

Get the list of middle surfaces correspond to solid with ID 19#
import hm
import hm.entities as ent

model = hm.Model()

solids = hm.Collection(model, ent.Solid, [19])

_, result = model.hm_getmidsurfaceinfo(
                query_type="find_midsurface",
                input_collection=solids
              )

print("midsurface IDs: ", [ surf.id for surf in result.midsurface_entities])
Get the component containing the original geometry for the middle surface with ID 19#
import hm
import hm.entities as ent

model = hm.Model()

surfs = hm.Collection(model, ent.Surface, [19])

_, result = model.hm_getmidsurfaceinfo(
                query_type="find_parent_geometry",
                input_collection=surfs,
                output_entity_type=ent.Component
              )

print("parent geometry component IDs: ", [ comp.id for comp in result.parent_geometry_entities])
Check if the surface with ID 19 is a midsurface#
import hm
import hm.entities as ent

model = hm.Model()

surfs = hm.Collection(model, ent.Surface, [19])

_, result = model.hm_getmidsurfaceinfo(
                query_type="is_midsurface",
                input_collection=surfs
              )

print("Midsurface check for surface ID 19: ", result.is_midsurface)