X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=doc%2Fsalome%2Fexamples%2Fbasic_shaper_smesh_without_session.py;fp=doc%2Fsalome%2Fexamples%2Fbasic_shaper_smesh_without_session.py;h=54594a19448632239395f27a33a4a813f212de79;hp=0000000000000000000000000000000000000000;hb=229951706125e2a6e16f31428db784066900eab1;hpb=b8cc25cce5e1bd0bf006b25d4a53d60c4767114c diff --git a/doc/salome/examples/basic_shaper_smesh_without_session.py b/doc/salome/examples/basic_shaper_smesh_without_session.py new file mode 100644 index 000000000..54594a194 --- /dev/null +++ b/doc/salome/examples/basic_shaper_smesh_without_session.py @@ -0,0 +1,74 @@ + +""" +Most basic test of SHAPE/SMESH usecase, but it can be tested without any session launched. +""" + +import sys +import salome +salome.standalone() # <- key point of test is here +salome.salome_init() + +#from salome.shaper import initConfig + +import os +print(os.getpid()) +#input("AAA") +### +### SHAPER component +### + +from salome.shaper import model +model.begin() +partSet = model.moduleDocument() + +### Create Part +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() + +### Create Box +Box_1 = model.addBox(Part_1_doc, 10, 10, 10) + +model.end() + +### +### SHAPERSTUDY component +### +#import pdb; pdb.set_trace() +model.publishToShaperStudy() +import SHAPERSTUDY +#import pdb; pdb.set_trace() +Box_1_1, = SHAPERSTUDY.shape(model.featureStringId(Box_1)) +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New() +#smesh.SetEnablePublish( False ) # Set to False to avoid publish in study if not needed or in some particular situations: + # multiples meshes built in parallel, complex and numerous mesh edition (performance) + +Mesh_1 = smesh.Mesh(Box_1_1) +NETGEN_1D_2D_3D = Mesh_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D) +NETGEN_3D_Parameters_1 = NETGEN_1D_2D_3D.Parameters() +NETGEN_3D_Parameters_1.SetMaxSize( 5 ) +NETGEN_3D_Parameters_1.SetMinSize( 1 ) +NETGEN_3D_Parameters_1.SetSecondOrder( 0 ) +NETGEN_3D_Parameters_1.SetOptimize( 1 ) +NETGEN_3D_Parameters_1.SetFineness( 2 ) +NETGEN_3D_Parameters_1.SetChordalError( -1 ) +NETGEN_3D_Parameters_1.SetChordalErrorEnabled( 0 ) +NETGEN_3D_Parameters_1.SetUseSurfaceCurvature( 1 ) +NETGEN_3D_Parameters_1.SetFuseEdges( 1 ) +NETGEN_3D_Parameters_1.SetQuadAllowed( 0 ) +NETGEN_3D_Parameters_1.SetCheckChartBoundary( 152 ) +isDone = Mesh_1.Compute() + + +## Set names of Mesh objects +smesh.SetName(NETGEN_1D_2D_3D.GetAlgorithm(), 'NETGEN 1D-2D-3D') +smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1') +smesh.SetName(NETGEN_3D_Parameters_1, 'NETGEN 3D Parameters_1') + +assert(Mesh_1.GetMesh().NbTetras()>=5)