smesh = smeshBuilder.New()
smesh.SetEnablePublish( False ) # Set to False to avoid publish in study if not needed
([MESH], status) = smesh.CreateMeshesFromMED(meshFile)
+ nbAdded, MESH, addedBnd = MESH.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [])
groups = MESH.GetGroups()
aCriteria = []
aCriterion = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
aFilter = smesh.GetFilterFromCriteria(aCriteria)
aFilter.SetMesh(MESH.GetMesh())
FreeBorders = MESH.GroupOnFilter( SMESH.EDGE, 'FreeBorders', aFilter )
- smesh.SetName(MESH, 'MESH')
- newMeshName = '/tmp/freeBorders.med'
+ a = os.path.splitext(meshFile)
+ smesh.SetName(MESH, os.path.basename(a[0]))
+ newMeshName = a[0] + '_brd' + a[1]
+ print(newMeshName)
try:
- MESH.ExportMED(newMeshName,auto_groups=0,minor=41,overwrite=1,meshPart=None,autoDimension=1)
+ MESH.ExportMED(newMeshName,auto_groups=0,minor=40,overwrite=1,meshPart=None,autoDimension=1)
pass
except:
print('ExportMED() failed. Invalid file name?')
d1=-1 # when dimension 2, edges are dim -1
if dim == 3: # when dimension 3, edges are dim -2
d1=-2
+ a = os.path.splitext(meshFile)
+ prefix = os.path.basename(a[0])
grp_names = mcMesh.getGroupsOnSpecifiedLev(d1) #names of edges groups
groups = [mcMesh.getGroup(d1, name) for name in grp_names]
for (grp, grpName) in zip(groups, grp_names):
- nodeChains = explodeGroup(grp, grpName)
- writeShapeLines(mcMesh, grpName, nodeChains, offsetX, offsetY)
- writeShapePoints(mcMesh, grpName, nodeChains, offsetX, offsetY)
+ fullGrpName = prefix + '_' + grpName
+ nodeChains = explodeGroup(grp, fullGrpName)
+ writeShapeLines(mcMesh, fullGrpName, nodeChains, offsetX, offsetY)
+ writeShapePoints(mcMesh, fullGrpName, nodeChains, offsetX, offsetY)
def fitShapePointsToMesh(freeBorderShapefile, shapefileToAdjust):