mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-28 18:30:36 +05:00
NGO - Update T-Shape
This commit is contained in:
parent
c753e60105
commit
8a79f908eb
@ -22,33 +22,13 @@
|
|||||||
import salome_pluginsmanager
|
import salome_pluginsmanager
|
||||||
|
|
||||||
def t_shape_fluid(context):
|
def t_shape_fluid(context):
|
||||||
#from salome.geom.t_shape import t_shape_builder
|
|
||||||
from salome.geom.t_shape import t_shape_dialog
|
|
||||||
from salome.geom.t_shape import t_shape_progress
|
|
||||||
import xalome
|
|
||||||
from qtsalome import QMessageBox
|
|
||||||
activeStudy = context.study
|
activeStudy = context.study
|
||||||
|
|
||||||
dialog = t_shape_dialog.TShapeDialog()
|
#from salome.geom.t_shape import t_shape_builder
|
||||||
|
from salome.geom.t_shape import t_shape_dialog
|
||||||
# Get the parameter values from a gui dialog box. If the dialog is
|
dialog = t_shape_dialog.getDialog()
|
||||||
# closed using the Ok button, then the data are requested from the
|
dialog.setContext(context)
|
||||||
# gui and used to create the shape of the tube.
|
dialog.show()
|
||||||
dialog.exec_()
|
|
||||||
if dialog.wasOk():
|
|
||||||
r1, r2, h1, h2, thickness = dialog.getData()
|
|
||||||
#QMessageBox.about(None, "Building in progress", "building shape, please be patient")
|
|
||||||
#shape = t_shape_builder.build_shape(activeStudy, r1, r2, h1, h2, thickness)
|
|
||||||
shapeBuilder = t_shape_progress.t_shape_progress()
|
|
||||||
shape = shapeBuilder.run(activeStudy, r1, r2, h1, h2, thickness)
|
|
||||||
entry = xalome.addToStudy(activeStudy, shape, "T_shape_fluid" )
|
|
||||||
xalome.displayShape(entry)
|
|
||||||
#if dialog.wasOk():
|
|
||||||
#radius, length, width = dialog.getData()
|
|
||||||
#shape = tubebuilder.createGeometry(activeStudy, radius, length, width)
|
|
||||||
#entry = xalome.addToStudy(activeStudy, shape, "Tube" )
|
|
||||||
#xalome.displayShape(entry)
|
|
||||||
|
|
||||||
|
|
||||||
salome_pluginsmanager.AddFunction('T shape fluid',
|
salome_pluginsmanager.AddFunction('T shape fluid',
|
||||||
'Creates the fluid part of a pipe T-shape',
|
'Creates the fluid part of a pipe T-shape',
|
||||||
|
@ -25,43 +25,65 @@ from qtsalome import *
|
|||||||
from t_shape_dialog_ui import Ui_Dialog
|
from t_shape_dialog_ui import Ui_Dialog
|
||||||
|
|
||||||
|
|
||||||
class TShapeDialog(QDialog):
|
class TShapeDialog(Ui_Dialog,QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
QDialog.__init__(self, None, Qt.Tool)
|
QWidget.__init__(self)
|
||||||
# Set up the user interface from Designer.
|
# Set up the user interface from Designer.
|
||||||
self.ui = Ui_Dialog()
|
#self = Ui_Dialog()
|
||||||
self.ui.setupUi(self)
|
self.setupUi(self)
|
||||||
self.show()
|
self.show()
|
||||||
self._wasOk = False
|
self._wasOk = False
|
||||||
self.ui.dsb_solidThickness.setEnabled(False)
|
self.dsb_solidThickness.setEnabled(False)
|
||||||
self.ui.label_5.setEnabled(False)
|
self.label_5.setEnabled(False)
|
||||||
self.ui.dsb_bigRadius.setValue(50.0)
|
self.dsb_bigRadius.setValue(50.0)
|
||||||
self.ui.dsb_smallRadius.setValue(40.0)
|
self.dsb_smallRadius.setValue(40.0)
|
||||||
self.ui.dsb_bigHeight.setValue(80.0)
|
self.dsb_bigHeight.setValue(80.0)
|
||||||
self.ui.dsb_smallHeight.setValue(80.0)
|
self.dsb_smallHeight.setValue(80.0)
|
||||||
|
|
||||||
|
def setContext(self, context):
|
||||||
|
self._activeStudy = context.study
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
from salome.geom.t_shape import t_shape_progress
|
||||||
|
import xalome
|
||||||
self._wasOk = True
|
self._wasOk = True
|
||||||
QDialog.accept(self)
|
self.close()
|
||||||
|
r1, r2, h1, h2, thickness = self.getData()
|
||||||
|
#QMessageBox.about(None, "Building in progress", "building shape, please be patient")
|
||||||
|
#shape = t_shape_builder.build_shape(activeStudy, r1, r2, h1, h2, thickness)
|
||||||
|
shapeBuilder = t_shape_progress.t_shape_progress()
|
||||||
|
shape = shapeBuilder.run(self._activeStudy, r1, r2, h1, h2, thickness)
|
||||||
|
entry = xalome.addToStudy(self._activeStudy, shape, "T_shape_fluid" )
|
||||||
|
xalome.displayShape(entry)
|
||||||
|
|
||||||
def getData(self):
|
def getData(self):
|
||||||
r1 = self.ui.dsb_bigRadius.value()
|
r1 = self.dsb_bigRadius.value()
|
||||||
r2 = self.ui.dsb_smallRadius.value()
|
r2 = self.dsb_smallRadius.value()
|
||||||
h1 = self.ui.dsb_bigHeight.value()
|
h1 = self.dsb_bigHeight.value()
|
||||||
h2 = self.ui.dsb_smallHeight.value()
|
h2 = self.dsb_smallHeight.value()
|
||||||
thickness = 0.0
|
thickness = 0.0
|
||||||
if self.ui.cb_buildSolid.isChecked():
|
if self.cb_buildSolid.isChecked():
|
||||||
thickness = self.ui.dsb_solidThickness.value()
|
thickness = self.dsb_solidThickness.value()
|
||||||
|
|
||||||
return r1, r2, h1, h2, thickness
|
return r1, r2, h1, h2, thickness
|
||||||
|
|
||||||
def reject(self):
|
def reject(self):
|
||||||
self._wasOk = False
|
self._wasOk = False
|
||||||
QDialog.reject(self)
|
self.close()
|
||||||
|
|
||||||
def wasOk(self):
|
def wasOk(self):
|
||||||
return self._wasOk
|
return self._wasOk
|
||||||
|
|
||||||
|
__dialog=None
|
||||||
|
def getDialog():
|
||||||
|
"""
|
||||||
|
This function returns a singleton instance of the plugin dialog.
|
||||||
|
It is mandatory in order to call show without a parent ...
|
||||||
|
"""
|
||||||
|
global __dialog
|
||||||
|
if __dialog is None:
|
||||||
|
__dialog = TShapeDialog()
|
||||||
|
return __dialog
|
||||||
|
|
||||||
# ================
|
# ================
|
||||||
# Tests
|
# Tests
|
||||||
@ -74,7 +96,7 @@ def main( args ):
|
|||||||
ui = Ui_Dialog()
|
ui = Ui_Dialog()
|
||||||
ui.setupUi(Dialog)
|
ui.setupUi(Dialog)
|
||||||
Dialog.show()
|
Dialog.show()
|
||||||
sys.exit(app.exec_())
|
#sys.exit(app.exec_())
|
||||||
|
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user