Salome HOME
Update of CheckDone
[modules/smesh.git] / test / basic_shaper_smesh_without_session.py
1
2 """
3 Most basic test of SHAPE/SMESH usecase, but it can be tested without any session launched.
4 """
5
6 import sys
7 import salome
8 salome.standalone() # <- key point of test is here
9 salome.salome_init()
10
11 #from salome.shaper import initConfig
12
13 import os
14 print(os.getpid())
15 #input("AAA")
16 ###
17 ### SHAPER component
18 ###
19
20 from salome.shaper import model
21 model.begin()
22 partSet = model.moduleDocument()
23
24 ### Create Part
25 Part_1 = model.addPart(partSet)
26 Part_1_doc = Part_1.document()
27
28 ### Create Box
29 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
30
31 model.end()
32
33 ###
34 ### SHAPERSTUDY component
35 ###
36 #import pdb; pdb.set_trace()
37 model.publishToShaperStudy()
38 import SHAPERSTUDY
39 #import pdb; pdb.set_trace()
40 Box_1_1, = SHAPERSTUDY.shape(model.featureStringId(Box_1))
41 ###
42 ### SMESH component
43 ###
44
45 import  SMESH, SALOMEDS
46 from salome.smesh import smeshBuilder
47
48 smesh = smeshBuilder.New()
49 #smesh.SetEnablePublish( False ) # Set to False to avoid publish in study if not needed or in some particular situations:
50                                  # multiples meshes built in parallel, complex and numerous mesh edition (performance)
51
52 Mesh_1 = smesh.Mesh(Box_1_1)
53 NETGEN_1D_2D_3D = Mesh_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
54 NETGEN_3D_Parameters_1 = NETGEN_1D_2D_3D.Parameters()
55 NETGEN_3D_Parameters_1.SetMaxSize( 5 )
56 NETGEN_3D_Parameters_1.SetMinSize( 1 )
57 NETGEN_3D_Parameters_1.SetSecondOrder( 0 )
58 NETGEN_3D_Parameters_1.SetOptimize( 1 )
59 NETGEN_3D_Parameters_1.SetFineness( 2 )
60 NETGEN_3D_Parameters_1.SetChordalError( -1 )
61 NETGEN_3D_Parameters_1.SetChordalErrorEnabled( 0 )
62 NETGEN_3D_Parameters_1.SetUseSurfaceCurvature( 1 )
63 NETGEN_3D_Parameters_1.SetFuseEdges( 1 )
64 NETGEN_3D_Parameters_1.SetQuadAllowed( 0 )
65 NETGEN_3D_Parameters_1.SetCheckChartBoundary( 152 )
66 isDone = Mesh_1.Compute()
67
68
69 ## Set names of Mesh objects
70 smesh.SetName(NETGEN_1D_2D_3D.GetAlgorithm(), 'NETGEN 1D-2D-3D')
71 smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
72 smesh.SetName(NETGEN_3D_Parameters_1, 'NETGEN 3D Parameters_1')
73
74 assert(Mesh_1.GetMesh().NbTetras()>=5)