from salome.geom import geomBuilder
import math
import SALOMEDS
+import time
geompy = None
def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
""" Builds the final shape """
-
+
+ if progressBar is not None:
+ time0 = time.time()
+ print time.time() -time0
+
if solid_thickness < 1e-7:
with_solid = False
else:
[faci, sect45, arc1, l1, lord90, lord45, edges, arcextru] = jonction(study, r1, r2,\
h1, h2, a1)
if progressBar is not None:
- progressBar.addSteps(1)
+ progressBar.addSteps(2)
+ print time.time() -time0
if with_solid:
# The same code is executed again with different external radiuses in order
faces_jonction_ext.append(geompy.MakeQuad2Edges(lord45[i],lord45_ext[i]))
if progressBar is not None:
- progressBar.addSteps(1)
+ progressBar.addSteps(4)
+ print time.time() -time0
# --- extrusion droite des faces de jonction, pour reconstituer les demi cylindres
if with_solid:
if progressBar is not None:
progressBar.addSteps(1)
+ print time.time() -time0
extru1 = geompy.MakePrismVecH(sect45, OX, h1+10)
if progressBar is not None:
progressBar.addSteps(1)
+ print time.time() -time0
# --- partition et coupe
if progressBar is not None:
progressBar.addSteps(1)
+ print time.time() -time0
box = geompy.MakeBox(0, -2*(r1+h1), -2*(r1+h1), 2*(r1+h1), 2*(r1+h1), 2*(r1+h1))
rot = geompy.MakeRotation(box, OY, 45*math.pi/180.0)
garder = geompy.MakeCutList(demiCylindre, [extru2, rot], True)
if progressBar is not None:
- progressBar.addSteps(10)
-
+ progressBar.addSteps(9)
+ print time.time() -time0
+
faces_coupe = faci[:5]
if with_solid:
faces_coupe.extend(faces_jonction_ext[-7:])
assemblage = geompy.MakeGlueFaces(assemblage, 1e-7)
if progressBar is not None:
- progressBar.addSteps(2)
+ progressBar.addSteps(3)
+ print time.time() -time0
box = geompy.MakeBox(-1, -(r1+r2+2*solid_thickness), -1, h1, r1+r2+2*solid_thickness, h2)
if progressBar is not None:
progressBar.addSteps(5)
+ print time.time() -time0
# --- Partie inférieure
if progressBar is not None:
progressBar.addSteps(1)
+ print time.time() -time0
return final
from salome.geom.t_shape import t_shape_builder
from PyQt4.QtGui import QProgressDialog
+from PyQt4 import QtCore
class t_shape_progress(QProgressDialog):
_totSteps = 0
- _nmaxSteps = 20
+ _nmaxSteps = 27
- def __init__(self):
- QProgressDialog.__init__(self, "t_shape fluid build", "stop", 0, self._nmaxSteps)
+ def __init__(self, parent=None):
+ QProgressDialog.__init__(self, "t_shape fluid build", "stop", 0, self._nmaxSteps, parent, QtCore.Qt.Tool)
+ self.show()
def run(self, activeStudy, r1, r2, h1, h2, thickness):
shape = t_shape_builder.build_shape(activeStudy, r1, r2, h1, h2, thickness, self)