Model.hm_markbyfeature#

Model.hm_markbyfeature(input_collectionset, output_collectionset, feature_mode, min_radius=0, max_radius=0, internal_only=0, closed_cylinder=0, valve_output=1)#

Puts entities on the specified output collection based on entities on the input collection selection and specified feature parameters.

Parameters:
  • input_collectionset (CollectionSet) – The set of collections containing possibly multiple type of entities of the input collection.

  • output_collectionset (CollectionSet) – The set of collections containing possibly multiple type of entities of the output collection.

  • feature_mode (int) –

    This is mandatory input parameter. Valid values are:

    1 - Put on output collection lines representing circles. Input collection entity type is line.

    2 - Put on output collection lines representing circles. Input collection entity type is surface.

    3 - Put on output collection surfaces representing cylinders. Input collection entity type is surface.

    4 - Put on output collection surfaces representing fillets. Input collection entity type is surface.

    5 - Put on output collection surfaces representing valve seats. Input collection entity type is surface.

    6 - Put on output collection surfaces that contain internal discontinuities and high curvature areas. Input collection entity type is surface.

  • min_radius (double) – This parameter filters output lines or surfaces by minimal curvature radius. Valid values are any value > 0.0, or a value < 0.0 to specify any radius.

  • max_radius (double) – This parameter filters output lines or surfaces by maximum curvature radius. Valid values are any value > 0.0, or a value < 0.0 to specify any radius.

  • internal_only (int) – Used only for feature_mode=1 or feature_mode=2. If set to 1, all outer circles on surfaces will be excluded from the output.

  • closed_cylinder (int) – Used only for feature_mode=3. If set to 1, all non closed cylinder surfaces will be excluded from the output.

  • valve_output (int) – Used only for feature_mode=5. If set to 1, all surfaces representing the cylinder part of a valve seat will be excluded from the output.

Returns:

Examples#

Populate a CollectionSet with lines representing circles with radius between 1.0 and 15.0#
import hm
import hm.entities as ent

model = hm.Model()

inputCollectionSet = hm.CollectionSet(model)

all_lines = hm.Collection(model,ent.Line)

inputCollectionSet.set(all_lines)

outputCollectionSet = hm.CollectionSet(model)

model.hm_markbyfeature(
  input_collectionset=inputCollectionSet,
  output_collectionset=outputCollectionSet,
  feature_mode=1,
  min_radius=1.0,
  max_radius=15.0
)

if outputCollectionSet.empty:
    print("No lines representing circles with radius between 1.0 and 15.0 found")
else:
    lines = outputCollectionSet.get(ent.Line)
    print("Number of lines representing circles with radius between 1.0 and 15.0:", len(lines))
Populate a CollectionSet with surfaces representing closed cylinders with any radius#
import hm
import hm.entities as ent

model = hm.Model()

inputCollectionSet = hm.CollectionSet(model)

all_surfaces = hm.Collection(model,ent.Surface)

inputCollectionSet.set(all_surfaces)

outputCollectionSet = hm.CollectionSet(model)

model.hm_markbyfeature(
  input_collectionset=inputCollectionSet,
  output_collectionset=outputCollectionSet,
  feature_mode=3,
  min_radius=-1.0,
  closed_cylinder=1
)

if outputCollectionSet.empty:
    print("No surfaces representing closed cylinders found")
else:
    surfaces = outputCollectionSet.get(ent.Surface)
    print("Number of surfaces representing closed cylinders with any radius:", len(surfaces))