mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-08 18:07:27 +05:00
contrôle du python
This commit is contained in:
parent
6a42b4e2db
commit
345b6319e0
@ -17,93 +17,98 @@
|
|||||||
#
|
#
|
||||||
# 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 et maillage de base nécessaire au cas-test :
|
||||||
|
. faceGauche_2
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import math
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
Circle_1 = geompy.MakeCircle(O, OX, 500.)
|
||||||
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)
|
|
||||||
Circle_1 = geompy.MakeCircle(O, OX, 500)
|
|
||||||
Extrusion_1 = geompy.MakePrismVecH2Ways(Circle_1, OX, 500)
|
Extrusion_1 = geompy.MakePrismVecH2Ways(Circle_1, OX, 500)
|
||||||
Vertex_1 = geompy.MakeVertex(500, 0, 0)
|
Vertex_1 = geompy.MakeVertex(500., 0., 0.)
|
||||||
Circle_3 = geompy.MakeCircle(Vertex_1, OZ, 300)
|
Circle_3 = geompy.MakeCircle(Vertex_1, OZ, 300)
|
||||||
Extrusion_2 = geompy.MakePrismVecH(Circle_3, OZ, 1000)
|
Extrusion_2 = geompy.MakePrismVecH(Circle_3, OZ, 1000)
|
||||||
Partition_1 = geompy.MakePartition([Extrusion_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
|
Partition_1 = geompy.MakePartition([Extrusion_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
|
||||||
[Face_1,Face_2] = geompy.SubShapes(Partition_1, [18, 13])
|
[Face_1,Face_2] = geompy.SubShapes(Partition_1, [18, 13])
|
||||||
|
|
||||||
FaceFissExt = geompy.MakeFuse(Face_2, Face_1)
|
FaceFissExt = geompy.MakeFuse(Face_2, Face_1)
|
||||||
|
geompy.addToStudy( FaceFissExt, 'FaceFissExt' )
|
||||||
geompy.ExportBREP(FaceFissExt, os.path.join(gmu.pathBloc, "materielCasTests", "faceGauche2Fiss.brep"))
|
geompy.ExportBREP(FaceFissExt, os.path.join(gmu.pathBloc, "materielCasTests", "faceGauche2Fiss.brep"))
|
||||||
|
|
||||||
Vertex_2 = geompy.MakeVertex(0, -500, 0)
|
Vertex_2 = geompy.MakeVertex(0, -500, 0)
|
||||||
Vertex_3 = geompy.MakeVertex(400, 500, 800)
|
Vertex_3 = geompy.MakeVertex(400, 500, 800)
|
||||||
objetSain = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
|
objetSain = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
|
||||||
Rotation_1 = geompy.MakeRotation(Extrusion_1, OX, 180*math.pi/180.0)
|
geompy.addToStudy( objetSain, 'objetSain' )
|
||||||
|
|
||||||
|
Rotation_1 = geompy.MakeRotation(Extrusion_1, OX, math.pi)
|
||||||
Partition_2 = geompy.MakePartition([Rotation_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
|
Partition_2 = geompy.MakePartition([Rotation_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
|
||||||
geompy.addToStudy( Partition_2, 'Partition_2' )
|
geompy.addToStudy( Partition_2, 'Partition_2' )
|
||||||
[FaceFissExtSimple] = geompy.SubShapes(Partition_2, [13])
|
[FaceFissExtSimple] = geompy.SubShapes(Partition_2, [13])
|
||||||
geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' )
|
geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' )
|
||||||
Plane_1 = geompy.MakePlaneLCS(None, 2000, 3)
|
Plane_1 = geompy.MakePlaneLCS(None, 2000., 3)
|
||||||
|
|
||||||
FaceFissExtCoupe = geompy.MakePartition([FaceFissExtSimple], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)
|
FaceFissExtCoupe = geompy.MakePartition([FaceFissExtSimple], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)
|
||||||
geompy.ExportBREP(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests", "faceGauche2FissCoupe.brep"))
|
|
||||||
geompy.addToStudy( O, 'O' )
|
|
||||||
geompy.addToStudy( OX, 'OX' )
|
|
||||||
geompy.addToStudy( OY, 'OY' )
|
|
||||||
geompy.addToStudy( OZ, 'OZ' )
|
|
||||||
geompy.addToStudy( Circle_1, 'Circle_1' )
|
|
||||||
geompy.addToStudy( Extrusion_1, 'Extrusion_1' )
|
|
||||||
geompy.addToStudy( Vertex_1, 'Vertex_1' )
|
|
||||||
geompy.addToStudy( Circle_3, 'Circle_3' )
|
|
||||||
geompy.addToStudy( Extrusion_2, 'Extrusion_2' )
|
|
||||||
geompy.addToStudy( Partition_1, 'Partition_1' )
|
|
||||||
geompy.addToStudyInFather( Partition_1, Face_1, 'Face_1' )
|
|
||||||
geompy.addToStudyInFather( Partition_1, Face_2, 'Face_2' )
|
|
||||||
geompy.addToStudy( FaceFissExt, 'FaceFissExt' )
|
|
||||||
geompy.addToStudy( Vertex_2, 'Vertex_2' )
|
|
||||||
geompy.addToStudy( Vertex_3, 'Vertex_3' )
|
|
||||||
geompy.addToStudy( objetSain, 'objetSain' )
|
|
||||||
geompy.addToStudy( Rotation_1, 'Rotation_1' )
|
|
||||||
geompy.addToStudy( Plane_1, 'Plane_1' )
|
|
||||||
geompy.addToStudy( FaceFissExtCoupe, 'FaceFissExtCoupe' )
|
geompy.addToStudy( FaceFissExtCoupe, 'FaceFissExtCoupe' )
|
||||||
|
|
||||||
|
geompy.ExportBREP(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests", "faceGauche2FissCoupe.brep"))
|
||||||
|
|
||||||
|
geomPublish(initLog.debug, Circle_1, 'Circle_1' )
|
||||||
|
geomPublish(initLog.debug, Extrusion_1, 'Extrusion_1' )
|
||||||
|
geomPublish(initLog.debug, Vertex_1, 'Vertex_1' )
|
||||||
|
geomPublish(initLog.debug, Circle_3, 'Circle_3' )
|
||||||
|
geomPublish(initLog.debug, Extrusion_2, 'Extrusion_2' )
|
||||||
|
geomPublish(initLog.debug, Partition_1, 'Partition_1' )
|
||||||
|
geomPublishInFather(initLog.debug, Partition_1, Face_1, 'Face_1' )
|
||||||
|
geomPublishInFather(initLog.debug, Partition_1, Face_2, 'Face_2' )
|
||||||
|
geomPublish(initLog.debug, Vertex_2, 'Vertex_2' )
|
||||||
|
geomPublish(initLog.debug, Vertex_3, 'Vertex_3' )
|
||||||
|
geomPublish(initLog.debug, Rotation_1, 'Rotation_1' )
|
||||||
|
geomPublish(initLog.debug, Plane_1, 'Plane_1' )
|
||||||
|
|
||||||
###
|
###
|
||||||
### SMESH component
|
### SMESH component
|
||||||
###
|
###
|
||||||
|
|
||||||
import SMESH, SALOMEDS
|
|
||||||
from salome.smesh import smeshBuilder
|
|
||||||
|
|
||||||
smesh = smeshBuilder.New()
|
smesh = smeshBuilder.New()
|
||||||
from salome.StdMeshers import StdMeshersBuilder
|
|
||||||
Mesh_1 = smesh.Mesh(objetSain)
|
Mesh_1 = smesh.Mesh(objetSain)
|
||||||
smesh.SetName(Mesh_1, 'Mesh_1')
|
putName(Mesh_1.GetMesh(), 'Mesh_1')
|
||||||
|
|
||||||
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
|
||||||
|
#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='fissuregauche2')
|
||||||
|
|
||||||
is_done = Mesh_1.Compute()
|
is_done = Mesh_1.Compute()
|
||||||
text = "Mesh_1.Compute"
|
text = "Mesh_1.Compute"
|
||||||
if is_done:
|
if is_done:
|
||||||
@ -115,12 +120,5 @@ else:
|
|||||||
|
|
||||||
Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "boiteSaine.med"))
|
Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "boiteSaine.med"))
|
||||||
|
|
||||||
## set object names
|
|
||||||
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
|
|
||||||
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()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user