attr = sobj.FindAttribute("AttributeName")[1]
return attr.Value()
-## Sets a name to the object
-def SetName(obj, name):
- if isinstance( obj, Mesh ):
- obj = obj.GetMesh()
- elif isinstance( obj, Mesh_Algorithm ):
- obj = obj.GetAlgorithm()
- ior = salome.orb.object_to_string(obj)
- sobj = salome.myStudy.FindObjectIOR(ior)
- if not sobj is None:
- attr = sobj.FindAttribute("AttributeName")[1]
- attr.SetValue(name)
-
## Prints error message if a hypothesis was not assigned.
def TreatHypoStatus(status, hypName, geomName, isAlgo):
if isAlgo:
# From SMESH_Gen interface:
# ------------------------
+ ## Sets the given name to the object
+ # @param obj the object to rename
+ # @param name a new object name
+ # @ingroup l1_auxiliary
+ def SetName(self, obj, name):
+ print "obj_name = ", name
+ if isinstance( obj, Mesh ):
+ obj = obj.GetMesh()
+ elif isinstance( obj, Mesh_Algorithm ):
+ obj = obj.GetAlgorithm()
+ ior = salome.orb.object_to_string(obj)
+ SMESH._objref_SMESH_Gen.SetName(self, ior, name)
+
## Sets the current mode
# @ingroup l1_auxiliary
def SetEmbeddedMode( self,theMode ):
else:
print "Error: given parameter is not numerucal functor type."
+ ## Creates hypothesis
+ # @param
+ # @param
+ # @return created hypothesis instance
+ def CreateHypothesis(self, theHType, theLibName="libStdMeshersEngine.so"):
+ return SMESH._objref_SMESH_Gen.CreateHypothesis(self, theHType, theLibName )
import omniORB
#Registering the new proxy for SMESH_Gen
else:
self.mesh = self.smeshpyD.CreateEmptyMesh()
if name != 0:
- SetName(self.mesh, name)
+ self.smeshpyD.SetName(self.mesh, name)
elif obj != 0:
- SetName(self.mesh, GetName(obj))
+ self.smeshpyD.SetName(self.mesh, GetName(obj))
if not self.geom:
self.geom = self.mesh.GetShapeToMesh()
# @param name a new name of the mesh
# @ingroup l2_construct
def SetName(self, name):
- SetName(self.GetMesh(), name)
+ self.smeshpyD.SetName(self.GetMesh(), name)
## Gets the subMesh object associated to a \a theSubObject geometrical object.
# The subMesh object gives access to the IDs of nodes and elements.
smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
salome.sg.updateObjBrowser(1)
+ ## Removes all nodes and elements of indicated shape
+ # @ingroup l2_construct
+ def ClearSubMesh(self, geomId):
+ self.mesh.ClearSubMesh(geomId)
+ if salome.sg.hasDesktop():
+ smeshgui = salome.ImportComponentGUI("SMESH")
+ smeshgui.Init(salome.myStudyId)
+ smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
+ salome.sg.updateObjBrowser(1)
+
## Computes a tetrahedral mesh using AutomaticLength + MEFISTO + NETGEN
# @param fineness [0,-1] defines mesh fineness
# @return True or False
# @ingroup l2_grps_operon
def UnionGroups(self, group1, group2, name):
return self.mesh.UnionGroups(group1, group2, name)
-
+
+ ## Produces a union list of groups
+ # New group is created. All mesh elements that are present in
+ # initial groups are added to the new one
+ # @return an instance of SMESH_Group
+ # @ingroup l2_grps_operon
+ def UnionListOfGroups(self, groups, name):
+ return self.mesh.UnionListOfGroups(groups, name)
+
## Prodices an intersection of two groups
# A new group is created. All mesh elements that are common
# for the two initial groups are added to the new one.
# @ingroup l2_grps_operon
def IntersectGroups(self, group1, group2, name):
return self.mesh.IntersectGroups(group1, group2, name)
+
+ ## Produces an intersection of groups
+ # New group is created. All mesh elements that are present in all
+ # initial groups simultaneously are added to the new one
+ # @return an instance of SMESH_Group
+ # @ingroup l2_grps_operon
+ def IntersectListOfGroups(self, groups, name):
+ return self.mesh.IntersectListOfGroups(groups, name)
## Produces a cut of two groups
# A new group is created. All mesh elements that are present in
# the main group but are not present in the tool group are added to the new one
# @return an instance of SMESH_Group
# @ingroup l2_grps_operon
- def CutGroups(self, mainGroup, toolGroup, name):
- return self.mesh.CutGroups(mainGroup, toolGroup, name)
+ def CutGroups(self, main_group, tool_group, name):
+ return self.mesh.CutGroups(main_group, tool_group, name)
+
+ ## Produces a cut of groups
+ # A new group is created. All mesh elements that are present in main groups
+ # but do not present in tool groups are added to the new one
+ # @return an instance of SMESH_Group
+ # @ingroup l2_grps_operon
+ def CutListOfGroups(self, main_groups, tool_groups, name):
+ return self.mesh.CutListOfGroups(main_groups, tool_groups, name)
+
+ ## Produces a group of elements with specified element type using list of existing groups
+ # A new group is created. System
+ # 1) extract all nodes on which groups elements are built
+ # 2) combine all elements of specified dimension laying on these nodes
+ # @return an instance of SMESH_Group
+ # @ingroup l2_grps_operon
+ def CreateDimGroup(self, groups, elem_type, name):
+ return self.mesh.CreateDimGroup(groups, elem_type, name)
+
+ ## Convert group on geom into standalone group
+ # @ingroup l2_grps_delete
+ def ConvertToStandalone(self, group):
+ return self.mesh.ConvertToStandalone(group)
# Get some info about mesh:
# ------------------------
## Sets the name to the algorithm
def SetName(self, name):
- SetName(self.algo, name)
+ self.mesh.smeshpyD.SetName(self.algo, name)
## Gets the id of the algorithm
def GetId(self):
s = ","
i = i + 1
pass
- SetName(hypo, hyp + a)
+ self.mesh.smeshpyD.SetName(hypo, hyp + a)
pass
status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
TreatHypoStatus( status, GetName(hypo), GetName(self.geom), 0 )