mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-23 03:55:36 +05:00
29171 Move examples to test folder
This commit is contained in:
parent
ba134fd24e
commit
33cf7a01f2
@ -32,79 +32,11 @@ include_directories(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# scripts / static
|
# scripts / static
|
||||||
SET(_bin_SCRIPTS
|
|
||||||
ex00_all.py
|
|
||||||
ex01_cube2build.py
|
|
||||||
ex02_cube2primitive.py
|
|
||||||
ex03_cube2partition.py
|
|
||||||
ex04_cube5tetraHexa.py
|
|
||||||
ex05_hole1build.py
|
|
||||||
ex06_hole1boolean.py
|
|
||||||
ex07_hole1partition.py
|
|
||||||
ex08_hole2build.py
|
|
||||||
ex09_grid4build.py
|
|
||||||
ex10_grid4geometry.py
|
|
||||||
ex11_grid3partition.py
|
|
||||||
ex12_grid17partition.py
|
|
||||||
ex13_hole1partial.py
|
|
||||||
ex14_cyl1holed.py
|
|
||||||
ex15_cyl2geometry.py
|
|
||||||
ex16_cyl2complementary.py
|
|
||||||
ex17_dome1.py
|
|
||||||
ex18_dome2.py
|
|
||||||
ex19_sphereINcube.py
|
|
||||||
ex21_lamp.py
|
|
||||||
ex24_cylinder.py
|
|
||||||
ex29_refine.py
|
|
||||||
ex30_tepal.py
|
|
||||||
ex30_groupsOp.py
|
|
||||||
ex31_dimGroup.py
|
|
||||||
SMESH_test.py
|
|
||||||
SMESH_test0.py
|
|
||||||
SMESH_test1.py
|
|
||||||
SMESH_test1_AndDisplay.py
|
|
||||||
SMESH_test2.py
|
|
||||||
SMESH_test3.py
|
|
||||||
SMESH_test4.py
|
|
||||||
SMESH_test5.py
|
|
||||||
SMESH_mechanic.py
|
|
||||||
SMESH_mechanic_tetra.py
|
|
||||||
SMESH_mechanic_editor.py
|
|
||||||
SMESH_mechanic_netgen.py
|
|
||||||
SMESH_fixation.py
|
|
||||||
SMESH_fixation_hexa.py
|
|
||||||
SMESH_fixation_tetra.py
|
|
||||||
SMESH_fixation_netgen.py
|
|
||||||
SMESH_box_tetra.py
|
|
||||||
SMESH_box2_tetra.py
|
|
||||||
SMESH_box3_tetra.py
|
|
||||||
SMESH_flight_skin.py
|
|
||||||
SMESH_Partition1_tetra.py
|
|
||||||
SMESH_controls.py
|
|
||||||
SMESH_freebord.py
|
|
||||||
SMESH_blocks.py
|
|
||||||
SMESH_BelongToGeom.py
|
|
||||||
SMESH_GroupFromGeom2.py
|
|
||||||
SMESH_box.py
|
|
||||||
SMESH_demo_hexa2_upd.py
|
|
||||||
SMESH_hexaedre.py
|
|
||||||
SMESH_Sphere.py
|
|
||||||
SMESH_GroupFromGeom.py
|
|
||||||
SMESH_Nut.py
|
|
||||||
SMESH_GroupLyingOnGeom.py
|
|
||||||
SMESH_AdvancedEditor.py
|
|
||||||
SMESH_BuildCompound.py
|
|
||||||
PAL_MESH_041_mesh.py
|
|
||||||
PAL_MESH_043_2D.py
|
|
||||||
PAL_MESH_043_3D.py
|
|
||||||
SMESH_reg.py
|
|
||||||
smesh_selection.py
|
|
||||||
YACS_geomesh0.py
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(smesh_SCRIPTS
|
SET(smesh_SCRIPTS
|
||||||
smeshBuilder.py
|
smeshBuilder.py
|
||||||
smesh_algorithm.py
|
smesh_algorithm.py
|
||||||
|
smesh_selection.py
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(StdMeshers_SCRIPTS
|
SET(StdMeshers_SCRIPTS
|
||||||
@ -135,7 +67,5 @@ install(FILES ${SMeshHelper_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
|
|||||||
SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_SMeshHelper_REAL_NAME}")
|
SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_SMeshHelper_REAL_NAME}")
|
||||||
|
|
||||||
# --- rules ---
|
# --- rules ---
|
||||||
SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON} DEF_PERMS)
|
|
||||||
SALOME_INSTALL_SCRIPTS("${smesh_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/smesh DEF_PERMS)
|
SALOME_INSTALL_SCRIPTS("${smesh_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/smesh DEF_PERMS)
|
||||||
SALOME_INSTALL_SCRIPTS("${StdMeshers_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/StdMeshers DEF_PERMS)
|
SALOME_INSTALL_SCRIPTS("${StdMeshers_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/StdMeshers DEF_PERMS)
|
||||||
SALOME_INSTALL_SCRIPTS(SMESH_shared_modules.py ${SALOME_INSTALL_PYTHON}/shared_modules DEF_PERMS)
|
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
# -*- coding: iso-8859-1 -*-
|
|
||||||
# Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
|
|
||||||
#
|
|
||||||
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
|
||||||
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
# force SMESH importation at interpreter initialization
|
|
||||||
# see salome_shared_modules.py
|
|
||||||
# (avoids incomplete import at run time)
|
|
||||||
|
|
||||||
from launchConfigureParser import verbose
|
|
||||||
|
|
||||||
if verbose(): print("============== import SMESH =======================")
|
|
||||||
|
|
||||||
import SMESH
|
|
||||||
|
|
||||||
# this function is required
|
|
||||||
|
|
||||||
def init_shared_modules():
|
|
||||||
"""
|
|
||||||
This function initializes shared modules that need to be
|
|
||||||
"""
|
|
||||||
pass
|
|
@ -1,192 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# Copyright (C) 2018-2021 CEA/DEN, EDF R&D, OPEN CASCADE
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
#
|
|
||||||
|
|
||||||
# test used in YACS, ForEachLoop
|
|
||||||
|
|
||||||
def geomesh(l0, r0, h0, d0, d1, my_container, direc):
|
|
||||||
print("Géometrie et maillage barre : (l0, r0, h0, d0, d1)=", (l0, r0, h0, d0, d1))
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import salome
|
|
||||||
salome.salome_init()
|
|
||||||
import GEOM
|
|
||||||
from salome.geom import geomBuilder
|
|
||||||
import math
|
|
||||||
import os
|
|
||||||
import SALOMEDS
|
|
||||||
import SMESH
|
|
||||||
from salome.smesh import smeshBuilder
|
|
||||||
|
|
||||||
my_container.load_component_Library("GEOM")
|
|
||||||
#engineGeom = my_container.create_component_instance("GEOM")
|
|
||||||
engineGeom = my_container.load_impl("GEOM","")
|
|
||||||
geompy = geomBuilder.New(engineGeom)
|
|
||||||
my_container.load_component_Library("SMESH")
|
|
||||||
#engineSmesh = my_container.create_component_instance("SMESH")
|
|
||||||
engineSmesh = my_container.load_impl("SMESH","")
|
|
||||||
smesh = smeshBuilder.New(engineSmesh,engineGeom)
|
|
||||||
print("instances Names:", engineGeom.instanceName, engineSmesh.instanceName)
|
|
||||||
print("instances:", engineGeom, engineSmesh)
|
|
||||||
print("builders:", geompy, smesh)
|
|
||||||
|
|
||||||
volume = (2.*l0*r0 + 0.75*math.pi*r0*r0)*h0
|
|
||||||
O = geompy.MakeVertex(0, 0, 0)
|
|
||||||
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
|
|
||||||
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
|
|
||||||
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
|
||||||
Vertex_1 = geompy.MakeVertex(-l0, -r0, 0)
|
|
||||||
Vertex_2 = geompy.MakeVertex(-l0-r0, 0, 0)
|
|
||||||
Vertex_3 = geompy.MakeVertex(-l0, r0, 0)
|
|
||||||
Vertex_4 = geompy.MakeVertex(l0, r0, 0)
|
|
||||||
Vertex_5 = geompy.MakeVertex(l0+r0, 0, 0)
|
|
||||||
Vertex_6 = geompy.MakeVertex(l0, -r0, 0)
|
|
||||||
Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3)
|
|
||||||
Arc_2 = geompy.MakeArc(Vertex_4, Vertex_5, Vertex_6)
|
|
||||||
Line_1 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4)
|
|
||||||
Line_2 = geompy.MakeLineTwoPnt(Vertex_6, Vertex_1)
|
|
||||||
Face_1 = geompy.MakeFaceWires([Arc_1, Arc_2, Line_1, Line_2], 1)
|
|
||||||
barre0 = geompy.MakePrismVecH(Face_1, OZ, h0)
|
|
||||||
Vertex_1a = geompy.MakeVertex(-l0, -r0/2, 0)
|
|
||||||
Vertex_2a = geompy.MakeVertex(-l0-r0/2, 0, 0)
|
|
||||||
Vertex_3a = geompy.MakeVertex(-l0, r0/2, 0)
|
|
||||||
Vertex_4a = geompy.MakeVertex(l0, r0/2, 0)
|
|
||||||
Vertex_5a = geompy.MakeVertex(l0+r0/2, 0, 0)
|
|
||||||
Vertex_6a = geompy.MakeVertex(l0, -r0/2, 0)
|
|
||||||
Arc_1a = geompy.MakeArc(Vertex_1a, Vertex_2a, Vertex_3a)
|
|
||||||
Arc_2a = geompy.MakeArc(Vertex_4a, Vertex_5a, Vertex_6a)
|
|
||||||
Line_1a = geompy.MakeLineTwoPnt(Vertex_3a, Vertex_4a)
|
|
||||||
Line_2a = geompy.MakeLineTwoPnt(Vertex_6a, Vertex_1a)
|
|
||||||
Face_1a = geompy.MakeFaceWires([Arc_1a, Arc_2a, Line_1a, Line_2a], 1)
|
|
||||||
barrea = geompy.MakePrismVecH(Face_1a, OZ, h0)
|
|
||||||
barreb = geompy.MakeCut(barre0, barrea)
|
|
||||||
Plane_1 = geompy.MakePlane(Vertex_1, OX, 2000)
|
|
||||||
Plane_2 = geompy.MakePlane(Vertex_6, OX, 2000)
|
|
||||||
barre = geompy.MakePartition([barreb], [Plane_1, Plane_2], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
|
|
||||||
v1 = geompy.MakeVertex(-l0-r0, 0, h0/2.)
|
|
||||||
v2 = geompy.MakeVertex(l0+r0, 0, h0/2.)
|
|
||||||
f1 = geompy.GetShapesNearPoint(barre, v1, geompy.ShapeType["FACE"])
|
|
||||||
f2 = geompy.GetShapesNearPoint(barre, v2, geompy.ShapeType["FACE"])
|
|
||||||
#f1 = geompy.CreateGroup(barre, geompy.ShapeType["FACE"])
|
|
||||||
#geompy.UnionIDs(f1, [3])
|
|
||||||
#f2 = geompy.CreateGroup(barre, geompy.ShapeType["FACE"])
|
|
||||||
#geompy.UnionIDs(f2, [20])
|
|
||||||
|
|
||||||
Auto_group_for_Sub_mesh_1 = geompy.CreateGroup(barre, geompy.ShapeType["FACE"])
|
|
||||||
geompy.UnionList(Auto_group_for_Sub_mesh_1, [f1, f2])
|
|
||||||
nom = r'barre_l_{:03d}__r_{:05.2f}__h_{:05.2f}__d0_{:05.2f}__d1_{:05.2f}'.format(int(l0), r0, h0, d0, d1)
|
|
||||||
nombrep = nom + ".brep"
|
|
||||||
geompy.ExportBREP(barre, direc + os.sep + nombrep )
|
|
||||||
props = geompy.BasicProperties(barre)
|
|
||||||
geomvol = props[2]
|
|
||||||
|
|
||||||
#geompy.addToStudy( barre, 'barre' )
|
|
||||||
#geompy.addToStudyInFather( barre, f1, 'f1' )
|
|
||||||
#geompy.addToStudyInFather( barre, f2, 'f2' )
|
|
||||||
|
|
||||||
smesh.SetEnablePublish( False )
|
|
||||||
|
|
||||||
isTetra = False
|
|
||||||
barre_1 = smesh.Mesh(barre)
|
|
||||||
# SO = salome.myStudy.FindObjectIOR(salome.myStudy.ConvertObjectToIOR(barre_1.GetMesh()))
|
|
||||||
# if SO:
|
|
||||||
# print ("_______",SO.GetID(),SO.GetName())
|
|
||||||
# else:
|
|
||||||
# print ("_______NO_SO!!!")
|
|
||||||
if (isTetra):
|
|
||||||
NETGEN_1D_2D_3D = barre_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
|
|
||||||
NETGEN_3D_Parameters_1 = NETGEN_1D_2D_3D.Parameters()
|
|
||||||
NETGEN_3D_Parameters_1.SetMaxSize( d0 )
|
|
||||||
NETGEN_3D_Parameters_1.SetSecondOrder( 0 )
|
|
||||||
NETGEN_3D_Parameters_1.SetOptimize( 1 )
|
|
||||||
NETGEN_3D_Parameters_1.SetFineness( 3 )
|
|
||||||
NETGEN_3D_Parameters_1.SetChordalError( 0.1 )
|
|
||||||
NETGEN_3D_Parameters_1.SetChordalErrorEnabled( 0 )
|
|
||||||
NETGEN_3D_Parameters_1.SetMinSize( d0 )
|
|
||||||
NETGEN_3D_Parameters_1.SetUseSurfaceCurvature( 1 )
|
|
||||||
NETGEN_3D_Parameters_1.SetFuseEdges( 1 )
|
|
||||||
NETGEN_3D_Parameters_1.SetQuadAllowed( 0 )
|
|
||||||
NETGEN_1D_2D = barre_1.Triangle(algo=smeshBuilder.NETGEN_1D2D,geom=Auto_group_for_Sub_mesh_1)
|
|
||||||
NETGEN_2D_Parameters_1 = NETGEN_1D_2D.Parameters()
|
|
||||||
NETGEN_2D_Parameters_1.SetMaxSize( d1 )
|
|
||||||
NETGEN_2D_Parameters_1.SetSecondOrder( 0 )
|
|
||||||
NETGEN_2D_Parameters_1.SetOptimize( 1 )
|
|
||||||
NETGEN_2D_Parameters_1.SetFineness( 3 )
|
|
||||||
NETGEN_2D_Parameters_1.SetChordalError( 0.1 )
|
|
||||||
NETGEN_2D_Parameters_1.SetChordalErrorEnabled( 0 )
|
|
||||||
NETGEN_2D_Parameters_1.SetMinSize( d1 )
|
|
||||||
NETGEN_2D_Parameters_1.SetUseSurfaceCurvature( 1 )
|
|
||||||
NETGEN_2D_Parameters_1.SetFuseEdges( 1 )
|
|
||||||
NETGEN_2D_Parameters_1.SetQuadAllowed( 0 )
|
|
||||||
else:
|
|
||||||
Regular_1D = barre_1.Segment()
|
|
||||||
Number_of_Segments_1 = Regular_1D.NumberOfSegments(15)
|
|
||||||
Quadrangle_2D = barre_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
|
|
||||||
Hexa_3D = barre_1.Hexahedron(algo=smeshBuilder.Hexa)
|
|
||||||
isDone = barre_1.Compute()
|
|
||||||
|
|
||||||
f1_1 = barre_1.GroupOnGeom(f1,'f1',SMESH.FACE)
|
|
||||||
f2_1 = barre_1.GroupOnGeom(f2,'f2',SMESH.FACE)
|
|
||||||
smesh.SetName(barre_1, nom)
|
|
||||||
nommed = nom + ".med"
|
|
||||||
barre_1.ExportMED( direc + os.sep + nommed, auto_groups=0, minor=0, overwrite=1, meshPart=None, autoDimension=1 )
|
|
||||||
measure = smesh.CreateMeasurements()
|
|
||||||
meshvol = measure.Volume(barre_1.mesh)
|
|
||||||
print("Maillage publié : ", direc + os.sep + nommed)
|
|
||||||
clearMesh(barre_1, salome.myStudy, nom)
|
|
||||||
deltag = abs(geomvol - volume)/volume
|
|
||||||
deltam = abs(meshvol - geomvol)/geomvol
|
|
||||||
delta = abs(meshvol - volume)/volume
|
|
||||||
print("volumes:", volume, geomvol, meshvol, deltag, deltam)
|
|
||||||
assert(deltag < 1.e-5)
|
|
||||||
assert(deltam < 2.e-3)
|
|
||||||
#import time
|
|
||||||
#time.sleep(30)
|
|
||||||
return delta
|
|
||||||
|
|
||||||
|
|
||||||
def clearMesh(theMesh, theStudy, aName):
|
|
||||||
theMesh.Clear()
|
|
||||||
aMesh = theMesh.GetMesh()
|
|
||||||
aMesh.UnRegister()
|
|
||||||
# aStudyBuilder = theStudy.NewBuilder()
|
|
||||||
# SO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(aMesh))
|
|
||||||
# objects_to_unpublish = [SO]
|
|
||||||
# refs = theStudy.FindDependances(SO)
|
|
||||||
# objects_to_unpublish += refs
|
|
||||||
# for o in objects_to_unpublish:
|
|
||||||
# if o is not None:
|
|
||||||
# aStudyBuilder.RemoveObjectWithChildren(o)
|
|
||||||
print("clearMesh done:", aName)
|
|
||||||
|
|
||||||
def genere(r0, h0, my_container, direc):
|
|
||||||
l0 = 50.0
|
|
||||||
d0 = min(r0/2., h0/6.)
|
|
||||||
d1 = d0/2.
|
|
||||||
res = geomesh(l0, r0, h0, d0, d1, my_container, direc)
|
|
||||||
return res
|
|
||||||
|
|
||||||
def genere2(r0h0, my_container, direc):
|
|
||||||
l0 = 50.0
|
|
||||||
r0 = r0h0[0]
|
|
||||||
h0 = r0h0[1]
|
|
||||||
d0 = min(r0/2., h0/6.)
|
|
||||||
d1 = d0/2.
|
|
||||||
res = geomesh(l0, r0, h0, d0, d1, my_container, direc)
|
|
||||||
return res
|
|
@ -32,7 +32,7 @@ SALOME_CONFIGURE_FILE(CTestTestfileInstall.cmake
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CTestTestfile.cmake
|
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CTestTestfile.cmake
|
||||||
INSTALL ${TEST_INSTALL_DIRECTORY})
|
INSTALL ${TEST_INSTALL_DIRECTORY})
|
||||||
INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
|
INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
|
||||||
INSTALL(FILES ${GOOD_TESTS} ${BAD_TESTS} ${SESSION_FREE_TESTS} DESTINATION ${TEST_INSTALL_DIRECTORY})
|
INSTALL(FILES ${GOOD_TESTS} ${BAD_TESTS} ${SESSION_FREE_TESTS} ${OTHER_FILES} DESTINATION ${TEST_INSTALL_DIRECTORY})
|
||||||
INSTALL(DIRECTORY data DESTINATION ${TEST_INSTALL_DIRECTORY})
|
INSTALL(DIRECTORY data DESTINATION ${TEST_INSTALL_DIRECTORY})
|
||||||
|
|
||||||
# Add tests for 'make test'
|
# Add tests for 'make test'
|
||||||
|
@ -48,7 +48,7 @@ filePath = filePath + "/Shapes/Brep/"
|
|||||||
filename = "flight_solid.brep"
|
filename = "flight_solid.brep"
|
||||||
filename = filePath + filename
|
filename = filePath + filename
|
||||||
|
|
||||||
shape = geompy.Import(filename, "BREP")
|
shape = geompy.ImportBREP(filename)
|
||||||
idShape = geompy.addToStudy(shape, "flight")
|
idShape = geompy.addToStudy(shape, "flight")
|
||||||
|
|
||||||
print("Analysis of the geometry flight :")
|
print("Analysis of the geometry flight :")
|
@ -24,6 +24,7 @@
|
|||||||
# File : SMESH_test5.py
|
# File : SMESH_test5.py
|
||||||
# Module : SMESH
|
# Module : SMESH
|
||||||
#
|
#
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
salome.salome_init()
|
salome.salome_init()
|
||||||
import GEOM
|
import GEOM
|
||||||
@ -36,7 +37,10 @@ smesh = smeshBuilder.New()
|
|||||||
|
|
||||||
import CORBA
|
import CORBA
|
||||||
import os
|
import os
|
||||||
import os.path
|
import shutil
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
aOutPath = tempfile.mkdtemp()
|
||||||
|
|
||||||
def SetSObjName(theSObj,theName) :
|
def SetSObjName(theSObj,theName) :
|
||||||
ok, anAttr = theSObj.FindAttribute("AttributeName")
|
ok, anAttr = theSObj.FindAttribute("AttributeName")
|
||||||
@ -45,40 +49,31 @@ def SetSObjName(theSObj,theName) :
|
|||||||
#print aName.__dict__
|
#print aName.__dict__
|
||||||
aName.SetValue(theName)
|
aName.SetValue(theName)
|
||||||
|
|
||||||
def ConvertMED2UNV(thePath,theFile) :
|
def ConvertMED2UNV(theFile):
|
||||||
anInitFileName = thePath + theFile
|
print(theFile)
|
||||||
aMeshes,aResult = smesh.CreateMeshesFromMED(anInitFileName)
|
aMeshes, aResult = smesh.CreateMeshesFromMED(theFile)
|
||||||
print(aResult, aMeshes)
|
print(aMeshes, aResult)
|
||||||
|
|
||||||
for iMesh in range(len(aMeshes)) :
|
for aMesh in aMeshes:
|
||||||
aMesh = aMeshes[iMesh]
|
|
||||||
print(aMesh.GetName(), end=' ')
|
print(aMesh.GetName(), end=' ')
|
||||||
aFileName = anInitFileName
|
aMesh.SetName(os.path.basename(theFile))
|
||||||
aFileName = os.path.basename(aFileName)
|
|
||||||
aMesh.SetName(aFileName)
|
|
||||||
print(aMesh.GetName())
|
print(aMesh.GetName())
|
||||||
|
|
||||||
aOutPath = '/tmp/'
|
aFileName = os.path.join(aOutPath, theFile + ".unv")
|
||||||
aFileName = aOutPath + theFile + "." + str(iMesh) + ".unv"
|
|
||||||
aMesh.ExportUNV(aFileName)
|
aMesh.ExportUNV(aFileName)
|
||||||
|
|
||||||
aMesh = smesh.CreateMeshesFromUNV(aFileName)
|
aMesh = smesh.CreateMeshesFromUNV(aFileName)
|
||||||
print(aMesh.GetName(), end=' ')
|
print(aMesh.GetName(), end=' ')
|
||||||
os.remove(aFileName)
|
aMesh.SetName(os.path.basename(aFileName))
|
||||||
aFileName = os.path.basename(aFileName)
|
|
||||||
aMesh.SetName(aFileName)
|
|
||||||
print(aMesh.GetName())
|
print(aMesh.GetName())
|
||||||
|
|
||||||
aPath = os.getenv('DATA_DIR') + '/MedFiles/'
|
aPath = os.path.join(os.getenv('DATA_DIR'), 'MedFiles')
|
||||||
aListDir = os.listdir(aPath)
|
|
||||||
print(aListDir)
|
|
||||||
|
|
||||||
for iFile in range(len(aListDir)) :
|
for aFileName in sorted(os.listdir(aPath)):
|
||||||
aFileName = aListDir[iFile]
|
if os.path.splitext(aFileName)[-1] == ".med":
|
||||||
aName,anExt = os.path.splitext(aFileName)
|
ConvertMED2UNV(os.path.join(aPath, aFileName))
|
||||||
if anExt == ".med" :
|
|
||||||
aFileName = os.path.basename(aFileName)
|
if os.getenv('SMESH_KEEP_TMP_DIR') != '1':
|
||||||
print(aFileName)
|
shutil.rmtree(aOutPath)
|
||||||
ConvertMED2UNV(aPath,aFileName)
|
|
||||||
#break
|
|
||||||
|
|
||||||
salome.sg.updateObjBrowser()
|
salome.sg.updateObjBrowser()
|
@ -21,6 +21,11 @@
|
|||||||
# =======================================
|
# =======================================
|
||||||
# Procedure that take a triangulation and split all triangles in 4 others triangles
|
# Procedure that take a triangulation and split all triangles in 4 others triangles
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import tempfile
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
salome.salome_init()
|
salome.salome_init()
|
||||||
import GEOM
|
import GEOM
|
||||||
@ -31,16 +36,14 @@ import SMESH, SALOMEDS
|
|||||||
from salome.smesh import smeshBuilder
|
from salome.smesh import smeshBuilder
|
||||||
smesh = smeshBuilder.New()
|
smesh = smeshBuilder.New()
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
# Values
|
# Values
|
||||||
# ------
|
# ------
|
||||||
|
|
||||||
tmpDir = os.getenv('SALOME_TMP_DIR', '/tmp')
|
tmpDir = tempfile.mkdtemp()
|
||||||
print("Output directory:", tmpDir)
|
print("Output directory:", tmpDir)
|
||||||
|
|
||||||
# Path for ".med" files
|
# Path for ".med" files
|
||||||
path = os.path.join( tmpDir, "ex29_%s_" % os.getenv('USER','unknown'))
|
path = os.path.join(tmpDir, "ex29_")
|
||||||
|
|
||||||
# Name of the shape and the mesh
|
# Name of the shape and the mesh
|
||||||
name = "Carre"
|
name = "Carre"
|
||||||
@ -229,6 +232,12 @@ print(("Mesh with "+str(NbCells4)+" cells computed."))
|
|||||||
|
|
||||||
MyMesh.ExportMED(path+str(NbCells4)+"_triangles.med", 0)
|
MyMesh.ExportMED(path+str(NbCells4)+"_triangles.med", 0)
|
||||||
|
|
||||||
|
# Remove temporary directory
|
||||||
|
# --------------------------
|
||||||
|
|
||||||
|
if os.getenv('SMESH_KEEP_TMP_DIR') != '1':
|
||||||
|
shutil.rmtree(tmpDir)
|
||||||
|
|
||||||
# Update the object browser
|
# Update the object browser
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
|
@ -46,12 +46,77 @@ SET(GOOD_TESTS
|
|||||||
ex_MakePolyLine.py
|
ex_MakePolyLine.py
|
||||||
extrusion_penta_biquad.py
|
extrusion_penta_biquad.py
|
||||||
test_polyhedron_per_solid.py
|
test_polyhedron_per_solid.py
|
||||||
|
|
||||||
|
ex01_cube2build.py
|
||||||
|
ex02_cube2primitive.py
|
||||||
|
ex03_cube2partition.py
|
||||||
|
ex04_cube5tetraHexa.py
|
||||||
|
ex05_hole1build.py
|
||||||
|
ex06_hole1boolean.py
|
||||||
|
ex07_hole1partition.py
|
||||||
|
ex08_hole2build.py
|
||||||
|
ex09_grid4build.py
|
||||||
|
ex10_grid4geometry.py
|
||||||
|
ex11_grid3partition.py
|
||||||
|
ex12_grid17partition.py
|
||||||
|
ex13_hole1partial.py
|
||||||
|
ex14_cyl1holed.py
|
||||||
|
ex15_cyl2geometry.py
|
||||||
|
ex16_cyl2complementary.py
|
||||||
|
ex17_dome1.py
|
||||||
|
ex18_dome2.py
|
||||||
|
ex19_sphereINcube.py
|
||||||
|
ex21_lamp.py
|
||||||
|
ex24_cylinder.py
|
||||||
|
ex29_refine.py
|
||||||
|
ex30_groupsOp.py
|
||||||
|
ex30_tepal.py
|
||||||
|
ex31_dimGroup.py
|
||||||
|
PAL_MESH_041_mesh.py
|
||||||
|
PAL_MESH_043_2D.py
|
||||||
|
PAL_MESH_043_3D.py
|
||||||
|
SMESH_AdvancedEditor.py
|
||||||
|
SMESH_BelongToGeom.py
|
||||||
|
SMESH_blocks.py
|
||||||
|
SMESH_box2_tetra.py
|
||||||
|
SMESH_box3_tetra.py
|
||||||
|
SMESH_box.py
|
||||||
|
SMESH_box_tetra.py
|
||||||
|
SMESH_BuildCompound.py
|
||||||
|
SMESH_controls.py
|
||||||
|
SMESH_demo_hexa2_upd.py
|
||||||
|
SMESH_fixation_hexa.py
|
||||||
|
SMESH_fixation_netgen.py
|
||||||
|
SMESH_fixation.py
|
||||||
|
SMESH_fixation_tetra.py
|
||||||
|
SMESH_flight_skin.py
|
||||||
|
SMESH_freebord.py
|
||||||
|
SMESH_GroupFromGeom2.py
|
||||||
|
SMESH_GroupFromGeom.py
|
||||||
|
SMESH_GroupLyingOnGeom.py
|
||||||
|
SMESH_hexaedre.py
|
||||||
|
SMESH_mechanic_editor.py
|
||||||
|
SMESH_mechanic_netgen.py
|
||||||
|
SMESH_mechanic.py
|
||||||
|
SMESH_mechanic_tetra.py
|
||||||
|
SMESH_Nut.py
|
||||||
|
SMESH_Partition1_tetra.py
|
||||||
|
SMESH_reg.py
|
||||||
|
SMESH_Sphere.py
|
||||||
|
SMESH_test0.py
|
||||||
|
SMESH_test1_AndDisplay.py
|
||||||
|
SMESH_test1.py
|
||||||
|
SMESH_test2.py
|
||||||
|
SMESH_test3.py
|
||||||
|
SMESH_test4.py
|
||||||
|
SMESH_test5.py
|
||||||
|
SMESH_test.py
|
||||||
)
|
)
|
||||||
|
|
||||||
# The following tests can be executed without driver, just by python.
|
# The following tests can be executed without driver, just by python.
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
set(SESSION_FREE_TESTS
|
SET(SESSION_FREE_TESTS
|
||||||
basic_geom_smesh_without_session.py
|
basic_geom_smesh_without_session.py
|
||||||
basic_shaper_smesh_without_session.py
|
basic_shaper_smesh_without_session.py
|
||||||
basic_smesh_output_with_mc_field.py
|
basic_smesh_output_with_mc_field.py
|
||||||
@ -59,3 +124,10 @@ set(SESSION_FREE_TESTS
|
|||||||
shaper_smesh_groups_without_session.py
|
shaper_smesh_groups_without_session.py
|
||||||
ssl_hdf5_symbols_conflicts.py
|
ssl_hdf5_symbols_conflicts.py
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Additional files to install (not tests)
|
||||||
|
# ---------------------------------------
|
||||||
|
|
||||||
|
SET(OTHER_FILES
|
||||||
|
ex00_all.py
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user