Affichage filtré des objets créés

This commit is contained in:
GERALD NICOLAS 2021-04-06 11:42:59 +02:00
parent d439ade3e9
commit e27e2a377c
4 changed files with 201 additions and 234 deletions

View File

@ -18,33 +18,40 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
"""Cas-test de blocFissure pour un cube""" """Géométries nécessaires aux cas-tests :
. cubeAngle
. cubeAngle2
"""
import logging
import os import os
from blocFissure import gmu import logging
import salome import salome
import GEOM
from salome.geom import geomBuilder
import SMESH
from salome.smesh import smeshBuilder from salome.smesh import smeshBuilder
import GEOM
import SMESH
import SALOMEDS
from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy
from blocFissure.gmu.geomsmesh import geomPublish
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.putName import putName
from blocFissure.gmu import initLog
#=============== Options ==================== #=============== Options ====================
# 1. NOM_OBJET = nom de l'objet # 1. NOM_OBJET = nom de l'objet
NOM_OBJET = "CubeAngle" NOM_OBJET = "CubeAngle"
#============================================ #============================================
salome.salome_init()
### ###
### GEOM component ### GEOM component
### ###
geompy = geomBuilder.New() O, OX, OY, OZ = triedreBase()
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Vertex_1 = geompy.MakeVertex(0, 0, 100) Vertex_1 = geompy.MakeVertex(0, 0, 100)
Disk_1 = geompy.MakeDiskPntVecR(Vertex_1, OZ, 60) Disk_1 = geompy.MakeDiskPntVecR(Vertex_1, OZ, 60)
@ -53,14 +60,13 @@ Vertex_3 = geompy.MakeVertex(65, 65, 110)
Box_2 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2) Box_2 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Common_1 = geompy.MakeCommon(Disk_1, Box_2) Common_1 = geompy.MakeCommon(Disk_1, Box_2)
geompy.addToStudy( OZ, 'OZ' ) geompy.addToStudy( Box_1, NOM_OBJET )
geompy.addToStudy( Box_1, 'Box_1' ) geomPublish(initLog.debug, Vertex_1, 'Vertex_1' )
geompy.addToStudy( Vertex_1, 'Vertex_1' ) geomPublish(initLog.debug, Disk_1, 'Disk_1' )
geompy.addToStudy( Disk_1, 'Disk_1' ) geomPublish(initLog.debug, Vertex_2, 'Vertex_2' )
geompy.addToStudy( Vertex_2, 'Vertex_2' ) geomPublish(initLog.debug, Vertex_3, 'Vertex_3' )
geompy.addToStudy( Vertex_3, 'Vertex_3' ) geomPublish(initLog.debug, Box_2, 'Box_2' )
geompy.addToStudy( Box_2, 'Box_2' ) geompy.addToStudy( Common_1, NOM_OBJET+'_Fissure' )
geompy.addToStudy( Common_1, NOM_OBJET )
ficcao = os.path.join(gmu.pathBloc, "materielCasTests", "{}Fiss.brep".format(NOM_OBJET)) ficcao = os.path.join(gmu.pathBloc, "materielCasTests", "{}Fiss.brep".format(NOM_OBJET))
text = ".. Exportation de la géométrie de la fissure dans le fichier '{}'".format(ficcao) text = ".. Exportation de la géométrie de la fissure dans le fichier '{}'".format(ficcao)
@ -71,16 +77,22 @@ geompy.ExportBREP(Common_1, ficcao)
### SMESH component ### SMESH component
### ###
smesh = smeshBuilder.New() smesh = smeshBuilder.New()
Mesh_1 = smesh.Mesh(Box_1) Mesh_1 = smesh.Mesh(Box_1)
smesh.SetName(Mesh_1, NOM_OBJET) putName(Mesh_1, NOM_OBJET)
Regular_1D = Mesh_1.Segment() Regular_1D = Mesh_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(15) Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
Nb_Segments_1.SetDistrType( 0 ) Nb_Segments_1.SetDistrType( 0 )
Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa) Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa)
## set object names
#putName(Regular_1D.GetAlgorithm(), 'Regular_1D')
#putName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
#putName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
putName(Nb_Segments_1, 'Nb. Segments_1', i_pref='cubeAngle')
is_done = Mesh_1.Compute() is_done = Mesh_1.Compute()
text = "Mesh_1.Compute" text = "Mesh_1.Compute"
if is_done: if is_done:
@ -95,11 +107,5 @@ text = ".. Archivage du maillage dans le fichier '{}'".format(ficmed)
logging.info(text) logging.info(text)
Mesh_1.ExportMED(ficmed) Mesh_1.ExportMED(ficmed)
## set object names
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
if salome.sg.hasDesktop(): if salome.sg.hasDesktop():
salome.sg.updateObjBrowser() salome.sg.updateObjBrowser()

