mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 08:50:35 +05:00
Add a new test for sessionless mode to check that creating a mesh on a shaperstudy object does not raise orb not found
This commit is contained in:
parent
aaf57db6ff
commit
1c35693208
88
doc/salome/examples/shaper_smesh_groups_without_session.py
Normal file
88
doc/salome/examples/shaper_smesh_groups_without_session.py
Normal file
@ -0,0 +1,88 @@
|
||||
|
||||
"""
|
||||
Check that creating a mesh on a shaperstudy object does not raise orb not found in GetExistingSubObjects.
|
||||
It is called in SMESH GUI on Create mesh's Apply, in SMESHGUI_MeshOp::createSubMeshOnInternalEdges.
|
||||
We explicitly call GetExistingSubObjects here to be able to test it in python.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import salome
|
||||
|
||||
salome.standalone()
|
||||
salome.salome_init()
|
||||
|
||||
###
|
||||
### 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)
|
||||
|
||||
### Create Group
|
||||
Group_1 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]")])
|
||||
Group_1.setName("edge_ox")
|
||||
Group_1.result().setName("edge_ox")
|
||||
|
||||
### Create Group
|
||||
Group_2 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]")])
|
||||
Group_2.setName("edge_oz")
|
||||
Group_2.result().setName("edge_oz")
|
||||
|
||||
model.end()
|
||||
|
||||
###
|
||||
### SHAPERSTUDY component
|
||||
###
|
||||
|
||||
model.publishToShaperStudy()
|
||||
import SHAPERSTUDY
|
||||
Box_1_1, edge_ox, edge_oz = 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)
|
||||
|
||||
Regular_1D = Mesh_1.Segment()
|
||||
Local_Length_1 = Regular_1D.LocalLength(5)
|
||||
|
||||
MEFISTO_2D = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO)
|
||||
|
||||
ok = Mesh_1.Compute()
|
||||
|
||||
if not ok:
|
||||
raise Exception("Error when computing Mesh_1")
|
||||
|
||||
edge_ox_1 = Mesh_1.GroupOnGeom(edge_ox,'edge_ox',SMESH.EDGE)
|
||||
edge_oz_1 = Mesh_1.GroupOnGeom(edge_oz,'edge_oz',SMESH.EDGE)
|
||||
|
||||
# check that ObjectToSObject works (called in GetExistingSubObjects)
|
||||
Box_1_1_sobj = salome.ObjectToSObject(Box_1_1)
|
||||
if not Box_1_1_sobj:
|
||||
raise Exception("No SObject for Box_1_1")
|
||||
|
||||
# check that GetExistingSubObjects works (called in SMESHGUI_MeshOp::createSubMeshOnInternalEdges)
|
||||
shaperBuilder = salome.lcc.FindOrLoadComponent("FactoryServer","SHAPERSTUDY")
|
||||
sOp = shaperBuilder.GetIShapesOperations()
|
||||
geomGroups = sOp.GetExistingSubObjects(Box_1_1, True)
|
||||
|
||||
assert(len(geomGroups)==2)
|
||||
|
||||
assert(Mesh_1.GetMesh().NbTriangles()>16)
|
@ -188,6 +188,7 @@ SET(GOOD_TESTS
|
||||
set(SESSION_FREE_TESTS
|
||||
basic_geom_smesh_without_session.py
|
||||
basic_shaper_smesh_without_session.py
|
||||
shaper_smesh_groups_without_session.py
|
||||
)
|
||||
|
||||
SET(EXAMPLES_TESTS ${BAD_TESTS} ${GOOD_TESTS} ${SESSION_FREE_TESTS} testme.py)
|
||||
|
Loading…
Reference in New Issue
Block a user