Salome HOME
projects
/
modules
/
hydro.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Correction for hydro_test
[modules/hydro.git]
/
src
/
HYDROTools
/
shapesGroups.py
diff --git
a/src/HYDROTools/shapesGroups.py
b/src/HYDROTools/shapesGroups.py
index f4673d800e977a5d1ee196980532d34b4b93be10..7f3b7e0b99794aaa46ea6c239253c48f092a2746 100644
(file)
--- a/
src/HYDROTools/shapesGroups.py
+++ b/
src/HYDROTools/shapesGroups.py
@@
-12,7
+12,7
@@
import medcoupling as mc
import shapefile
import math
import os
import shapefile
import math
import os
-
+import json
def freeBordersGroup(meshFileIn, meshFileOut=""):
"""
def freeBordersGroup(meshFileIn, meshFileOut=""):
"""
@@
-159,6
+159,7
@@
def writeShapeLines(mcMesh, grpName, nodeChains, outputDirectory, offsetX=0., of
w.line([chaincoords])
w.record(chainName)
w.close()
w.line([chaincoords])
w.record(chainName)
w.close()
+ return shapeFileName + '.shp'
def writeShapePoints(mcMesh, grpName, nodeChains, outputDirectory, offsetX=0., offsetY=0.):
def writeShapePoints(mcMesh, grpName, nodeChains, outputDirectory, offsetX=0., offsetY=0.):
@@
-216,12
+217,16
@@
def exploreEdgeGroups(meshFile, outputDirectory="", offsetX=0., offsetY=0.):
groups = [mcMesh.getGroup(d1, name) for name in grp_names] # list of groups in their name order
groups = [mcMesh.getGroup(d1, name) for name in grp_names] # list of groups in their name order
+ filenames = []
for (grp, grpName) in zip(groups, grp_names):
fullGrpName = prefix + '_' + grpName
nodeChains = explodeGroup(grp, fullGrpName)
for (grp, grpName) in zip(groups, grp_names):
fullGrpName = prefix + '_' + grpName
nodeChains = explodeGroup(grp, fullGrpName)
- writeShapeLines(mcMesh, fullGrpName, nodeChains, outputDirectory, offsetX, offsetY)
+
filename =
writeShapeLines(mcMesh, fullGrpName, nodeChains, outputDirectory, offsetX, offsetY)
writeShapePoints(mcMesh, fullGrpName, nodeChains, outputDirectory, offsetX, offsetY)
writeShapePoints(mcMesh, fullGrpName, nodeChains, outputDirectory, offsetX, offsetY)
-
+ filenames.append(filename)
+ shapesListFile = os.path.join(outputDirectory, "shapesList.json")
+ with open(shapesListFile, 'w') as f:
+ json.dump(filenames, f)
def fitShapePointsToMesh(freeBorderShapefile, shapefileToAdjust, outputDirectory="", splitFreeBorder=True, splitShapeAdjusted=True):
"""
def fitShapePointsToMesh(freeBorderShapefile, shapefileToAdjust, outputDirectory="", splitFreeBorder=True, splitShapeAdjusted=True):
"""
@@
-304,7
+309,7
@@
def fitShapePointsToMesh(freeBorderShapefile, shapefileToAdjust, outputDirectory
outputDirectory = os.path.dirname(shapefileToAdjust)
a = os.path.splitext(os.path.basename(shapefileToAdjust))
shapefileAdjusted = os.path.join(outputDirectory, a[0] + '_adj' + a[1])
outputDirectory = os.path.dirname(shapefileToAdjust)
a = os.path.splitext(os.path.basename(shapefileToAdjust))
shapefileAdjusted = os.path.join(outputDirectory, a[0] + '_adj' + a[1])
- chainName = a[0]
+ chainName = a[0]
+ '_adj'
w = shapefile.Writer(shapefileAdjusted)
w.shapeType = 3
w = shapefile.Writer(shapefileAdjusted)
w.shapeType = 3
@@
-354,7
+359,7
@@
def fitShapePointsToMesh(freeBorderShapefile, shapefileToAdjust, outputDirectory
outputDirectory = os.path.dirname(freeBorderShapefile)
a = os.path.splitext(os.path.basename(freeBorderShapefile))
freeBorderSplit = os.path.join(outputDirectory, a[0] + '_split' + a[1])
outputDirectory = os.path.dirname(freeBorderShapefile)
a = os.path.splitext(os.path.basename(freeBorderShapefile))
freeBorderSplit = os.path.join(outputDirectory, a[0] + '_split' + a[1])
- chainName = a[0]
+ chainName = a[0]
+ '_split'
w = shapefile.Writer(freeBorderSplit)
w.shapeType = 3
w = shapefile.Writer(freeBorderSplit)
w.shapeType = 3