Model.segregateByPatches#

Model.segregateByPatches(collection, component_name)#

This function is used to find connected patches of elements and create separate components for the elements in each connected patch. The number of new components created will be equal to number of clusters of element patches.

For example, for element patches (with IDs) {1 2 3 4} , {5 6 7 8 9} , {10 11} there will be 3 new components created.

Parameters:
  • collection (Collection) – The collection containing the shell elements entities for input.

  • component_name (hwString) – The name of the component that contains the elements in the collection.

Example#

Create new components from element patches in the component “ ToSegregate “#
import hm
import hm.entities as ent

model = hm.Model()

# Creating a collection that contains the elements of the component named "ToSegregate"
filter = hm.FilterByCollection(ent.Element, ent.Component)
component_collection = hm.Collection(model, ent.Component, "name=ToSegregate")
elements_collection = hm.Collection(model, filter, component_collection)

model.segregateByPatches(collection=elements_collection,component_name="ToSegregate")