Model.hm_encodeshape#

Model.hm_encodeshape(entity_collection, encoding_algorithm=0, sphhar_bandwidth=16, sphhar_falloff=2.828427, sphhar_radii=32, sphhar_resolution=64)#

Generates an encoded string representing the shape of a geometry.

Parameters:
  • entity_collection (Collection) – The collection containing the input entities to generate the encoding for. Valid entities are surfaces and elements.

  • encoding_algorithm (int) –

    The optional encoding algorithm to use. Valid values are:

    0 - sphhar technique (default)

  • sphhar_bandwidth (int) – Optional, valid for encoding_algorithm 0. (default=16)

  • sphhar_falloff (double) – Optional, valid for encoding_algorithm 0. (default=2.828427)

  • sphhar_radii (int) – Optional, valid for encoding_algorithm 0. (default=32)

  • sphhar_resolution (int) – Optional, valid for encoding_algorithm 0. (default=64)

Returns:

Example#

Calculate and diff the encodings from all surfaces against all elements#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_encodeshape(entity_collection=hm.Collection(model, ent.Surface))
x = result.encoding
print("encoding_1", x)

_, result = model.hm_encodeshape(entity_collection=hm.Collection(model, ent.Element))
y = result.encoding
print("encoding_2", y)

_, result = model.hm_diffencodings(encodings1=x, encodings2=y)
print("distance", result.distance)