3 Most basic test of SHAPE/SMESH usecase, but it can be tested without any session launched.
8 salome.standalone() # <- key point of test is here
11 #from salome.shaper import initConfig
20 from salome.shaper import model
22 partSet = model.moduleDocument()
25 Part_1 = model.addPart(partSet)
26 Part_1_doc = Part_1.document()
29 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
34 ### SHAPERSTUDY component
36 #import pdb; pdb.set_trace()
37 model.publishToShaperStudy()
39 #import pdb; pdb.set_trace()
40 Box_1_1, = SHAPERSTUDY.shape(model.featureStringId(Box_1))
45 import SMESH, SALOMEDS
46 from salome.smesh import smeshBuilder
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)
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()
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')
74 assert(Mesh_1.GetMesh().NbTetras()>=5)