View File

@ -17,35 +17,38 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
"""Géométries nécessaires aux cas-tests :
. cubeFin_Transverse
. cubeFin_Coin
. cubeFin_Milieu
"""
import os
import math
import logging import logging
import sys
import salome import salome
from salome.smesh import smeshBuilder
import GEOM
import SMESH
import SALOMEDS
salome.salome_init()
import salome_notebook
import os
from blocFissure import gmu from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy
from blocFissure.gmu.geomsmesh import geomPublish
from blocFissure.gmu.geomsmesh import geomPublishInFather
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.putName import putName
from blocFissure.gmu import initLog
### ###
### GEOM component ### GEOM component
### ###
import GEOM O, OX, OY, OZ = triedreBase()
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
cubeFin = geompy.MakeBoxDXDYDZ(200, 200, 200) cubeFin = geompy.MakeBoxDXDYDZ(200, 200, 200)
[DEPL,ENCASTR] = geompy.SubShapes(cubeFin, [27, 23]) [DEPL,ENCASTR] = geompy.SubShapes(cubeFin, [27, 23])
origCoin = geompy.MakeVertex(0, 160, 200) origCoin = geompy.MakeVertex(0, 160, 200)
@ -72,45 +75,38 @@ Arc_1 = geompy.MakeArc(Line_1_vertex_3, Vertex_5, Line_3_vertex_2)
Face_1 = geompy.MakeFaceWires([Line_1, Line_3, Line_4, Arc_1], 1) Face_1 = geompy.MakeFaceWires([Line_1, Line_3, Line_4, Arc_1], 1)
cubeFin_Coin = geompy.MakeCommonList([Rotation_1, Face_1], True) cubeFin_Coin = geompy.MakeCommonList([Rotation_1, Face_1], True)
cubeFin_Milieu = geompy.MakeCommonList([Scale_1, cubeFin_Transverse], True) cubeFin_Milieu = geompy.MakeCommonList([Scale_1, cubeFin_Transverse], True)
O_1 = geompy.MakeVertex(0, 0, 0)
OX_1 = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY_1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ_1 = geompy.MakeVectorDXDYDZ(0, 0, 1)
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( cubeFin, 'cubeFin' ) geompy.addToStudy( cubeFin, 'cubeFin' )
geompy.addToStudyInFather( cubeFin, DEPL, 'DEPL' ) geompy.addToStudyInFather( cubeFin, DEPL, 'DEPL' )
geompy.addToStudyInFather( cubeFin, ENCASTR, 'ENCASTR' ) geompy.addToStudyInFather( cubeFin, ENCASTR, 'ENCASTR' )
geompy.addToStudy( origCoin, 'origCoin' )
geompy.addToStudy( Disk_1, 'Disk_1' ) geomPublish(initLog.debug, origCoin, 'origCoin' )
geompy.addToStudy( Translation_1, 'Translation_1' ) geomPublish(initLog.debug, Disk_1, 'Disk_1' )
geompy.addToStudy( Vector_1, 'Vector_1' ) geomPublish(initLog.debug, Translation_1, 'Translation_1' )
geompy.addToStudy( Rotation_1, 'Rotation_1' ) geomPublish(initLog.debug, Vector_1, 'Vector_1' )
geompy.addToStudy( origMilieu, 'origMilieu' ) geomPublish(initLog.debug, Rotation_1, 'Rotation_1' )
geompy.addToStudy( Translation_2, 'Translation_2' ) geomPublish(initLog.debug, origMilieu, 'origMilieu' )
geompy.addToStudy( Scale_1, 'Scale_1' ) geomPublish(initLog.debug, Translation_2, 'Translation_2' )
geompy.addToStudy( Vertex_1, 'Vertex_1' ) geomPublish(initLog.debug, Scale_1, 'Scale_1' )
geompy.addToStudy( Vertex_2, 'Vertex_2' ) geomPublish(initLog.debug, Vertex_1, 'Vertex_1' )
geompy.addToStudy( Vertex_3, 'Vertex_3' ) geomPublish(initLog.debug, Vertex_2, 'Vertex_2' )
geompy.addToStudy( Vertex_4, 'Vertex_4' ) geomPublish(initLog.debug, Vertex_3, 'Vertex_3' )
geompy.addToStudy( Line_1, 'Line_1' ) geomPublish(initLog.debug, Vertex_4, 'Vertex_4' )
geompy.addToStudy( Line_2, 'Line_2' ) geomPublish(initLog.debug, Line_1, 'Line_1' )
geompy.addToStudy( Line_3, 'Line_3' ) geomPublish(initLog.debug, Line_2, 'Line_2' )
geompy.addToStudy( Line_4, 'Line_4' ) geomPublish(initLog.debug, Line_3, 'Line_3' )
geompy.addToStudy( cubeFin_Transverse, 'cubeFin_Transverse' ) geomPublish(initLog.debug, Line_4, 'Line_4' )
geompy.addToStudyInFather( Line_1, Line_1_vertex_3, 'Line_1:vertex_3' )
geompy.addToStudy( Vertex_5, 'Vertex_5' ) geomPublishInFather(initLog.debug, Line_1, Line_1_vertex_3, 'Line_1:vertex_3' )
geompy.addToStudyInFather( Line_3, Line_3_vertex_2, 'Line_3:vertex_2' ) geomPublish(initLog.debug, Vertex_5, 'Vertex_5' )
geompy.addToStudy( Arc_1, 'Arc_1' ) geomPublishInFather(initLog.debug, Line_3, Line_3_vertex_2, 'Line_3:vertex_2' )
geompy.addToStudy( Face_1, 'Face_1' ) geomPublish(initLog.debug, Arc_1, 'Arc_1' )
geompy.addToStudy( cubeFin_Coin, 'cubeFin_Coin' ) geomPublish(initLog.debug, Face_1, 'Face_1' )
geompy.addToStudy( cubeFin_Milieu, 'cubeFin_Milieu' )
geompy.addToStudy( O_1, 'O' ) geompy.addToStudy( cubeFin_Transverse, 'cubeFin_Transverse_fissure' )
geompy.addToStudy( OX_1, 'OX' ) geompy.addToStudy( cubeFin_Coin, 'cubeFin_Coin_fissure' )
geompy.addToStudy( OY_1, 'OY' ) geompy.addToStudy( cubeFin_Milieu, 'cubeFin_Milieu_fissure' )
geompy.addToStudy( OZ_1, 'OZ' )
geompy.ExportBREP(cubeFin_Transverse, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Transverse.brep")) geompy.ExportBREP(cubeFin_Transverse, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Transverse.brep"))
geompy.ExportBREP(cubeFin_Coin, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Coin.brep")) geompy.ExportBREP(cubeFin_Coin, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Coin.brep"))
geompy.ExportBREP(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Milieu.brep")) geompy.ExportBREP(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Milieu.brep"))
@ -119,18 +115,23 @@ geompy.ExportBREP(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests",
### SMESH component ### SMESH component
### ###
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New() smesh = smeshBuilder.New()
cubeFin_1 = smesh.Mesh(cubeFin) cubeFin_1 = smesh.Mesh(cubeFin)
putName(cubeFin_1.GetMesh(), 'cubeFin')
Regular_1D = cubeFin_1.Segment() Regular_1D = cubeFin_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(20) Nb_Segments_1 = Regular_1D.NumberOfSegments(20)
Nb_Segments_1.SetDistrType( 0 ) Nb_Segments_1.SetDistrType( 0 )
Quadrangle_2D = cubeFin_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) Quadrangle_2D = cubeFin_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
Hexa_3D = cubeFin_1.Hexahedron(algo=smeshBuilder.Hexa) Hexa_3D = cubeFin_1.Hexahedron(algo=smeshBuilder.Hexa)
DEPL_1 = cubeFin_1.GroupOnGeom(DEPL,'DEPL',SMESH.FACE) _ = cubeFin_1.GroupOnGeom(DEPL,'DEPL',SMESH.FACE)
ENCASTR_1 = cubeFin_1.GroupOnGeom(ENCASTR,'ENCASTR',SMESH.FACE) _ = cubeFin_1.GroupOnGeom(ENCASTR,'ENCASTR',SMESH.FACE)
## Set names of Mesh objects
#putName(Regular_1D.GetAlgorithm(), 'Regular_1D')
#putName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
#putName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
putName(Nb_Segments_1, 'Nb. Segments_1', i_pref='cubeFin')
is_done = cubeFin_1.Compute() is_done = cubeFin_1.Compute()
text = "cubeFin_1.Compute" text = "cubeFin_1.Compute"
@ -141,15 +142,6 @@ else:
logging.info(text) logging.info(text)
raise Exception(text) raise Exception(text)
## Set names of Mesh objects
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
smesh.SetName(DEPL_1, 'DEPL')
smesh.SetName(ENCASTR_1, 'ENCASTR')
smesh.SetName(cubeFin_1.GetMesh(), 'cubeFin')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
cubeFin_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin.med")) cubeFin_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin.med"))
if salome.sg.hasDesktop(): if salome.sg.hasDesktop():

