3 Check that creating a mesh on a shaperstudy object does not raise orb not found in GetExistingSubObjects.
4 It is called in SMESH GUI on Create mesh's Apply, in SMESHGUI_MeshOp::createSubMeshOnInternalEdges.
5 We explicitly call GetExistingSubObjects here to be able to test it in python.
18 from salome.shaper import model
21 partSet = model.moduleDocument()
24 Part_1 = model.addPart(partSet)
25 Part_1_doc = Part_1.document()
28 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
31 Group_1 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]")])
32 Group_1.setName("edge_ox")
33 Group_1.result().setName("edge_ox")
36 Group_2 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]")])
37 Group_2.setName("edge_oz")
38 Group_2.result().setName("edge_oz")
43 ### SHAPERSTUDY component
46 model.publishToShaperStudy()
48 Box_1_1, edge_ox, edge_oz = SHAPERSTUDY.shape(model.featureStringId(Box_1))
54 import SMESH, SALOMEDS
55 from salome.smesh import smeshBuilder
57 smesh = smeshBuilder.New()
58 #smesh.SetEnablePublish( False ) # Set to False to avoid publish in study if not needed or in some particular situations:
59 # multiples meshes built in parallel, complex and numerous mesh edition (performance)
61 Mesh_1 = smesh.Mesh(Box_1_1)
62 Mesh_1.Segment().LocalLength(5)
65 if not Mesh_1.Compute():
66 raise Exception("Error when computing Mesh_1")
68 edge_ox_1 = Mesh_1.GroupOnGeom(edge_ox,'edge_ox',SMESH.EDGE)
69 edge_oz_1 = Mesh_1.GroupOnGeom(edge_oz,'edge_oz',SMESH.EDGE)
71 # check that ObjectToSObject works (called in GetExistingSubObjects)
72 Box_1_1_sobj = salome.ObjectToSObject(Box_1_1)
74 raise Exception("No SObject for Box_1_1")
76 # check that GetExistingSubObjects works (called in SMESHGUI_MeshOp::createSubMeshOnInternalEdges)
77 shaperBuilder = salome.lcc.FindOrLoadComponent("FactoryServer","SHAPERSTUDY")
78 sOp = shaperBuilder.GetIShapesOperations()
79 geomGroups = sOp.GetExistingSubObjects(Box_1_1, True)
81 assert(len(geomGroups)==2)
83 assert(Mesh_1.GetMesh().NbTriangles()>16)