Wow this is really old. I am sorry I did not give this sooner. Maybe I did not have it then. Apologies if I missed a key point of yours in my haste. - Kirk
edge_types=[SMESH.Entity_Edge, SMESH.Entity_Quad_Edge]
face_types=[SMESH.Entity_Triangle, SMESH.Entity_Quad_Triangle, SMESH.Entity_BiQuad_Triangle]
face_types+=[SMESH.Entity_Quadrangle, SMESH.Entity_Quad_Quadrangle, SMESH.Entity_BiQuad_Quadrangle]
vol_types=[SMESH.Entity_Tetra, SMESH.Entity_Quad_Tetra, SMESH.Entity_Pyramid, SMESH.Entity_Quad_Pyramid, SMESH.Entity_Hexa]
vol_types+=[SMESH.Entity_Quad_Hexa, SMESH.Entity_TriQuad_Hexa, SMESH.Entity_Penta, SMESH.Entity_Quad_Penta, SMESH.Entity_BiQuad_Penta]
vol_types+=[SMESH.Entity_Hexagonal_Prism, SMESH.Entity_Polyhedra, SMESH.Entity_Quad_Polyhedra, SMESH.Entity_Ball]
ETdict={‘EDGE’:edge_types,‘FACE’:face_types,‘VOLUME’:vol_types}
SMETdict={‘NODE’:SMESH.NODE, ‘ELEM0D’:SMESH.ELEM0D, ‘EDGE’:SMESH.EDGE,‘FACE’:SMESH.FACE,‘VOLUME’:SMESH.VOLUME,}
def MakeElemTypeFilter(strEType):
aCriteria =
for et in ETdict[strEType]:
aCriterion = smesh.GetCriterion(SMETdict[strEType],SMESH.FT_EntityType,‘=’,et,SMESH.FT_LogicalOR)
aCriteria.append(aCriterion)
return smesh.GetFilterFromCriteria(aCriteria)
def DefineFEGroupOnGeometry(Mesh,geoRefs,strName,strEType):
aCriteria =
if type(geoRefs)!=tuple and type(geoRefs)!=list: geoRefs=(geoRefs,)
else: pass
for g in geoRefs:
aCriterion = smesh.GetCriterion(SMETdict[strEType],SMESH.FT_BelongToGeom,SMESH.FT_Undefined,g,SMESH.FT_Undefined,SMESH.FT_LogicalOR)
aCriteria.append(aCriterion)
aFilter = smesh.GetFilterFromCriteria(aCriteria)
aFilter.SetMesh(Mesh.GetMesh())
out = Mesh.GroupOnFilter(SMETdict[strEType], strName, aFilter)
return out
usage:
#Delete all edge elements (all types)
aFilter = MakeElemTypeFilter(‘EDGE’)
aFilter.SetMesh(Mesh_0.GetMesh())
ids = Mesh_0.GetIdsFromFilter(aFilter)
edges_to_delete = Mesh_0.GroupOnFilter(SMESH.EDGE, ‘edges_to_delete’, aFilter)
Mesh_0.RemoveGroupWithContents(edges_to_delete)
out_str=" Deleted %d edge elements." % len(ids)
#Get KEEP face elements
We just want the ones we need for:
slabs (both real and penetration zone)
soil loading and bearing and
flange / embedment ring contact regions
All these have ‘_fac’ in definition.
keys=GroupDict.keys()
keys=[str(k) for k in keys]
keys=[k for k in keys if ‘_fac’ in k and ‘face’ not in k]
geom_groups=[GroupDict[key][‘GEOM_obj’] for key in keys]
keep_faces = DefineFEGroupOnGeometry(Mesh_0,geom_groups,‘keep_faces’,‘FACE’)
ids = keep_faces.GetIDs(); c2=len(ids)
out_str+=“\n A total of %d face elements will be kept.” % c2
#Define del_faces by carve keep_faces from all_faces
del_faces = Mesh_0.CutGroups(all_faces,keep_faces,‘del_faces’)
ids = del_faces.GetIDs(); c3=len(ids)
out_str+=“\n A total of %d face elements will be deleted.” % c3
out_str+=“\n The expected number of deletions is: %d” % (c1-c2)
out_str+=“\n The process deviated by %d (expected - actual)” % (c1-c2-c3)
output(out_str,outpr=True)
if c1-c2-c3 != 0:
out_str=“There is a problem with the number of deleted faces expected vs actually deleted. You probably need help.”
output(out_str,outpr=True)
raise ValueError(out_str)
else: pass
Mesh_0.RemoveGroupWithContents(del_faces); del del_faces
Mesh_0.RemoveGroup(keep_faces); del keep_faces
Mesh_0.RemoveGroup(all_faces); del all_faces