View File

@ -17,40 +17,37 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
"""Géométries nécessaires aux cas-tests :
. cylindre
. cylindre_2
"""
import os
import math
import logging import logging
import sys
import salome import salome
from salome.smesh import smeshBuilder
import GEOM
import SMESH
import SALOMEDS
salome.salome_init()
import salome_notebook
notebook = salome_notebook.notebook
import os
from blocFissure import gmu from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy
from blocFissure.gmu.geomsmesh import geomPublish
from blocFissure.gmu.geomsmesh import geomPublishInFather
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.putName import putName
from blocFissure.gmu import initLog
### ###
### GEOM component ### GEOM component
### ###
import GEOM O, OX, OY, OZ = triedreBase()
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
O_1 = geompy.MakeVertex(0, 0, 0)
OX_1 = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY_1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ_1 = geompy.MakeVectorDXDYDZ(0, 0, 1)
Vertex_1 = geompy.MakeVertex(0, 0, 500) Vertex_1 = geompy.MakeVertex(0, 0, 500)
Vertex_2 = geompy.MakeVertex(100, 0, 500) Vertex_2 = geompy.MakeVertex(100, 0, 500)
Vertex_3 = geompy.MakeVertex(110, 0, 500) Vertex_3 = geompy.MakeVertex(110, 0, 500)
@ -72,85 +69,78 @@ Mirror_1_7 = geompy.MakeMirrorByPlane(Vertex_8, Plane_1)
Mirror_1_8 = geompy.MakeMirrorByPlane(Vertex_9, Plane_1) Mirror_1_8 = geompy.MakeMirrorByPlane(Vertex_9, Plane_1)
Mirror_1_9 = geompy.MakeMirrorByPlane(Vertex_10, Plane_1) Mirror_1_9 = geompy.MakeMirrorByPlane(Vertex_10, Plane_1)
Curve_2 = geompy.MakeInterpol([Mirror_1_9, Mirror_1_8, Mirror_1_7, Mirror_1_6, Mirror_1_5, Mirror_1_4, Mirror_1_3, Mirror_1_2, Mirror_1_1, Vertex_1, Vertex_2, Vertex_3, Vertex_4, Vertex_5, Vertex_6, Vertex_7, Vertex_8, Vertex_9, Vertex_10], False, False) Curve_2 = geompy.MakeInterpol([Mirror_1_9, Mirror_1_8, Mirror_1_7, Mirror_1_6, Mirror_1_5, Mirror_1_4, Mirror_1_3, Mirror_1_2, Mirror_1_1, Vertex_1, Vertex_2, Vertex_3, Vertex_4, Vertex_5, Vertex_6, Vertex_7, Vertex_8, Vertex_9, Vertex_10], False, False)
Divided_Cylinder_1 = geompy.MakeDividedCylinder(145, 800, GEOM.SQUARE)
CylindreSain = geompy.MakeRotation(Divided_Cylinder_1, OZ, 45*math.pi/180.0)
[Compound_1, vertical, radial, Compound_4] = geompy.Propagate(CylindreSain)
geompy.addToStudy( CylindreSain, 'CylindreSain' )
geomPublishInFather(initLog.debug,CylindreSain, Compound_1, 'Compound_1' )
geompy.addToStudyInFather(CylindreSain, vertical, 'vertical' )
geompy.addToStudyInFather(CylindreSain, radial, 'radial' )
geompy.addToStudyInFather(CylindreSain, Compound_4, 'Compound_4' )
Circle_1 = geompy.MakeCircle(Vertex_1, None, 145) Circle_1 = geompy.MakeCircle(Vertex_1, None, 145)
Vertex_11 = geompy.MakeVertex(0, -165, 500) Vertex_11 = geompy.MakeVertex(0, -165, 500)
Curve_2_vertex_2 = geompy.GetSubShape(Curve_2, [2]) Curve_2_vertex_2 = geompy.GetSubShape(Curve_2, [2])
Curve_2_vertex_3 = geompy.GetSubShape(Curve_2, [3]) Curve_2_vertex_3 = geompy.GetSubShape(Curve_2, [3])
Arc_1 = geompy.MakeArc(Curve_2_vertex_2, Vertex_11, Curve_2_vertex_3) Arc_1 = geompy.MakeArc(Curve_2_vertex_2, Vertex_11, Curve_2_vertex_3)
FissInCylindre = geompy.MakeFaceWires([Curve_2, Arc_1], 1) FissInCylindre = geompy.MakeFaceWires([Curve_2, Arc_1], 1)
Divided_Cylinder_1 = geompy.MakeDividedCylinder(145, 800, GEOM.SQUARE) geompy.addToStudy( FissInCylindre, 'cylindre_fissure' )
CylindreSain = geompy.MakeRotation(Divided_Cylinder_1, OZ, 45*math.pi/180.0)
[Compound_1, vertical, radial, Compound_4] = geompy.Propagate(CylindreSain)
geompy.ExportBREP(FissInCylindre, os.path.join(gmu.pathBloc, "materielCasTests", "FissInCylindre.brep")) geompy.ExportBREP(FissInCylindre, os.path.join(gmu.pathBloc, "materielCasTests", "FissInCylindre.brep"))
Vertex_12 = geompy.MakeVertex(0, -145, 500) Vertex_12 = geompy.MakeVertex(0, -145, 500)
Circle_2 = geompy.MakeCircle(Vertex_12, None, 145) Circle_2 = geompy.MakeCircle(Vertex_12, None, 145)
Face_1 = geompy.MakeFaceWires([Circle_2], 1) Face_1 = geompy.MakeFaceWires([Circle_2], 1)
Vertex_13 = geompy.MakeVertex(0, 0, 500) Vertex_13 = geompy.MakeVertex(0, 0, 500)
Disk_1 = geompy.MakeDiskPntVecR(Vertex_13, OZ_1, 170) Disk_1 = geompy.MakeDiskPntVecR(Vertex_13, OZ, 170)
FissInCylindre2 = geompy.MakeCommon(Face_1, Disk_1) FissInCylindre2 = geompy.MakeCommon(Face_1, Disk_1)
geompy.addToStudy( FissInCylindre2, 'cylindre_2_fissure' )
geompy.ExportBREP(FissInCylindre2, os.path.join(gmu.pathBloc, "materielCasTests", "FissInCylindre2.brep")) geompy.ExportBREP(FissInCylindre2, os.path.join(gmu.pathBloc, "materielCasTests", "FissInCylindre2.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' ) geomPublish(initLog.debug, Vertex_1, 'Vertex_1' )
geompy.addToStudy( OY, 'OY' ) geomPublish(initLog.debug, Vertex_2, 'Vertex_2' )
geompy.addToStudy( OZ, 'OZ' ) geomPublish(initLog.debug, Vertex_3, 'Vertex_3' )
geompy.addToStudy( O_1, 'O' ) geomPublish(initLog.debug, Vertex_4, 'Vertex_4' )
geompy.addToStudy( OX_1, 'OX' ) geomPublish(initLog.debug, Vertex_5, 'Vertex_5' )
geompy.addToStudy( OY_1, 'OY' ) geomPublish(initLog.debug, Vertex_6, 'Vertex_6' )
geompy.addToStudy( OZ_1, 'OZ' ) geomPublish(initLog.debug, Vertex_7, 'Vertex_7' )
geompy.addToStudy( Vertex_1, 'Vertex_1' ) geomPublish(initLog.debug, Vertex_8, 'Vertex_8' )
geompy.addToStudy( Vertex_2, 'Vertex_2' ) geomPublish(initLog.debug, Vertex_9, 'Vertex_9' )
geompy.addToStudy( Vertex_3, 'Vertex_3' ) geomPublish(initLog.debug, Vertex_10, 'Vertex_10' )
geompy.addToStudy( Vertex_4, 'Vertex_4' ) geomPublish(initLog.debug, Plane_1, 'Plane_1' )
geompy.addToStudy( Vertex_5, 'Vertex_5' ) geomPublish(initLog.debug, Mirror_1_1, 'Mirror_1_1' )
geompy.addToStudy( Vertex_6, 'Vertex_6' ) geomPublish(initLog.debug, Mirror_1_2, 'Mirror_1_2' )
geompy.addToStudy( Vertex_7, 'Vertex_7' ) geomPublish(initLog.debug, Mirror_1_3, 'Mirror_1_3' )
geompy.addToStudy( Vertex_8, 'Vertex_8' ) geomPublish(initLog.debug, Mirror_1_4, 'Mirror_1_4' )
geompy.addToStudy( Vertex_9, 'Vertex_9' ) geomPublish(initLog.debug, Mirror_1_5, 'Mirror_1_5' )
geompy.addToStudy( Vertex_10, 'Vertex_10' ) geomPublish(initLog.debug, Mirror_1_6, 'Mirror_1_6' )
geompy.addToStudy( Plane_1, 'Plane_1' ) geomPublish(initLog.debug, Mirror_1_7, 'Mirror_1_7' )
geompy.addToStudy( Mirror_1_1, 'Mirror_1_1' ) geomPublish(initLog.debug, Mirror_1_8, 'Mirror_1_8' )
geompy.addToStudy( Mirror_1_2, 'Mirror_1_2' ) geomPublish(initLog.debug, Mirror_1_9, 'Mirror_1_9' )
geompy.addToStudy( Mirror_1_3, 'Mirror_1_3' ) geomPublish(initLog.debug, Curve_2, 'Curve_2' )
geompy.addToStudy( Mirror_1_4, 'Mirror_1_4' ) geomPublish(initLog.debug, Circle_1, 'Circle_1' )
geompy.addToStudy( Mirror_1_5, 'Mirror_1_5' ) geomPublish(initLog.debug, Vertex_11, 'Vertex_11' )
geompy.addToStudy( Mirror_1_6, 'Mirror_1_6' ) geomPublishInFather(initLog.debug, Curve_2, Curve_2_vertex_2, 'Curve_2:vertex_2' )
geompy.addToStudy( Mirror_1_7, 'Mirror_1_7' ) geomPublishInFather(initLog.debug, Curve_2, Curve_2_vertex_3, 'Curve_2:vertex_3' )
geompy.addToStudy( Mirror_1_8, 'Mirror_1_8' ) geomPublish(initLog.debug, Arc_1, 'Arc_1' )
geompy.addToStudy( Mirror_1_9, 'Mirror_1_9' ) geomPublish(initLog.debug, FissInCylindre, 'FissInCylindre' )
geompy.addToStudy( Curve_2, 'Curve_2' ) geomPublish(initLog.debug, Divided_Cylinder_1, 'Divided Cylinder_1' )
geompy.addToStudy( Circle_1, 'Circle_1' ) geomPublish(initLog.debug, Vertex_12, 'Vertex_12' )
geompy.addToStudy( Vertex_11, 'Vertex_11' ) geomPublish(initLog.debug, Circle_2, 'Circle_2' )
geompy.addToStudyInFather( Curve_2, Curve_2_vertex_2, 'Curve_2:vertex_2' ) geomPublish(initLog.debug, Face_1, 'Face_1' )
geompy.addToStudyInFather( Curve_2, Curve_2_vertex_3, 'Curve_2:vertex_3' ) geomPublish(initLog.debug, Vertex_13, 'Vertex_13' )
geompy.addToStudy( Arc_1, 'Arc_1' ) geomPublish(initLog.debug, Disk_1, 'Disk_1' )
geompy.addToStudy( FissInCylindre, 'FissInCylindre' ) geomPublish(initLog.debug, FissInCylindre2, 'FissInCylindre2' )
geompy.addToStudy( Divided_Cylinder_1, 'Divided Cylinder_1' )
geompy.addToStudy( CylindreSain, 'CylindreSain' )
geompy.addToStudyInFather( CylindreSain, Compound_1, 'Compound_1' )
geompy.addToStudyInFather( CylindreSain, vertical, 'vertical' )
geompy.addToStudyInFather( CylindreSain, radial, 'radial' )
geompy.addToStudyInFather( CylindreSain, Compound_4, 'Compound_4' )
geompy.addToStudy( Vertex_12, 'Vertex_12' )
geompy.addToStudy( Circle_2, 'Circle_2' )
geompy.addToStudy( Face_1, 'Face_1' )
geompy.addToStudy( Vertex_13, 'Vertex_13' )
geompy.addToStudy( Disk_1, 'Disk_1' )
geompy.addToStudy( FissInCylindre2, 'FissInCylindre2' )
### ###
### SMESH component ### SMESH component
### ###
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New() smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
smeshObj_1 = smesh.CreateHypothesis('NumberOfSegments')
smeshObj_1.SetNumberOfSegments( 5 )
smeshObj_1.SetDistrType( 0 )
CylindreSain_1 = smesh.Mesh(CylindreSain) CylindreSain_1 = smesh.Mesh(CylindreSain)
smesh.SetName(CylindreSain_1, 'CylindreSain') putName(CylindreSain_1.GetMesh(), 'CylindreSain')
Regular_1D = CylindreSain_1.Segment() Regular_1D = CylindreSain_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(15,[],[ ]) Nb_Segments_1 = Regular_1D.NumberOfSegments(15,[],[ ])
Nb_Segments_1.SetDistrType( 0 ) Nb_Segments_1.SetDistrType( 0 )
@ -163,6 +153,14 @@ Regular_1D_2 = CylindreSain_1.Segment(geom=radial)
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(6,[],[ ]) Nb_Segments_3 = Regular_1D_2.NumberOfSegments(6,[],[ ])
Nb_Segments_3.SetDistrType( 0 ) Nb_Segments_3.SetDistrType( 0 )
## set object names
#smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
#smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
#smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
putName(Nb_Segments_1, 'Nb. Segments_1', i_pref='cylindre')
putName(Nb_Segments_2, 'Nb. Segments_2', i_pref='cylindre')
putName(Nb_Segments_3, 'Nb. Segments_3', i_pref='cylindre')
is_done = CylindreSain_1.Compute() is_done = CylindreSain_1.Compute()
text = "CylindreSain_1.Compute" text = "CylindreSain_1.Compute"
if is_done: if is_done:
@ -173,23 +171,6 @@ else:
raise Exception(text) raise Exception(text)
CylindreSain_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "CylindreSain.med")) CylindreSain_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "CylindreSain.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()
## some objects were removed
aStudyBuilder = salome.myStudy.NewBuilder()
SO = salome.myStudy.FindObjectIOR(salome.myStudy.ConvertObjectToIOR(smeshObj_1))
if SO is not None: aStudyBuilder.RemoveObjectWithChildren(SO)
## set object names
smesh.SetName(CylindreSain_1.GetMesh(), 'CylindreSain')
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
smesh.SetName(Nb_Segments_3, 'Nb. Segments_3')
smesh.SetName(SubMesh_1, 'SubMesh_1')
smesh.SetName(SubMesh_2, 'SubMesh_2')
if salome.sg.hasDesktop(): if salome.sg.hasDesktop():
salome.sg.updateObjBrowser() salome.sg.updateObjBrowser()

