import salome
salome.salome_init()
-import MEDLoader
+import SMESH
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
+#import MEDLoader
import HYDROPy
from PyQt5.QtWidgets import QDialog, QFileDialog, QTableWidgetItem, QComboBox, QMessageBox
def get_med_groups( file_path ):
#print "get_med_groups", file_path
try:
- meshes = MEDLoader.GetMeshNames(file_path)
+ #meshes = MEDLoader.GetMeshNames(file_path)
+ (meshes, status) = smesh.CreateMeshesFromMED(file_path)
except:
print 'No meshes found'
return []
mesh1 = meshes[0]
print 'Found mesh:', mesh1
try:
- groups = list(MEDLoader.GetMeshGroupsNames(file_path, mesh1))
+ #groups = list(MEDLoader.GetMeshGroupsNames(file_path, mesh1))
+ grps = mesh1.GetGroups()
+ groups = [grp.GetName() for grp in grps if grp.GetType() == SMESH.NODE]
+ if len(groups) == 0:
+ print "Problem! There are no groups of nodes in the mesh!"
+ print "Please create at least the groups of nodes corresponding to each region of the HYDRO case"
+ return []
print 'Found groups:', groups
except:
print 'No groups found'
rname = r.GetName()
regions_names.append( str(rname) )
- shape_groups = case.GetGeometryGroups()
- for sg in shape_groups:
- sgname = sg.GetName()
- regions_names.append( sgname )
+# shape_groups = case.GetGeometryGroups()
+# for sg in shape_groups:
+# sgname = sg.GetName()
+# regions_names.append( sgname )
return regions_names
else:
self.UndefZ.setRange( -100000, 100000 )
self.UndefZ.setValue( -9999 )
self.InterpMethod.addItem( "Interpolation at the nearest point" )
+ self.InterpMethod.addItem( "Linear interpolation on a cloud triangulation" )
self.ApplyClose.clicked.connect(self.onApplyClose)
self.Apply.clicked.connect(self.onApply)
self.Close.clicked.connect(self.onClose)
self.Groups.item( i, 0 ).setText( self.med_groups[i] )
cb = QComboBox( self.Groups )
+ cb.addItem( 'None' )
for r in self.regions:
cb.addItem( r )
self.Groups.setCellWidget( i, 1, cb )
for i in range( 0, self.Groups.rowCount() ):
med_group = str( self.Groups.item( i, 0 ).text() )
hydro_reg = str( self.Groups.cellWidget( i, 1 ).currentText() )
- if len(med_group)>0 and len(hydro_reg)>0:
+ if len(med_group)>0 and len(hydro_reg)>0 and hydro_reg != 'None' :
med_groups_regions[med_group] = hydro_reg
z_undef = self.UndefZ.value()
interp = str(self.InterpMethod.currentText())
result = False
if len(msg)==0:
- generate( path, calc_case, med_file, med_groups_regions, z_undef, interp )
+ iinterp = 0
+ if 'Linear' in interp:
+ iinterp = 1
+ generate( path, calc_case, med_file, med_groups_regions, z_undef, iinterp )
msg = "InterpolZ script is successfully generated"
result = True