mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-14 19:00:37 +05:00
adjust progress bar on t_shape_builder plugin
This commit is contained in:
parent
8fb7cb1a01
commit
d77224c91c
@ -7,6 +7,7 @@ import GEOM
|
|||||||
from salome.geom import geomBuilder
|
from salome.geom import geomBuilder
|
||||||
import math
|
import math
|
||||||
import SALOMEDS
|
import SALOMEDS
|
||||||
|
import time
|
||||||
|
|
||||||
geompy = None
|
geompy = None
|
||||||
|
|
||||||
@ -113,7 +114,11 @@ def arcsProjetes(study, vf, face):
|
|||||||
|
|
||||||
def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
|
def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
|
||||||
""" Builds the final shape """
|
""" Builds the final shape """
|
||||||
|
|
||||||
|
if progressBar is not None:
|
||||||
|
time0 = time.time()
|
||||||
|
print time.time() -time0
|
||||||
|
|
||||||
if solid_thickness < 1e-7:
|
if solid_thickness < 1e-7:
|
||||||
with_solid = False
|
with_solid = False
|
||||||
else:
|
else:
|
||||||
@ -137,7 +142,8 @@ def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
|
|||||||
[faci, sect45, arc1, l1, lord90, lord45, edges, arcextru] = jonction(study, r1, r2,\
|
[faci, sect45, arc1, l1, lord90, lord45, edges, arcextru] = jonction(study, r1, r2,\
|
||||||
h1, h2, a1)
|
h1, h2, a1)
|
||||||
if progressBar is not None:
|
if progressBar is not None:
|
||||||
progressBar.addSteps(1)
|
progressBar.addSteps(2)
|
||||||
|
print time.time() -time0
|
||||||
|
|
||||||
if with_solid:
|
if with_solid:
|
||||||
# The same code is executed again with different external radiuses in order
|
# The same code is executed again with different external radiuses in order
|
||||||
@ -154,7 +160,8 @@ def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
|
|||||||
faces_jonction_ext.append(geompy.MakeQuad2Edges(lord45[i],lord45_ext[i]))
|
faces_jonction_ext.append(geompy.MakeQuad2Edges(lord45[i],lord45_ext[i]))
|
||||||
|
|
||||||
if progressBar is not None:
|
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
|
# --- extrusion droite des faces de jonction, pour reconstituer les demi cylindres
|
||||||
if with_solid:
|
if with_solid:
|
||||||
@ -163,6 +170,7 @@ def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
|
|||||||
|
|
||||||
if progressBar is not None:
|
if progressBar is not None:
|
||||||
progressBar.addSteps(1)
|
progressBar.addSteps(1)
|
||||||
|
print time.time() -time0
|
||||||
|
|
||||||
extru1 = geompy.MakePrismVecH(sect45, OX, h1+10)
|
extru1 = geompy.MakePrismVecH(sect45, OX, h1+10)
|
||||||
|
|
||||||
@ -174,6 +182,7 @@ def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
|
|||||||
|
|
||||||
if progressBar is not None:
|
if progressBar is not None:
|
||||||
progressBar.addSteps(1)
|
progressBar.addSteps(1)
|
||||||
|
print time.time() -time0
|
||||||
|
|
||||||
# --- partition et coupe
|
# --- partition et coupe
|
||||||
|
|
||||||
@ -185,6 +194,7 @@ def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
|
|||||||
|
|
||||||
if progressBar is not None:
|
if progressBar is not None:
|
||||||
progressBar.addSteps(1)
|
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))
|
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)
|
rot = geompy.MakeRotation(box, OY, 45*math.pi/180.0)
|
||||||
@ -193,8 +203,9 @@ def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
|
|||||||
garder = geompy.MakeCutList(demiCylindre, [extru2, rot], True)
|
garder = geompy.MakeCutList(demiCylindre, [extru2, rot], True)
|
||||||
|
|
||||||
if progressBar is not None:
|
if progressBar is not None:
|
||||||
progressBar.addSteps(10)
|
progressBar.addSteps(9)
|
||||||
|
print time.time() -time0
|
||||||
|
|
||||||
faces_coupe = faci[:5]
|
faces_coupe = faci[:5]
|
||||||
if with_solid:
|
if with_solid:
|
||||||
faces_coupe.extend(faces_jonction_ext[-7:])
|
faces_coupe.extend(faces_jonction_ext[-7:])
|
||||||
@ -203,7 +214,8 @@ def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
|
|||||||
assemblage = geompy.MakeGlueFaces(assemblage, 1e-7)
|
assemblage = geompy.MakeGlueFaces(assemblage, 1e-7)
|
||||||
|
|
||||||
if progressBar is not None:
|
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)
|
box = geompy.MakeBox(-1, -(r1+r2+2*solid_thickness), -1, h1, r1+r2+2*solid_thickness, h2)
|
||||||
|
|
||||||
@ -212,6 +224,7 @@ def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
|
|||||||
|
|
||||||
if progressBar is not None:
|
if progressBar is not None:
|
||||||
progressBar.addSteps(5)
|
progressBar.addSteps(5)
|
||||||
|
print time.time() -time0
|
||||||
|
|
||||||
# --- Partie inférieure
|
# --- Partie inférieure
|
||||||
|
|
||||||
@ -227,6 +240,7 @@ def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
|
|||||||
|
|
||||||
if progressBar is not None:
|
if progressBar is not None:
|
||||||
progressBar.addSteps(1)
|
progressBar.addSteps(1)
|
||||||
|
print time.time() -time0
|
||||||
|
|
||||||
return final
|
return final
|
||||||
|
|
||||||
|
@ -21,13 +21,15 @@
|
|||||||
|
|
||||||
from salome.geom.t_shape import t_shape_builder
|
from salome.geom.t_shape import t_shape_builder
|
||||||
from PyQt4.QtGui import QProgressDialog
|
from PyQt4.QtGui import QProgressDialog
|
||||||
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
class t_shape_progress(QProgressDialog):
|
class t_shape_progress(QProgressDialog):
|
||||||
_totSteps = 0
|
_totSteps = 0
|
||||||
_nmaxSteps = 20
|
_nmaxSteps = 27
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, parent=None):
|
||||||
QProgressDialog.__init__(self, "t_shape fluid build", "stop", 0, self._nmaxSteps)
|
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):
|
def run(self, activeStudy, r1, r2, h1, h2, thickness):
|
||||||
shape = t_shape_builder.build_shape(activeStudy, r1, r2, h1, h2, thickness, self)
|
shape = t_shape_builder.build_shape(activeStudy, r1, r2, h1, h2, thickness, self)
|
||||||
|
Loading…
Reference in New Issue
Block a user