View File

@ -17,68 +17,61 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
"""Géométrie nécessaire au cas-test :
. disque_perce
"""
import os
import logging import logging
import sys
import salome import salome
from salome.smesh import smeshBuilder
from salome.StdMeshers import StdMeshersBuilder
import GEOM
import SMESH
import SALOMEDS
salome.salome_init()
import salome_notebook
notebook = salome_notebook.notebook
import os
from blocFissure import gmu from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy
from blocFissure.gmu.geomsmesh import geomPublish
from blocFissure.gmu.geomsmesh import geomPublishInFather
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.putName import putName
from blocFissure.gmu import initLog
### ###
### GEOM component ### GEOM component
### ###
import GEOM O, OX, OY, OZ = triedreBase()
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Cylinder_1 = geompy.MakeCylinderRH(100, 300) Cylinder_1 = geompy.MakeCylinderRH(100, 300)
Cylinder_2 = geompy.MakeCylinderRH(600, 200) Cylinder_2 = geompy.MakeCylinderRH(600, 200)
Cut_1 = geompy.MakeCut(Cylinder_2, Cylinder_1) Cut_1 = geompy.MakeCut(Cylinder_2, Cylinder_1)
Face_1 = geompy.MakeFaceHW(500, 1500, 3) Face_1 = geompy.MakeFaceHW(500, 1500, 3)
Disque = geompy.MakePartition([Cut_1], [Face_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0) Disque = geompy.MakePartition([Cut_1], [Face_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
[Compound_1, Compound_2, Compound_3, Compound_4] = geompy.Propagate(Disque) [Compound_1, Compound_2, Compound_3, Compound_4] = geompy.Propagate(Disque)
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Cylinder_1, 'Cylinder_1' )
geompy.addToStudy( Cylinder_2, 'Cylinder_2' )
geompy.addToStudy( Cut_1, 'Cut_1' )
geompy.addToStudy( Face_1, 'Face_1' )
geompy.addToStudy( Disque, 'Disque' ) geompy.addToStudy( Disque, 'Disque' )
geompy.addToStudyInFather( Disque, Compound_1, 'Compound_1' ) geompy.addToStudyInFather( Disque, Compound_1, 'Compound_1' )
geompy.addToStudyInFather( Disque, Compound_2, 'Compound_2' ) geompy.addToStudyInFather( Disque, Compound_2, 'Compound_2' )
geompy.addToStudyInFather( Disque, Compound_3, 'Compound_3' ) geompy.addToStudyInFather( Disque, Compound_3, 'Compound_3' )
geompy.addToStudyInFather( Disque, Compound_4, 'Compound_4' ) geompy.addToStudyInFather( Disque, Compound_4, 'Compound_4' )
geomPublish(initLog.debug, Cylinder_1, 'Cylinder_1' )
geomPublish(initLog.debug, Cylinder_2, 'Cylinder_2' )
geomPublish(initLog.debug, Cut_1, 'Cut_1' )
geomPublish(initLog.debug, Face_1, 'Face_1' )
### ###
### SMESH component ### SMESH component
### ###
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New() smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
Disque_1 = smesh.Mesh(Disque) Disque_1 = smesh.Mesh(Disque)
smesh.SetName(Disque_1, 'Disque') putName(Disque_1.GetMesh(), 'Disque')
Regular_1D = Disque_1.Segment() Regular_1D = Disque_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(10) Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
Nb_Segments_1.SetDistrType( 0 ) Nb_Segments_1.SetDistrType( 0 )
@ -90,6 +83,13 @@ Regular_1D_2 = Disque_1.Segment(geom=Compound_4)
status = Disque_1.AddHypothesis(Nb_Segments_2,Compound_4) status = Disque_1.AddHypothesis(Nb_Segments_2,Compound_4)
Quadrangle_2D = Disque_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) Quadrangle_2D = Disque_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
## set object names
#smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
#smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
#smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
putName(Nb_Segments_1, 'Nb. Segments_1', i_pref='Disque')
putName(Nb_Segments_2, 'Nb. Segments_2', i_pref='Disque')
is_done = Disque_1.Compute() is_done = Disque_1.Compute()
text = "Disque_1.Compute" text = "Disque_1.Compute"
if is_done: if is_done:
@ -100,18 +100,6 @@ else:
raise Exception(text) raise Exception(text)
Disque_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "disque.med")) Disque_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "disque.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()
## set object names
smesh.SetName(Disque_1.GetMesh(), 'Disque')
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
smesh.SetName(SubMesh_1, 'SubMesh_1')
smesh.SetName(SubMesh_2, 'SubMesh_2')
if salome.sg.hasDesktop(): if salome.sg.hasDesktop():
salome.sg.updateObjBrowser() salome.sg.updateObjBrowser()