mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-21 00:09:42 +05:00
first working version of the plugin
This commit is contained in:
parent
c07b5ec312
commit
4d7ec7e96b
@ -22,15 +22,21 @@
|
|||||||
import salome_pluginsmanager
|
import salome_pluginsmanager
|
||||||
|
|
||||||
def t_shape_fluid(context):
|
def t_shape_fluid(context):
|
||||||
activeStudy = context.study
|
import t_shape_builder
|
||||||
import t_shape_dialog
|
import t_shape_dialog
|
||||||
|
import xalome
|
||||||
|
activeStudy = context.study
|
||||||
|
|
||||||
dialog = t_shape_dialog.TShapeDialog()
|
dialog = t_shape_dialog.TShapeDialog()
|
||||||
|
|
||||||
# Get the parameter values from a gui dialog box. If the dialog is
|
# Get the parameter values from a gui dialog box. If the dialog is
|
||||||
# closed using the Ok button, then the data are requested from the
|
# closed using the Ok button, then the data are requested from the
|
||||||
# gui and used to create the shape of the tube.
|
# gui and used to create the shape of the tube.
|
||||||
dialog.exec_()
|
dialog.exec_()
|
||||||
dialog.getData()
|
r1, r2, h1, h2 = dialog.getData()
|
||||||
|
shape = t_shape_builder.build_shape(activeStudy, r1, r2, h1, h2)
|
||||||
|
entry = xalome.addToStudy(activeStudy, shape, "T_shape_fluid" )
|
||||||
|
xalome.displayShape(entry)
|
||||||
#if dialog.wasOk():
|
#if dialog.wasOk():
|
||||||
#radius, length, width = dialog.getData()
|
#radius, length, width = dialog.getData()
|
||||||
#shape = tubebuilder.createGeometry(activeStudy, radius, length, width)
|
#shape = tubebuilder.createGeometry(activeStudy, radius, length, width)
|
||||||
|
@ -3,38 +3,35 @@
|
|||||||
import sys
|
import sys
|
||||||
import salome
|
import salome
|
||||||
|
|
||||||
salome.salome_init()
|
|
||||||
theStudy = salome.myStudy
|
|
||||||
|
|
||||||
import GEOM
|
import GEOM
|
||||||
from salome.geom import geomBuilder
|
from salome.geom import geomBuilder
|
||||||
import math
|
import math
|
||||||
import SALOMEDS
|
import SALOMEDS
|
||||||
|
|
||||||
geompy = geomBuilder.New(theStudy)
|
|
||||||
|
|
||||||
O = geompy.MakeVertex(0, 0, 0)
|
#O = geompy.MakeVertex(0, 0, 0)
|
||||||
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
#OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||||
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
#OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||||
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
#OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||||
|
|
||||||
geompy.addToStudy( O, 'O' )
|
#geompy.addToStudy( O, 'O' )
|
||||||
geompy.addToStudy( OX, 'OX' )
|
#geompy.addToStudy( OX, 'OX' )
|
||||||
geompy.addToStudy( OY, 'OY' )
|
#geompy.addToStudy( OY, 'OY' )
|
||||||
geompy.addToStudy( OZ, 'OZ' )
|
#geompy.addToStudy( OZ, 'OZ' )
|
||||||
|
|
||||||
r1 = 100.0
|
#r1 = 100.0
|
||||||
r2 = 50.0
|
#r2 = 50.0
|
||||||
h1 = 200.0
|
#h1 = 200.0
|
||||||
h2 = 200.0
|
#h2 = 200.0
|
||||||
|
|
||||||
a1 = 45.0
|
def demidisk(study, r1, a1, roty=0):
|
||||||
seuilmax = 0.1
|
geompy = geomBuilder.New(study)
|
||||||
ratio = float(r2)/float(r1)
|
|
||||||
if ratio > (1.0 -seuilmax):
|
O = geompy.MakeVertex(0, 0, 0)
|
||||||
a1 = 45.0*(1.0 -ratio)/seuilmax
|
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||||
|
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||||
|
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||||
|
|
||||||
def demidisk(r1, a1, roty=0):
|
|
||||||
v=range(8)
|
v=range(8)
|
||||||
l=range(8)
|
l=range(8)
|
||||||
v0 = geompy.MakeVertex(0, 0, 0)
|
v0 = geompy.MakeVertex(0, 0, 0)
|
||||||
@ -71,7 +68,8 @@ def demidisk(r1, a1, roty=0):
|
|||||||
else:
|
else:
|
||||||
return v, l, arc1, part1
|
return v, l, arc1, part1
|
||||||
|
|
||||||
def pointsProjetes(vref, face):
|
def pointsProjetes(study, vref, face):
|
||||||
|
geompy = geomBuilder.New(study)
|
||||||
vface = geompy.ExtractShapes(face, geompy.ShapeType["VERTEX"], True)
|
vface = geompy.ExtractShapes(face, geompy.ShapeType["VERTEX"], True)
|
||||||
vord = range(len(vref))
|
vord = range(len(vref))
|
||||||
plan = geompy.MakePlaneThreePnt(vref[0], vref[1], vref[-1], 10000)
|
plan = geompy.MakePlaneThreePnt(vref[0], vref[1], vref[-1], 10000)
|
||||||
@ -84,7 +82,8 @@ def pointsProjetes(vref, face):
|
|||||||
vord[dist[0][1]] = vface[i]
|
vord[dist[0][1]] = vface[i]
|
||||||
return vord
|
return vord
|
||||||
|
|
||||||
def arcsProjetes(vf, face):
|
def arcsProjetes(study, vf, face):
|
||||||
|
geompy = geomBuilder.New(study)
|
||||||
lface = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True)
|
lface = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True)
|
||||||
lord = range(3)
|
lord = range(3)
|
||||||
ends = [vf[1], vf[6], vf[7], vf[3]]
|
ends = [vf[1], vf[6], vf[7], vf[3]]
|
||||||
@ -99,73 +98,88 @@ def arcsProjetes(vf, face):
|
|||||||
pass
|
pass
|
||||||
return lord
|
return lord
|
||||||
|
|
||||||
# --- sections droites des deux demi cylindres avec le partionnement
|
def build_shape(study, r1, r2, h1, h2):
|
||||||
|
geompy = geomBuilder.New(study)
|
||||||
|
|
||||||
v1, l1, arc1, part1 = demidisk(r1, a1)
|
O = geompy.MakeVertex(0, 0, 0)
|
||||||
v2, l2, arc2, part2 = demidisk(r2, a1, 90.0)
|
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
||||||
|
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
||||||
|
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||||
|
|
||||||
geompy.addToStudy(part1, 'part1')
|
a1 = 45.0
|
||||||
geompy.addToStudy(part2, 'part2')
|
seuilmax = 0.1
|
||||||
|
ratio = float(r2)/float(r1)
|
||||||
|
if ratio > (1.0 -seuilmax):
|
||||||
|
a1 = 45.0*(1.0 -ratio)/seuilmax
|
||||||
|
|
||||||
# --- extrusion des sections --> demi cylindres de travail, pour en extraire les sections utilisées au niveau du Té
|
|
||||||
# et enveloppe cylindrique du cylindre principal
|
|
||||||
|
|
||||||
demicyl1 = geompy.MakePrismVecH(part1, OX, h1)
|
# --- sections droites des deux demi cylindres avec le partionnement
|
||||||
demicyl2 = geompy.MakePrismVecH(part2, OZ, h2)
|
|
||||||
arcextru = geompy.MakePrismVecH(arc1, OX, h1)
|
|
||||||
|
|
||||||
geompy.addToStudy(demicyl1, 'demicyl1')
|
v1, l1, arc1, part1 = demidisk(study, r1, a1)
|
||||||
geompy.addToStudy(demicyl2, 'demicyl2')
|
v2, l2, arc2, part2 = demidisk(study, r2, a1, 90.0)
|
||||||
geompy.addToStudy(arcextru, 'arcextru')
|
|
||||||
|
|
||||||
# --- plan de coupe à 45° sur le cylindre principal,
|
geompy.addToStudy(part1, 'part1')
|
||||||
# section à 45° du cylndre principal,
|
geompy.addToStudy(part2, 'part2')
|
||||||
# section du cylindre secondaire par l'enveloppe cylindique du cylindre principal
|
|
||||||
|
|
||||||
plan1 = geompy.MakePlane(O, OX, 4*r1)
|
# --- extrusion des sections --> demi cylindres de travail, pour en extraire les sections utilisées au niveau du Té
|
||||||
planr = geompy.MakeRotation(plan1, OY, 45*math.pi/180.0)
|
# et enveloppe cylindrique du cylindre principal
|
||||||
geompy.addToStudy(planr, 'planr')
|
|
||||||
|
|
||||||
sect45 = geompy.MakeCommonList([demicyl1, planr], True)
|
demicyl1 = geompy.MakePrismVecH(part1, OX, h1)
|
||||||
geompy.addToStudy(sect45, 'sect45')
|
demicyl2 = geompy.MakePrismVecH(part2, OZ, h2)
|
||||||
|
arcextru = geompy.MakePrismVecH(arc1, OX, h1)
|
||||||
|
|
||||||
sect90 = geompy.MakeCommonList([demicyl2, arcextru], True)
|
geompy.addToStudy(demicyl1, 'demicyl1')
|
||||||
geompy.addToStudy(sect90, 'sect90')
|
geompy.addToStudy(demicyl2, 'demicyl2')
|
||||||
|
geompy.addToStudy(arcextru, 'arcextru')
|
||||||
|
|
||||||
# --- liste ordonnée des points projetés sur les deux sections
|
# --- plan de coupe à 45° sur le cylindre principal,
|
||||||
|
# section à 45° du cylndre principal,
|
||||||
|
# section du cylindre secondaire par l'enveloppe cylindique du cylindre principal
|
||||||
|
|
||||||
vord45 = pointsProjetes(v1, sect45)
|
plan1 = geompy.MakePlane(O, OX, 4*r1)
|
||||||
vord90 = pointsProjetes(v2, sect90)
|
planr = geompy.MakeRotation(plan1, OY, 45*math.pi/180.0)
|
||||||
for i,v in enumerate(vord45):
|
geompy.addToStudy(planr, 'planr')
|
||||||
|
|
||||||
|
sect45 = geompy.MakeCommonList([demicyl1, planr], True)
|
||||||
|
geompy.addToStudy(sect45, 'sect45')
|
||||||
|
|
||||||
|
sect90 = geompy.MakeCommonList([demicyl2, arcextru], True)
|
||||||
|
geompy.addToStudy(sect90, 'sect90')
|
||||||
|
|
||||||
|
# --- liste ordonnée des points projetés sur les deux sections
|
||||||
|
|
||||||
|
vord45 = pointsProjetes(study, v1, sect45)
|
||||||
|
vord90 = pointsProjetes(study, v2, sect90)
|
||||||
|
for i,v in enumerate(vord45):
|
||||||
geompy.addToStudyInFather(sect45, v, 'v%d'%i)
|
geompy.addToStudyInFather(sect45, v, 'v%d'%i)
|
||||||
for i,v in enumerate(vord90):
|
for i,v in enumerate(vord90):
|
||||||
geompy.addToStudyInFather(sect90, v, 'v%d'%i)
|
geompy.addToStudyInFather(sect90, v, 'v%d'%i)
|
||||||
|
|
||||||
# --- identification des projections des trois arcs de cercle, sur les deux sections.
|
# --- identification des projections des trois arcs de cercle, sur les deux sections.
|
||||||
|
|
||||||
lord45 = arcsProjetes(vord45, sect45)
|
lord45 = arcsProjetes(study, vord45, sect45)
|
||||||
lord90 = arcsProjetes(vord90, sect90)
|
lord90 = arcsProjetes(study, vord90, sect90)
|
||||||
for i,l in enumerate(lord45):
|
for i,l in enumerate(lord45):
|
||||||
geompy.addToStudyInFather(sect45, l, 'l%d'%i)
|
geompy.addToStudyInFather(sect45, l, 'l%d'%i)
|
||||||
for i,l in enumerate(lord90):
|
for i,l in enumerate(lord90):
|
||||||
geompy.addToStudyInFather(sect90, l, 'l%d'%i)
|
geompy.addToStudyInFather(sect90, l, 'l%d'%i)
|
||||||
|
|
||||||
# --- abaissement des quatre points centraux de la section du cylindre secondaire
|
# --- abaissement des quatre points centraux de la section du cylindre secondaire
|
||||||
|
|
||||||
dz = -r2/2.0
|
dz = -r2/2.0
|
||||||
for i in (0, 2, 4, 5):
|
for i in (0, 2, 4, 5):
|
||||||
vord90[i] = geompy.TranslateDXDYDZ(vord90[i], 0, 0, dz, True)
|
vord90[i] = geompy.TranslateDXDYDZ(vord90[i], 0, 0, dz, True)
|
||||||
geompy.addToStudyInFather(sect90, vord90[i], 'vm%d'%i)
|
geompy.addToStudyInFather(sect90, vord90[i], 'vm%d'%i)
|
||||||
|
|
||||||
# --- création des deux arêtes curvilignes sur l'enveloppe cylindrique du cylindre principal, à la jonction
|
# --- création des deux arêtes curvilignes sur l'enveloppe cylindrique du cylindre principal, à la jonction
|
||||||
|
|
||||||
curv = [None for i in range(4)] # liaisons entre les points 1, 3, 6 et 7 des 2 sections
|
curv = [None for i in range(4)] # liaisons entre les points 1, 3, 6 et 7 des 2 sections
|
||||||
|
|
||||||
curv[0] = geompy.MakeArcCenter(O, vord90[1] , vord45[1], False)
|
curv[0] = geompy.MakeArcCenter(O, vord90[1] , vord45[1], False)
|
||||||
curv[1] = geompy.MakeArcCenter(O, vord90[3] , vord45[3], False)
|
curv[1] = geompy.MakeArcCenter(O, vord90[3] , vord45[3], False)
|
||||||
|
|
||||||
lipts = ((6, 6, 4), (7, 7, 5))
|
lipts = ((6, 6, 4), (7, 7, 5))
|
||||||
for i, ipts in enumerate(lipts):
|
for i, ipts in enumerate(lipts):
|
||||||
print i, ipts
|
print i, ipts
|
||||||
p0 = vord90[ipts[0]]
|
p0 = vord90[ipts[0]]
|
||||||
p1 = vord45[ipts[1]]
|
p1 = vord45[ipts[1]]
|
||||||
@ -184,84 +198,85 @@ for i, ipts in enumerate(lipts):
|
|||||||
curv[i+2] =l
|
curv[i+2] =l
|
||||||
#print "curv_%d OK"%i
|
#print "curv_%d OK"%i
|
||||||
break
|
break
|
||||||
for i,l in enumerate(curv):
|
for i,l in enumerate(curv):
|
||||||
geompy.addToStudyInFather(arcextru, l, "curv%d"%i)
|
geompy.addToStudyInFather(arcextru, l, "curv%d"%i)
|
||||||
|
|
||||||
# --- creation des arêtes droites manquantes, des faces et volumes pour les quatre volumes de la jonction
|
# --- creation des arêtes droites manquantes, des faces et volumes pour les quatre volumes de la jonction
|
||||||
|
|
||||||
edges = [None for i in range(8)]
|
edges = [None for i in range(8)]
|
||||||
edges[0] = geompy.MakeLineTwoPnt(vord45[0], vord90[0])
|
edges[0] = geompy.MakeLineTwoPnt(vord45[0], vord90[0])
|
||||||
edges[1] = curv[0]
|
edges[1] = curv[0]
|
||||||
edges[2] = geompy.MakeLineTwoPnt(vord45[2], vord90[2])
|
edges[2] = geompy.MakeLineTwoPnt(vord45[2], vord90[2])
|
||||||
edges[3] = curv[1]
|
edges[3] = curv[1]
|
||||||
edges[4] = geompy.MakeLineTwoPnt(vord45[4], vord90[4])
|
edges[4] = geompy.MakeLineTwoPnt(vord45[4], vord90[4])
|
||||||
edges[5] = geompy.MakeLineTwoPnt(vord45[5], vord90[5])
|
edges[5] = geompy.MakeLineTwoPnt(vord45[5], vord90[5])
|
||||||
edges[6] = curv[2]
|
edges[6] = curv[2]
|
||||||
edges[7] = curv[3]
|
edges[7] = curv[3]
|
||||||
for i,l in enumerate(edges):
|
for i,l in enumerate(edges):
|
||||||
geompy.addToStudy( l, "edge%d"%i)
|
geompy.addToStudy( l, "edge%d"%i)
|
||||||
|
|
||||||
ed45 = [None for i in range(8)]
|
ed45 = [None for i in range(8)]
|
||||||
ed45[0] = geompy.MakeLineTwoPnt(vord45[0], vord45[2])
|
ed45[0] = geompy.MakeLineTwoPnt(vord45[0], vord45[2])
|
||||||
ed45[1] = geompy.MakeLineTwoPnt(vord45[0], vord45[1])
|
ed45[1] = geompy.MakeLineTwoPnt(vord45[0], vord45[1])
|
||||||
ed45[2] = geompy.MakeLineTwoPnt(vord45[4], vord45[6])
|
ed45[2] = geompy.MakeLineTwoPnt(vord45[4], vord45[6])
|
||||||
ed45[3] = geompy.MakeLineTwoPnt(vord45[2], vord45[3])
|
ed45[3] = geompy.MakeLineTwoPnt(vord45[2], vord45[3])
|
||||||
ed45[4] = geompy.MakeLineTwoPnt(vord45[5], vord45[7])
|
ed45[4] = geompy.MakeLineTwoPnt(vord45[5], vord45[7])
|
||||||
ed45[5] = geompy.MakeLineTwoPnt(vord45[4], vord45[5])
|
ed45[5] = geompy.MakeLineTwoPnt(vord45[4], vord45[5])
|
||||||
ed45[6] = geompy.MakeLineTwoPnt(vord45[0], vord45[4])
|
ed45[6] = geompy.MakeLineTwoPnt(vord45[0], vord45[4])
|
||||||
ed45[7] = geompy.MakeLineTwoPnt(vord45[2], vord45[5])
|
ed45[7] = geompy.MakeLineTwoPnt(vord45[2], vord45[5])
|
||||||
for i,l in enumerate(ed45):
|
for i,l in enumerate(ed45):
|
||||||
geompy.addToStudyInFather(sect45, l, "ed45_%d"%i)
|
geompy.addToStudyInFather(sect45, l, "ed45_%d"%i)
|
||||||
|
|
||||||
ed90 = [None for i in range(8)]
|
ed90 = [None for i in range(8)]
|
||||||
ed90[0] = geompy.MakeLineTwoPnt(vord90[0], vord90[2])
|
ed90[0] = geompy.MakeLineTwoPnt(vord90[0], vord90[2])
|
||||||
ed90[1] = geompy.MakeLineTwoPnt(vord90[0], vord90[1])
|
ed90[1] = geompy.MakeLineTwoPnt(vord90[0], vord90[1])
|
||||||
ed90[2] = geompy.MakeLineTwoPnt(vord90[4], vord90[6])
|
ed90[2] = geompy.MakeLineTwoPnt(vord90[4], vord90[6])
|
||||||
ed90[3] = geompy.MakeLineTwoPnt(vord90[2], vord90[3])
|
ed90[3] = geompy.MakeLineTwoPnt(vord90[2], vord90[3])
|
||||||
ed90[4] = geompy.MakeLineTwoPnt(vord90[5], vord90[7])
|
ed90[4] = geompy.MakeLineTwoPnt(vord90[5], vord90[7])
|
||||||
ed90[5] = geompy.MakeLineTwoPnt(vord90[4], vord90[5])
|
ed90[5] = geompy.MakeLineTwoPnt(vord90[4], vord90[5])
|
||||||
ed90[6] = geompy.MakeLineTwoPnt(vord90[0], vord90[4])
|
ed90[6] = geompy.MakeLineTwoPnt(vord90[0], vord90[4])
|
||||||
ed90[7] = geompy.MakeLineTwoPnt(vord90[2], vord90[5])
|
ed90[7] = geompy.MakeLineTwoPnt(vord90[2], vord90[5])
|
||||||
for i,l in enumerate(ed90):
|
for i,l in enumerate(ed90):
|
||||||
geompy.addToStudyInFather(sect90, l, "ed90_%d"%i)
|
geompy.addToStudyInFather(sect90, l, "ed90_%d"%i)
|
||||||
|
|
||||||
faci = []
|
faci = []
|
||||||
faci.append(geompy.MakeFaceWires([ed45[6], edges[0], ed90[6], edges[4]], 0))
|
faci.append(geompy.MakeFaceWires([ed45[6], edges[0], ed90[6], edges[4]], 0))
|
||||||
faci.append(geompy.MakeFaceWires([ed45[7], edges[2], ed90[7], edges[5]], 0))
|
faci.append(geompy.MakeFaceWires([ed45[7], edges[2], ed90[7], edges[5]], 0))
|
||||||
faci.append(geompy.MakeFaceWires([ed45[2], edges[4], ed90[2], edges[6]], 0))
|
faci.append(geompy.MakeFaceWires([ed45[2], edges[4], ed90[2], edges[6]], 0))
|
||||||
faci.append(geompy.MakeFaceWires([ed45[5], edges[4], ed90[5], edges[5]], 0))
|
faci.append(geompy.MakeFaceWires([ed45[5], edges[4], ed90[5], edges[5]], 0))
|
||||||
faci.append(geompy.MakeFaceWires([ed45[4], edges[5], ed90[4], edges[7]], 0))
|
faci.append(geompy.MakeFaceWires([ed45[4], edges[5], ed90[4], edges[7]], 0))
|
||||||
faci.append(geompy.MakeFaceWires([ed90[0], ed90[6], ed90[5], ed90[7]], 0))
|
faci.append(geompy.MakeFaceWires([ed90[0], ed90[6], ed90[5], ed90[7]], 0))
|
||||||
faci.append(geompy.MakeFaceWires([ed90[1], ed90[6], ed90[2], lord90[0]], 0))
|
faci.append(geompy.MakeFaceWires([ed90[1], ed90[6], ed90[2], lord90[0]], 0))
|
||||||
faci.append(geompy.MakeFaceWires([ed90[2], ed90[5], ed90[4], lord90[1]], 0))
|
faci.append(geompy.MakeFaceWires([ed90[2], ed90[5], ed90[4], lord90[1]], 0))
|
||||||
faci.append(geompy.MakeFaceWires([ed90[3], ed90[7], ed90[4], lord90[2]], 0))
|
faci.append(geompy.MakeFaceWires([ed90[3], ed90[7], ed90[4], lord90[2]], 0))
|
||||||
for i,f in enumerate(faci):
|
for i,f in enumerate(faci):
|
||||||
geompy.addToStudy(f, "faci_%d"%i)
|
geompy.addToStudy(f, "faci_%d"%i)
|
||||||
|
|
||||||
# --- extrusion droite des faces de jonction, pour reconstituer les demi cylindres
|
# --- extrusion droite des faces de jonction, pour reconstituer les demi cylindres
|
||||||
|
|
||||||
extru1 = geompy.MakePrismVecH(sect45, OX, h1+10)
|
extru1 = geompy.MakePrismVecH(sect45, OX, h1+10)
|
||||||
geompy.addToStudy(extru1, "extru1")
|
geompy.addToStudy(extru1, "extru1")
|
||||||
|
|
||||||
base2 = geompy.MakePartition(faci[5:], [], [], [], geompy.ShapeType["FACE"], 0, [], 0, True)
|
base2 = geompy.MakePartition(faci[5:], [], [], [], geompy.ShapeType["FACE"], 0, [], 0, True)
|
||||||
extru2 = geompy.MakePrismVecH(base2, OZ, h2)
|
extru2 = geompy.MakePrismVecH(base2, OZ, h2)
|
||||||
geompy.addToStudy(extru2, "extru2")
|
geompy.addToStudy(extru2, "extru2")
|
||||||
|
|
||||||
# --- partition et coupe
|
# --- partition et coupe
|
||||||
|
|
||||||
demiDisque = geompy.MakeFaceWires([arc1, l1[0]], 1)
|
demiDisque = geompy.MakeFaceWires([arc1, l1[0]], 1)
|
||||||
demiCylindre = geompy.MakePrismVecH(demiDisque, OX, h1)
|
demiCylindre = geompy.MakePrismVecH(demiDisque, OX, h1)
|
||||||
#geompy.addToStudy(demiCylindre, "demiCylindre")
|
#geompy.addToStudy(demiCylindre, "demiCylindre")
|
||||||
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)
|
||||||
#geompy.addToStudy(rot, "rot")
|
#geompy.addToStudy(rot, "rot")
|
||||||
garder = geompy.MakeCutList(demiCylindre, [extru2, rot], True)
|
garder = geompy.MakeCutList(demiCylindre, [extru2, rot], True)
|
||||||
geompy.addToStudy(garder, "garder")
|
geompy.addToStudy(garder, "garder")
|
||||||
raccord = geompy.MakePartition([garder], faci, [], [], geompy.ShapeType["SOLID"], 0, [], 0, True)
|
raccord = geompy.MakePartition([garder], faci, [], [], geompy.ShapeType["SOLID"], 0, [], 0, True)
|
||||||
assemblage = geompy.MakePartition([raccord, extru1, extru2], [], [], [], geompy.ShapeType["SOLID"], 0, [], 0, True)
|
assemblage = geompy.MakePartition([raccord, extru1, extru2], [], [], [], geompy.ShapeType["SOLID"], 0, [], 0, True)
|
||||||
geompy.addToStudy(assemblage, "assemblage")
|
geompy.addToStudy(assemblage, "assemblage")
|
||||||
|
|
||||||
box = geompy.MakeBox(-1, -(r1+r2), -1, h1, r1+r2, h2)
|
box = geompy.MakeBox(-1, -(r1+r2), -1, h1, r1+r2, h2)
|
||||||
geompy.addToStudy(box, "box")
|
geompy.addToStudy(box, "box")
|
||||||
final = geompy.MakeCommonList([box, assemblage], True)
|
final = geompy.MakeCommonList([box, assemblage], True)
|
||||||
geompy.addToStudy(final, "final")
|
|
||||||
|
return final
|
||||||
|
@ -40,7 +40,12 @@ class TShapeDialog(QtGui.QDialog):
|
|||||||
QtGui.QDialog.accept(self)
|
QtGui.QDialog.accept(self)
|
||||||
|
|
||||||
def getData(self):
|
def getData(self):
|
||||||
print "DATA : %f"%(self.ui.doubleSpinBox.value())
|
r1 = self.ui.doubleSpinBox.value()
|
||||||
|
r2 = self.ui.doubleSpinBox_2.value()
|
||||||
|
h1 = self.ui.doubleSpinBox_3.value()
|
||||||
|
h2 = self.ui.doubleSpinBox_4.value()
|
||||||
|
|
||||||
|
return r1, r2, h1, h2
|
||||||
|
|
||||||
#def setupUi(self):
|
#def setupUi(self):
|
||||||
#TShapeDialog_UI.setupUi(self)
|
#TShapeDialog_UI.setupUi(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user