Model.hm_collisioninit#

Model.hm_collisioninit(config=0, tolerance=0, allowable_depth=0, min_overlap=0)#

Initializes the collision detection module. This must precede any calls to Model.hm_collisionentitycreate() and Model.hm_collisioncheck(), and must be followed by a call to Model.hm_collisionend().

Parameters:
  • config (int) – The configuration that defines the collision behavior. This value is obtained by running Model.hm_collisiongetconfig(). Default is 0.

  • tolerance (double) – The tolerance to use for intersection checks (for model.hm_collisiongetconfig(options=["intersect_planar"])) or penetration checks (for model.hm_collisiongetconfig(options=["penetrat_min_overlap"])). If not specified, the default is 1.e-08.

  • allowable_depth (double) – The allowable depth to use when finding and reporting interferences. If specified, config should be 0 and tolerance should be -1.0. If not specified, this is ignored.

  • min_overlap (double) – For allowable_depth, in cases where collision entities overlap, there may be many intersections, and sorting out which ones are false or not is expensive. This option allows for calculating percentages by measuring the number of intersection segments against the half the number of nodes in each collision entity. If both percentages exceed the min_overlap value, we do not perform the allowable_depth analysis and instead report all of the intersections as true.

Returns:

Examples#

Find intersect surfaces from IDs 1 - 10#
import hm
import hm.entities as ent

model = hm.Model()

checking_surfs = hm.Collection(model,ent.Surface,list(range(1,11)))
intersect_surfs = hm.Collection(model,ent.Surface,populate=False)


model.hm_collisioninit()
model.hm_collisionentitycreate(collection=checking_surfs,dimension=0,thickness_type=1,
                              thickness=0,edge_penetration=0,midside_nodes=0,split_quads=0,
                              used_topology=0,grouping_identifier=False,offset=0
                              )
model.hm_collisioncheck(intersected_surfaces=intersect_surfs)
model.hm_collisionend()

print("Intersected surfaces: ", [s.id for s in intersect_surfs])
Find penetrate surfaces from IDs 1 - 10 , use the thickness assigned to the surface components#
import hm
import hm.entities as ent

model = hm.Model()

checking_surfs = hm.Collection(model,ent.Surface,list(range(1,11)))
pene_surfs = hm.Collection(model,ent.Surface,populate=False)


model.hm_collisioninit()
model.hm_collisionentitycreate(collection=checking_surfs,dimension=0,thickness_type=1,
                              thickness=0,edge_penetration=0,midside_nodes=0,split_quads=0,
                              used_topology=0,grouping_identifier=False,offset=0
                              )
model.hm_collisioncheck(penetrated_surfaces=pene_surfs)
model.hm_collisionend()

print("Penetrated surfaces: ", [s.id for s in pene_surfs])
Find both penetrate and intersect surfaces from IDs 1 - 10 , use the thickness assigned to the surface components#
import hm
import hm.entities as ent

model = hm.Model()

checking_surfs = hm.Collection(model,ent.Surface,list(range(1,11)))
pene_surfs = hm.Collection(model,ent.Surface,populate=False)
inter_surfs = hm.Collection(model,ent.Surface,populate=False)

model.hm_collisioninit()
model.hm_collisionentitycreate(collection=checking_surfs,dimension=0,thickness_type=1,
                                thickness=0,edge_penetration=0,midside_nodes=0,
                                split_quads=0,used_topology=0,)
model.hm_collisioncheck(intersected_surfaces=inter_surfs,penetrated_surfaces=pene_surfs,)
model.hm_collisionend()

print("Intersected surfaces: ", [s.id for s in pene_surfs])
print("Penetrated surfaces: ", [s.id for s in pene_surfs])
Find both penetrate and intersect surfaces from IDs 1 - 10 , use the thickness assigned to the surface components , and use an allowable depth of 0.1#
import hm
import hm.entities as ent

model = hm.Model()

checking_surfs = hm.Collection(model,ent.Surface,list(range(1,11)))
pene_surfs = hm.Collection(model,ent.Surface,populate=False)
inter_surfs = hm.Collection(model,ent.Surface,populate=False)

model.hm_collisioninit(tolerance=-1.0, allowable_depth=0.2)
model.hm_collisionentitycreate(collection=checking_surfs,dimension=0,thickness_type=1,
                                thickness=0,edge_penetration=0,midside_nodes=0,
                                split_quads=0,used_topology=0,)
model.hm_collisioncheck(intersected_surfaces=inter_surfs,penetrated_surfaces=pene_surfs,)
model.hm_collisionend()

print("Intersected surfaces: ", [s.id for s in pene_surfs])
print("Penetrated surfaces: ", [s.id for s in pene_surfs])