smesh/src/Tools/blocFissure/exemple2.py

110 lines
3.3 KiB
Python
Raw Normal View History

2014-01-09 14:20:44 +00:00
# -*- coding: iso-8859-1 -*-
2020-04-15 17:49:00 +03:00
# Copyright (C) 2014-2020 EDF R&D
2019-02-14 14:55:47 +03:00
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
2014-01-09 14:20:44 +00:00
import sys
import salome
salome.salome_init()
import salome_notebook
###
### GEOM component
###
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
2017-06-13 13:01:10 +03:00
geompy = geomBuilder.New()
2014-01-09 14:20:44 +00:00
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Vertex_1 = geompy.MakeVertex(0, 0, 100)
Disk_1 = geompy.MakeDiskPntVecR(Vertex_1, OZ, 50)
Rotation_1 = geompy.MakeRotation(Box_1, OZ, 45*math.pi/180.0)
geompy.TranslateDXDYDZ(Rotation_1, -50, -250, 0)
Cut_1 = geompy.MakeCut(Disk_1, Rotation_1)
geompy.Export(Cut_1, "disk.brep", "BREP")
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( Vertex_1, 'Vertex_1' )
geompy.addToStudy( Disk_1, 'Disk_1' )
geompy.addToStudy( Rotation_1, 'Rotation_1' )
geompy.addToStudy( Cut_1, 'Cut_1' )
###
### SMESH component
###
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
2017-06-13 13:01:10 +03:00
smesh = smeshBuilder.New()
2014-01-09 14:20:44 +00:00
from salome.StdMeshers import StdMeshersBuilder
boite = smesh.Mesh(Box_1)
Regular_1D = boite.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
Nb_Segments_1.SetDistrType( 0 )
Quadrangle_2D = boite.Quadrangle(algo=smeshBuilder.QUADRANGLE)
Hexa_3D = boite.Hexahedron(algo=smeshBuilder.Hexa)
isDone = boite.Compute()
smesh.SetName(boite, 'boite')
boite.ExportMED(r'boite.med')
2014-01-09 14:20:44 +00:00
## set object names
smesh.SetName(boite.GetMesh(), 'boite')
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')
import os
from blocFissure import gmu
from blocFissure.gmu import initLog
#initLog.setDebug()
initLog.setVerbose()
2014-08-28 10:06:35 +02:00
from blocFissure.gmu.casStandard import casStandard
2014-01-09 14:20:44 +00:00
dicoParams = dict(nomCas = 'angleCube2',
maillageSain = 'boite.med',
brepFaceFissure = "disk.brep",
edgeFissIds = [4],
lgInfluence = 50,
2014-01-09 14:20:44 +00:00
meshBrep = (5,10),
rayonPipe = 15,
lenSegPipe = 20,
2014-01-09 14:20:44 +00:00
nbSegRad = 5,
nbSegCercle = 12,
areteFaceFissure = 2)
2014-01-09 14:20:44 +00:00
execInstance = casStandard(dicoParams)
if salome.sg.hasDesktop():
2017-06-13 13:01:10 +03:00
salome.sg.updateObjBrowser()