X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_SWIG%2FsmeshDC.py;h=c13932a4f911fadddc8aba4d572b61698ea32726;hb=2d50f1341e527455310e1eea4e861bb93053d55d;hp=f07cf3c238c6233320669275e00497354a4e50b0;hpb=8fa039a796957b302d86d90b22afc0a998573f83;p=modules%2Fsmesh.git
diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py
index f07cf3c23..c13932a4f 100644
--- a/src/SMESH_SWIG/smeshDC.py
+++ b/src/SMESH_SWIG/smeshDC.py
@@ -1,4 +1,3 @@
-# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
@@ -17,11 +16,10 @@
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-
# File : smesh.py
# Author : Francis KLOSS, OCC
# Module : SMESH
-#
+
"""
\namespace smesh
\brief Module smesh
@@ -358,7 +356,7 @@ def ParseDirStruct(Dir):
pntStr = Dir.pointStruct
if isinstance(pntStr, PointStructStr6):
Parameters = str(pntStr.x1Str) + var_separator + str(pntStr.x2Str) + var_separator
- Parameters += str(pntStr.y1Str) + var_separator + str(pntStr.y2Str) + var_separator
+ Parameters += str(pntStr.y1Str) + var_separator + str(pntStr.y2Str) + var_separator
Parameters += str(pntStr.z1Str) + var_separator + str(pntStr.z2Str)
Point = PointStruct(pntStr.x2 - pntStr.x1, pntStr.y2 - pntStr.y1, pntStr.z2 - pntStr.z1)
else:
@@ -387,13 +385,13 @@ def ParseAngles(list):
else:
Result.append(parameter)
pass
-
+
Parameters = Parameters + str(parameter)
Parameters = Parameters + var_separator
pass
Parameters = Parameters[:len(Parameters)-1]
return Result, Parameters
-
+
def IsEqual(val1, val2, tol=PrecisionConfusion):
if abs(val1 - val2) < tol:
return True
@@ -491,7 +489,7 @@ def CheckPlugin(plugin):
print "Warning: BLSURFPlugin module unavailable"
return False
return True
-
+
# end of l1_auxiliary
## @}
@@ -663,27 +661,6 @@ class smeshDC(SMESH._objref_SMESH_Gen):
aMesh = Mesh(self, self.geompyD, aSmeshMesh)
return aMesh
- ## From SMESH_Gen interface
- # @return the list of integer values
- # @ingroup l1_auxiliary
- def GetSubShapesId( self, theMainObject, theListOfSubObjects ):
- return SMESH._objref_SMESH_Gen.GetSubShapesId(self,theMainObject, theListOfSubObjects)
-
- ## From SMESH_Gen interface. Creates a pattern
- # @return an instance of SMESH_Pattern
- #
- # Example of Patterns usage
- # @ingroup l2_modif_patterns
- def GetPattern(self):
- return SMESH._objref_SMESH_Gen.GetPattern(self)
-
- ## Sets number of segments per diagonal of boundary box of geometry by which
- # default segment length of appropriate 1D hypotheses is defined.
- # Default value is 10
- # @ingroup l1_auxiliary
- def SetBoundaryBoxSegmentation(self, nbSegments):
- SMESH._objref_SMESH_Gen.SetBoundaryBoxSegmentation(self,nbSegments)
-
## Concatenate the given meshes into one mesh.
# @return an instance of Mesh class
# @param meshes the meshes to combine into one mesh
@@ -707,6 +684,41 @@ class smeshDC(SMESH._objref_SMESH_Gen):
aMesh = Mesh(self, self.geompyD, aSmeshMesh)
return aMesh
+ ## Create a mesh by copying a part of another mesh.
+ # @param meshPart a part of mesh to copy, either a Mesh, a sub-mesh or a group;
+ # to copy nodes or elements not contained in any mesh object,
+ # pass result of Mesh.GetIDSource( list_of_ids, type ) as meshPart
+ # @param meshName a name of the new mesh
+ # @param toCopyGroups to create in the new mesh groups the copied elements belongs to
+ # @param toKeepIDs to preserve IDs of the copied elements or not
+ # @return an instance of Mesh class
+ def CopyMesh( self, meshPart, meshName, toCopyGroups=False, toKeepIDs=False):
+ if (isinstance( meshPart, Mesh )):
+ meshPart = meshPart.GetMesh()
+ mesh = SMESH._objref_SMESH_Gen.CopyMesh( self,meshPart,meshName,toCopyGroups,toKeepIDs )
+ return Mesh(self, self.geompyD, mesh)
+
+ ## From SMESH_Gen interface
+ # @return the list of integer values
+ # @ingroup l1_auxiliary
+ def GetSubShapesId( self, theMainObject, theListOfSubObjects ):
+ return SMESH._objref_SMESH_Gen.GetSubShapesId(self,theMainObject, theListOfSubObjects)
+
+ ## From SMESH_Gen interface. Creates a pattern
+ # @return an instance of SMESH_Pattern
+ #
+ # Example of Patterns usage
+ # @ingroup l2_modif_patterns
+ def GetPattern(self):
+ return SMESH._objref_SMESH_Gen.GetPattern(self)
+
+ ## Sets number of segments per diagonal of boundary box of geometry by which
+ # default segment length of appropriate 1D hypotheses is defined.
+ # Default value is 10
+ # @ingroup l1_auxiliary
+ def SetBoundaryBoxSegmentation(self, nbSegments):
+ SMESH._objref_SMESH_Gen.SetBoundaryBoxSegmentation(self,nbSegments)
+
# Filtering. Auxiliary functions:
# ------------------------------
@@ -735,6 +747,8 @@ class smeshDC(SMESH._objref_SMESH_Gen):
# @param UnaryOp FT_LogicalNOT or FT_Undefined
# @param BinaryOp a binary logical operation FT_LogicalAND, FT_LogicalOR or
# FT_Undefined (must be for the last criterion of all criteria)
+ # @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface,
+ # FT_LyingOnGeom, FT_CoplanarFaces criteria
# @return SMESH.Filter.Criterion
# @ingroup l1_controls
def GetCriterion(self,elementType,
@@ -742,10 +756,12 @@ class smeshDC(SMESH._objref_SMESH_Gen):
Compare = FT_EqualTo,
Treshold="",
UnaryOp=FT_Undefined,
- BinaryOp=FT_Undefined):
+ BinaryOp=FT_Undefined,
+ Tolerance=1e-07):
aCriterion = self.GetEmptyCriterion()
aCriterion.TypeOfElement = elementType
aCriterion.Type = self.EnumToLong(CritType)
+ aCriterion.Tolerance = Tolerance
aTreshold = Treshold
@@ -770,6 +786,10 @@ class smeshDC(SMESH._objref_SMESH_Gen):
else:
print "Error: The treshold should be a shape."
return None
+ if isinstance(UnaryOp,float):
+ aCriterion.Tolerance = UnaryOp
+ UnaryOp = FT_Undefined
+ pass
elif CritType == FT_RangeOfIds:
# Checks the treshold
if isinstance(aTreshold, str):
@@ -810,7 +830,9 @@ class smeshDC(SMESH._objref_SMESH_Gen):
return None
pass
elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume, FT_FreeNodes,
- FT_FreeFaces, FT_LinearOrQuadratic]:
+ FT_FreeFaces, FT_LinearOrQuadratic,
+ FT_BareBorderFace, FT_BareBorderVolume,
+ FT_OverConstrainedFace, FT_OverConstrainedVolume]:
# At this point the treshold is unnecessary
if aTreshold == FT_LogicalNOT:
aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)
@@ -845,20 +867,23 @@ class smeshDC(SMESH._objref_SMESH_Gen):
# @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
# @param Treshold the threshold value (range of id ids as string, shape, numeric)
# @param UnaryOp FT_LogicalNOT or FT_Undefined
+ # @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface,
+ # FT_LyingOnGeom, FT_CoplanarFaces criteria
# @return SMESH_Filter
# @ingroup l1_controls
def GetFilter(self,elementType,
CritType=FT_Undefined,
Compare=FT_EqualTo,
Treshold="",
- UnaryOp=FT_Undefined):
- aCriterion = self.GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined)
+ UnaryOp=FT_Undefined,
+ Tolerance=1e-07):
+ aCriterion = self.GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined,Tolerance)
aFilterMgr = self.CreateFilterManager()
aFilter = aFilterMgr.CreateFilter()
aCriteria = []
aCriteria.append(aCriterion)
aFilter.SetCriteria(aCriteria)
- aFilterMgr.Destroy()
+ aFilterMgr.UnRegister()
return aFilter
## Creates a numerical functor by its type
@@ -913,7 +938,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
obj = obj.GetMesh()
d = {}
if hasattr(obj, "_narrow") and obj._narrow(SMESH.SMESH_IDSource):
- values = obj.GetMeshInfo()
+ values = obj.GetMeshInfo()
for i in range(SMESH.Entity_Last._v):
if i < len(values): d[SMESH.EntityType._item(i)]=values[i]
pass
@@ -924,7 +949,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
# If @a src2 is None, and @a id2 = 0, distance from @a src1 / @a id1 to the origin is computed.
# If @a src2 is None, and @a id2 != 0, it is assumed that both @a id1 and @a id2 belong to @a src1.
#
- # @param src1 first source object
+ # @param src1 first source object
# @param src2 second source object
# @param id1 node/element id from the first source
# @param id2 node/element id from the second (or first) source
@@ -940,13 +965,13 @@ class smeshDC(SMESH._objref_SMESH_Gen):
else:
result = result.value
return result
-
+
## Get measure structure specifying minimum distance data between two objects
#
# If @a src2 is None, and @a id2 = 0, distance from @a src1 / @a id1 to the origin is computed.
# If @a src2 is None, and @a id2 != 0, it is assumed that both @a id1 and @a id2 belong to @a src1.
#
- # @param src1 first source object
+ # @param src1 first source object
# @param src2 second source object
# @param id1 node/element id from the first source
# @param id2 node/element id from the second (or first) source
@@ -983,9 +1008,9 @@ class smeshDC(SMESH._objref_SMESH_Gen):
pass
aMeasurements = self.CreateMeasurements()
result = aMeasurements.MinDistance(src1, src2)
- aMeasurements.Destroy()
+ aMeasurements.UnRegister()
return result
-
+
## Get bounding box of the specified object(s)
# @param objects single source object or list of source objects
# @return tuple of six values (minX, minY, minZ, maxX, maxY, maxZ)
@@ -1020,7 +1045,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
pass
aMeasurements = self.CreateMeasurements()
result = aMeasurements.BoundingBox(srclist)
- aMeasurements.Destroy()
+ aMeasurements.UnRegister()
return result
import omniORB
@@ -1059,7 +1084,16 @@ class Mesh:
if obj != 0:
if isinstance(obj, geompyDC.GEOM._objref_GEOM_Object):
self.geom = obj
+ # publish geom of mesh (issue 0021122)
+ if not self.geom.GetStudyEntry():
+ studyID = smeshpyD.GetCurrentStudy()._get_StudyId()
+ if studyID != geompyD.myStudyId:
+ geompyD.init_geom( smeshpyD.GetCurrentStudy())
+ pass
+ geo_name = "%s_%s"%(self.geom.GetShapeType(), id(self.geom)%100)
+ geompyD.addToStudy( self.geom, geo_name )
self.mesh = self.smeshpyD.CreateMesh(self.geom)
+
elif isinstance(obj, SMESH._objref_SMESH_Mesh):
self.SetMesh(obj)
else:
@@ -1412,14 +1446,14 @@ class Mesh:
except:
shapeText = " on subshape #%s" % (err.subShapeID)
errText = ""
- stdErrors = ["OK", #COMPERR_OK
+ stdErrors = ["OK", #COMPERR_OK
"Invalid input mesh", #COMPERR_BAD_INPUT_MESH
- "std::exception", #COMPERR_STD_EXCEPTION
- "OCC exception", #COMPERR_OCC_EXCEPTION
- "SALOME exception", #COMPERR_SLM_EXCEPTION
- "Unknown exception", #COMPERR_EXCEPTION
- "Memory allocation problem", #COMPERR_MEMORY_PB
- "Algorithm failed", #COMPERR_ALGO_FAILED
+ "std::exception", #COMPERR_STD_EXCEPTION
+ "OCC exception", #COMPERR_OCC_EXCEPTION
+ "SALOME exception", #COMPERR_SLM_EXCEPTION
+ "Unknown exception", #COMPERR_EXCEPTION
+ "Memory allocation problem", #COMPERR_MEMORY_PB
+ "Algorithm failed", #COMPERR_ALGO_FAILED
"Unexpected geometry"]#COMPERR_BAD_SHAPE
if err.code > 0:
if err.code < len(stdErrors): errText = stdErrors[err.code]
@@ -1744,6 +1778,8 @@ class Mesh:
# @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
# @param Treshold the threshold value (range of id ids as string, shape, numeric)
# @param UnaryOp FT_LogicalNOT or FT_Undefined
+ # @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface,
+ # FT_LyingOnGeom, FT_CoplanarFaces criteria
# @return SMESH_Group
# @ingroup l2_grps_create
def MakeGroup(self,
@@ -1752,8 +1788,9 @@ class Mesh:
CritType=FT_Undefined,
Compare=FT_EqualTo,
Treshold="",
- UnaryOp=FT_Undefined):
- aCriterion = self.smeshpyD.GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined)
+ UnaryOp=FT_Undefined,
+ Tolerance=1e-07):
+ aCriterion = self.smeshpyD.GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined,Tolerance)
group = self.MakeGroupByCriterion(groupName, aCriterion)
return group
@@ -1769,7 +1806,7 @@ class Mesh:
aCriteria.append(Criterion)
aFilter.SetCriteria(aCriteria)
group = self.MakeGroupByFilter(groupName, aFilter)
- aFilterMgr.Destroy()
+ aFilterMgr.UnRegister()
return group
## Creates a mesh group by the given criteria (list of criteria)
@@ -1782,7 +1819,7 @@ class Mesh:
aFilter = aFilterMgr.CreateFilter()
aFilter.SetCriteria(theCriteria)
group = self.MakeGroupByFilter(groupName, aFilter)
- aFilterMgr.Destroy()
+ aFilterMgr.UnRegister()
return group
## Creates a mesh group by the given filter
@@ -1813,7 +1850,7 @@ class Mesh:
aPredicate = aFilterMgr.CreateFreeEdges()
aPredicate.SetMesh(self.mesh)
aBorders = aPredicate.GetBorders()
- aFilterMgr.Destroy()
+ aFilterMgr.UnRegister()
return aBorders
## Removes a group
@@ -1855,15 +1892,15 @@ class Mesh:
# @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
+ # 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.
@@ -1871,9 +1908,9 @@ class Mesh:
# @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
+ # 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
@@ -1887,19 +1924,19 @@ class Mesh:
# @ingroup l2_grps_operon
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
+ # 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
+
+ ## Produces a group of elements of specified type using list of existing groups
+ # A new group is created. System
+ # 1) extracts all nodes on which groups elements are built
+ # 2) combines 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):
@@ -1969,6 +2006,13 @@ class Mesh:
def GetMeshEditor(self):
return self.mesh.GetMeshEditor()
+ ## Wrap a list of IDs of elements or nodes into SMESH_IDSource which
+ # can be passed as argument to accepting mesh, group or sub-mesh
+ # @return an instance of SMESH_IDSource
+ # @ingroup l1_auxiliary
+ def GetIDSource(self, ids, elemType):
+ return self.GetMeshEditor().MakeIDSource(ids, elemType)
+
## Gets MED Mesh
# @return an instance of SALOME_MED::MESH
# @ingroup l1_auxiliary
@@ -2346,7 +2390,7 @@ class Mesh:
def MinDistance(self, id1, id2=0, isElem1=False, isElem2=False):
aMeasure = self.GetMinDistance(id1, id2, isElem1, isElem2)
return aMeasure.value
-
+
## Get measure structure specifying minimum distance data between two objects
# @param id1 first node/element id
# @param id2 second node/element id (if 0, distance from @a id1 to the origin is computed)
@@ -2367,12 +2411,12 @@ class Mesh:
pass
else:
id2 = None
-
+
aMeasurements = self.smeshpyD.CreateMeasurements()
aMeasure = aMeasurements.MinDistance(id1, id2)
- aMeasurements.Destroy()
+ aMeasurements.UnRegister()
return aMeasure
-
+
## Get bounding box of the specified object(s)
# @param objects single source object or list of source objects or list of nodes/elements IDs
# @param isElem if @a objects is a list of IDs, @c True value in this parameters specifies that @a objects are elements,
@@ -2419,9 +2463,9 @@ class Mesh:
pass
aMeasurements = self.smeshpyD.CreateMeasurements()
aMeasure = aMeasurements.BoundingBox(srclist)
- aMeasurements.Destroy()
+ aMeasurements.UnRegister()
return aMeasure
-
+
# Mesh edition (SMESH_MeshEditor functionality):
# ---------------------------------------------
@@ -2651,10 +2695,10 @@ class Mesh:
# @ingroup l2_modif_throughp
def FindElementsByPoint(self, x, y, z, elementType = SMESH.ALL):
return self.editor.FindElementsByPoint(x, y, z, elementType)
-
+
# Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
# TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
-
+
def GetPointState(self, x, y, z):
return self.editor.GetPointState(x, y, z)
@@ -2722,7 +2766,7 @@ class Mesh:
IDsOfElements = self.GetElementsId()
self.mesh.SetParameters(Parameters)
Functor = 0
- if ( isinstance( theCriterion, SMESH._objref_NumericalFunctor ) ):
+ if ( isinstance( theCriterion, SMESH._objref_NumericalFunctor ) ):
Functor = theCriterion
else:
Functor = self.smeshpyD.GetFunctor(theCriterion)
@@ -3014,19 +3058,26 @@ class Mesh:
## Converts the mesh to quadratic, deletes old elements, replacing
# them with quadratic with the same id.
# @param theForce3d new node creation method:
- # 0 - the medium node lies at the geometrical edge from which the mesh element is built
+ # 0 - the medium node lies at the geometrical entity from which the mesh element is built
# 1 - the medium node lies at the middle of the line segments connecting start and end node of a mesh element
+ # @param theSubMesh a group or a sub-mesh to convert; WARNING: in this case the mesh can become not conformal
# @ingroup l2_modif_tofromqu
- def ConvertToQuadratic(self, theForce3d):
- self.editor.ConvertToQuadratic(theForce3d)
+ def ConvertToQuadratic(self, theForce3d, theSubMesh=None):
+ if theSubMesh:
+ self.editor.ConvertToQuadraticObject(theForce3d,theSubMesh)
+ else:
+ self.editor.ConvertToQuadratic(theForce3d)
## Converts the mesh from quadratic to ordinary,
# deletes old quadratic elements, \n replacing
# them with ordinary mesh elements with the same id.
- # @return TRUE in case of success, FALSE otherwise.
+ # @param theSubMesh a group or a sub-mesh to convert; WARNING: in this case the mesh can become not conformal
# @ingroup l2_modif_tofromqu
- def ConvertFromQuadratic(self):
- return self.editor.ConvertFromQuadratic()
+ def ConvertFromQuadratic(self, theSubMesh=None):
+ if theSubMesh:
+ self.editor.ConvertFromQuadraticObject(theSubMesh)
+ else:
+ return self.editor.ConvertFromQuadratic()
## Creates 2D mesh as skin on boundary faces of a 3D mesh
# @return TRUE if operation has been completed successfully, FALSE otherwise
@@ -3037,15 +3088,18 @@ class Mesh:
## Creates missing boundary elements
# @param elements - elements whose boundary is to be checked:
# mesh, group, sub-mesh or list of elements
+ # if elements is mesh, it must be the mesh whose MakeBoundaryMesh() is called
# @param dimension - defines type of boundary elements to create:
# SMESH.BND_2DFROM3D, SMESH.BND_1DFROM3D, SMESH.BND_1DFROM2D
+ # SMESH.BND_1DFROM3D creates mesh edges on all borders of free facets of 3D cells
# @param groupName - a name of group to store created boundary elements in,
# "" means not to create the group
# @param meshName - a name of new mesh to store created boundary elements in,
# "" means not to create the new mesh
- # @param toCopyElements - if true, the checked elements will be copied into the new mesh
- # @param toCopyExistingBondary - if true, not only new but also pre-existing
- # boundary elements will be copied into the new mesh
+ # @param toCopyElements - if true, the checked elements will be copied into
+ # the new mesh else only boundary elements will be copied into the new mesh
+ # @param toCopyExistingBondary - if true, not only new but also pre-existing
+ # boundary elements will be copied into the new mesh
# @return tuple (mesh, group) where bondary elements were added to
# @ingroup l2_modif_edit
def MakeBoundaryMesh(self, elements, dimension=SMESH.BND_2DFROM3D, groupName="", meshName="",
@@ -3061,6 +3115,29 @@ class Mesh:
if mesh: mesh = self.smeshpyD.Mesh(mesh)
return mesh, group
+ ##
+ # @brief Creates missing boundary elements around either the whole mesh or
+ # groups of 2D elements
+ # @param dimension - defines type of boundary elements to create
+ # @param groupName - a name of group to store all boundary elements in,
+ # "" means not to create the group
+ # @param meshName - a name of a new mesh, which is a copy of the initial
+ # mesh + created boundary elements; "" means not to create the new mesh
+ # @param toCopyAll - if true, the whole initial mesh will be copied into
+ # the new mesh else only boundary elements will be copied into the new mesh
+ # @param groups - groups of 2D elements to make boundary around
+ # @retval tuple( long, mesh, groups )
+ # long - number of added boundary elements
+ # mesh - the mesh where elements were added to
+ # group - the group of boundary elements or None
+ #
+ def MakeBoundaryElements(self, dimension=SMESH.BND_2DFROM3D, groupName="", meshName="",
+ toCopyAll=False, groups=[]):
+ nb, mesh, group = self.editor.MakeBoundaryElements(dimension,groupName,meshName,
+ toCopyAll,groups)
+ if mesh: mesh = self.smeshpyD.Mesh(mesh)
+ return nb, mesh, group
+
## Renumber mesh nodes
# @ingroup l2_modif_renumber
def RenumberNodes(self):
@@ -3107,7 +3184,8 @@ class Mesh:
return []
## Generates new elements by rotation of the elements of object around the axis
- # @param theObject object which elements should be sweeped
+ # @param theObject object which elements should be sweeped.
+ # It can be a mesh, a sub mesh or a group.
# @param Axis the axis of rotation, AxisStruct or line(geom object)
# @param AngleInRadians the angle of Rotation
# @param NbOfSteps number of steps
@@ -3142,7 +3220,8 @@ class Mesh:
return []
## Generates new elements by rotation of the elements of object around the axis
- # @param theObject object which elements should be sweeped
+ # @param theObject object which elements should be sweeped.
+ # It can be a mesh, a sub mesh or a group.
# @param Axis the axis of rotation, AxisStruct or line(geom object)
# @param AngleInRadians the angle of Rotation
# @param NbOfSteps number of steps
@@ -3177,7 +3256,8 @@ class Mesh:
return []
## Generates new elements by rotation of the elements of object around the axis
- # @param theObject object which elements should be sweeped
+ # @param theObject object which elements should be sweeped.
+ # It can be a mesh, a sub mesh or a group.
# @param Axis the axis of rotation, AxisStruct or line(geom object)
# @param AngleInRadians the angle of Rotation
# @param NbOfSteps number of steps
@@ -3213,7 +3293,7 @@ class Mesh:
## Generates new elements by extrusion of the elements with given ids
# @param IDsOfElements the list of elements ids for extrusion
- # @param StepVector vector, defining the direction and value of extrusion
+ # @param StepVector vector or DirStruct, defining the direction and value of extrusion for one step (the total extrusion length will be NbOfSteps * ||StepVector||)
# @param NbOfSteps the number of steps
# @param MakeGroups forces the generation of new groups from existing ones
# @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
@@ -3254,8 +3334,9 @@ class Mesh:
return []
## Generates new elements by extrusion of the elements which belong to the object
- # @param theObject the object which elements should be processed
- # @param StepVector vector, defining the direction and value of extrusion
+ # @param theObject the object which elements should be processed.
+ # It can be a mesh, a sub mesh or a group.
+ # @param StepVector vector, defining the direction and value of extrusion for one step (the total extrusion length will be NbOfSteps * ||StepVector||)
# @param NbOfSteps the number of steps
# @param MakeGroups forces the generation of new groups from existing ones
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
@@ -3275,8 +3356,9 @@ class Mesh:
return []
## Generates new elements by extrusion of the elements which belong to the object
- # @param theObject object which elements should be processed
- # @param StepVector vector, defining the direction and value of extrusion
+ # @param theObject object which elements should be processed.
+ # It can be a mesh, a sub mesh or a group.
+ # @param StepVector vector, defining the direction and value of extrusion for one step (the total extrusion length will be NbOfSteps * ||StepVector||)
# @param NbOfSteps the number of steps
# @param MakeGroups to generate new groups from existing ones
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
@@ -3296,8 +3378,9 @@ class Mesh:
return []
## Generates new elements by extrusion of the elements which belong to the object
- # @param theObject object which elements should be processed
- # @param StepVector vector, defining the direction and value of extrusion
+ # @param theObject object which elements should be processed.
+ # It can be a mesh, a sub mesh or a group.
+ # @param StepVector vector, defining the direction and value of extrusion for one step (the total extrusion length will be NbOfSteps * ||StepVector||)
# @param NbOfSteps the number of steps
# @param MakeGroups forces the generation of new groups from existing ones
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
@@ -3320,7 +3403,7 @@ class Mesh:
## Generates new elements by extrusion of the given elements
# The path of extrusion must be a meshed edge.
- # @param Base mesh or list of ids of elements for extrusion
+ # @param Base mesh or group, or submesh, or list of ids of elements for extrusion
# @param Path - 1D mesh or 1D sub-mesh, along which proceeds the extrusion
# @param NodeStart the start node from Path. Defines the direction of extrusion
# @param HasAngles allows the shape to be rotated around the path
@@ -3347,7 +3430,9 @@ class Mesh:
Parameters = AnglesParameters + var_separator + RefPointParameters
self.mesh.SetParameters(Parameters)
- if isinstance(Base,list):
+ if (isinstance(Path, Mesh)): Path = Path.GetMesh()
+
+ if isinstance(Base, list):
IDsOfElements = []
if Base == []: IDsOfElements = self.GetElementsId()
else: IDsOfElements = Base
@@ -3355,7 +3440,8 @@ class Mesh:
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups, ElemType)
else:
- if isinstance(Base,Mesh):
+ if isinstance(Base, Mesh): Base = Base.GetMesh()
+ if isinstance(Base, SMESH._objref_SMESH_Mesh) or isinstance(Base, SMESH._objref_SMESH_Group) or isinstance(Base, SMESH._objref_SMESH_subMesh):
return self.editor.ExtrusionAlongPathObjX(Base, Path, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups, ElemType)
@@ -3407,7 +3493,8 @@ class Mesh:
## Generates new elements by extrusion of the elements which belong to the object
# The path of extrusion must be a meshed edge.
- # @param theObject the object which elements should be processed
+ # @param theObject the object which elements should be processed.
+ # It can be a mesh, a sub mesh or a group.
# @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
# @param PathShape shape(edge) defines the sub-mesh for the path
# @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
@@ -3449,7 +3536,8 @@ class Mesh:
## Generates new elements by extrusion of the elements which belong to the object
# The path of extrusion must be a meshed edge.
- # @param theObject the object which elements should be processed
+ # @param theObject the object which elements should be processed.
+ # It can be a mesh, a sub mesh or a group.
# @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
# @param PathShape shape(edge) defines the sub-mesh for the path
# @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
@@ -3491,7 +3579,8 @@ class Mesh:
## Generates new elements by extrusion of the elements which belong to the object
# The path of extrusion must be a meshed edge.
- # @param theObject the object which elements should be processed
+ # @param theObject the object which elements should be processed.
+ # It can be a mesh, a sub mesh or a group.
# @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
# @param PathShape shape(edge) defines the sub-mesh for the path
# @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
@@ -3700,7 +3789,7 @@ class Mesh:
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
if ( isinstance( theObject, list )):
- theObject = self.editor.MakeIDSource(theObject, SMESH.ALL)
+ theObject = self.GetIDSource(theObject, SMESH.ALL)
thePoint, Parameters = ParsePointStruct(thePoint)
self.mesh.SetParameters(Parameters)
@@ -3721,7 +3810,7 @@ class Mesh:
if (isinstance(theObject, Mesh)):
theObject = theObject.GetMesh()
if ( isinstance( theObject, list )):
- theObject = self.editor.MakeIDSource(theObject,SMESH.ALL)
+ theObject = self.GetIDSource(theObject,SMESH.ALL)
mesh = self.editor.ScaleMakeMesh(theObject, thePoint, theScaleFact,
MakeGroups, NewMeshName)
@@ -3855,7 +3944,7 @@ class Mesh:
if not isinstance( exceptNodes, list):
exceptNodes = [ exceptNodes ]
if exceptNodes and isinstance( exceptNodes[0], int):
- exceptNodes = [ self.editor.MakeIDSource( exceptNodes, SMESH.NODE)]
+ exceptNodes = [ self.GetIDSource( exceptNodes, SMESH.NODE)]
return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,exceptNodes)
## Merges nodes
@@ -3951,14 +4040,14 @@ class Mesh:
## Creates a hole in a mesh by doubling the nodes of some particular elements
# @param theNodes identifiers of nodes to be doubled
- # @param theModifiedElems identifiers of elements to be updated by the new (doubled)
- # nodes. If list of element identifiers is empty then nodes are doubled but
+ # @param theModifiedElems identifiers of elements to be updated by the new (doubled)
+ # nodes. If list of element identifiers is empty then nodes are doubled but
# they not assigned to elements
# @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit
def DoubleNodes(self, theNodes, theModifiedElems):
return self.editor.DoubleNodes(theNodes, theModifiedElems)
-
+
## Creates a hole in a mesh by doubling the nodes of some particular elements
# This method provided for convenience works as DoubleNodes() described above.
# @param theNodeId identifiers of node to be doubled
@@ -3967,7 +4056,7 @@ class Mesh:
# @ingroup l2_modif_edit
def DoubleNode(self, theNodeId, theModifiedElems):
return self.editor.DoubleNode(theNodeId, theModifiedElems)
-
+
## Creates a hole in a mesh by doubling the nodes of some particular elements
# This method provided for convenience works as DoubleNodes() described above.
# @param theNodes group of nodes to be doubled
@@ -3987,20 +4076,22 @@ class Mesh:
# @param theModifiedElems list of groups of elements to be updated.
# @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit
- def DoubleNodeGroups(self, theNodes, theModifiedElems):
+ def DoubleNodeGroups(self, theNodes, theModifiedElems, theMakeGroup=False):
+ if theMakeGroup:
+ return self.editor.DoubleNodeGroupsNew(theNodes, theModifiedElems)
return self.editor.DoubleNodeGroups(theNodes, theModifiedElems)
-
+
## Creates a hole in a mesh by doubling the nodes of some particular elements
# @param theElems - the list of elements (edges or faces) to be replicated
# The nodes for duplication could be found from these elements
# @param theNodesNot - list of nodes to NOT replicate
- # @param theAffectedElems - the list of elements (cells and edges) to which the
+ # @param theAffectedElems - the list of elements (cells and edges) to which the
# replicated nodes should be associated to.
# @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit
def DoubleNodeElem(self, theElems, theNodesNot, theAffectedElems):
return self.editor.DoubleNodeElem(theElems, theNodesNot, theAffectedElems)
-
+
## Creates a hole in a mesh by doubling the nodes of some particular elements
# @param theElems - the list of elements (edges or faces) to be replicated
# The nodes for duplication could be found from these elements
@@ -4012,7 +4103,7 @@ class Mesh:
# @ingroup l2_modif_edit
def DoubleNodeElemInRegion(self, theElems, theNodesNot, theShape):
return self.editor.DoubleNodeElemInRegion(theElems, theNodesNot, theShape)
-
+
## Creates a hole in a mesh by doubling the nodes of some particular elements
# This method provided for convenience works as DoubleNodes() described above.
# @param theElems - group of of elements (edges or faces) to be replicated
@@ -4020,6 +4111,8 @@ class Mesh:
# @param theAffectedElems - group of elements to which the replicated nodes
# should be associated to.
# @param theMakeGroup forces the generation of a group containing new elements.
+ # @return TRUE or a created group if operation has been completed successfully,
+ # FALSE or None otherwise
# @ingroup l2_modif_edit
def DoubleNodeElemGroup(self, theElems, theNodesNot, theAffectedElems, theMakeGroup=False):
if theMakeGroup:
@@ -4036,16 +4129,20 @@ class Mesh:
# @ingroup l2_modif_edit
def DoubleNodeElemGroupInRegion(self, theElems, theNodesNot, theShape):
return self.editor.DoubleNodeElemGroupInRegion(theElems, theNodesNot, theShape)
-
+
## Creates a hole in a mesh by doubling the nodes of some particular elements
# This method provided for convenience works as DoubleNodes() described above.
# @param theElems - list of groups of elements (edges or faces) to be replicated
# @param theNodesNot - list of groups of nodes not to replicated
# @param theAffectedElems - group of elements to which the replicated nodes
# should be associated to.
- # @return TRUE if operation has been completed successfully, FALSE otherwise
+ # @param theMakeGroup forces the generation of a group containing new elements.
+ # @return TRUE or a created group if operation has been completed successfully,
+ # FALSE or None otherwise
# @ingroup l2_modif_edit
- def DoubleNodeElemGroups(self, theElems, theNodesNot, theAffectedElems):
+ def DoubleNodeElemGroups(self, theElems, theNodesNot, theAffectedElems, theMakeGroup=False):
+ if theMakeGroup:
+ return self.editor.DoubleNodeElemGroupsNew(theElems, theNodesNot, theAffectedElems)
return self.editor.DoubleNodeElemGroups(theElems, theNodesNot, theAffectedElems)
## Creates a hole in a mesh by doubling the nodes of some particular elements
@@ -4059,7 +4156,7 @@ class Mesh:
# @ingroup l2_modif_edit
def DoubleNodeElemGroupsInRegion(self, theElems, theNodesNot, theShape):
return self.editor.DoubleNodeElemGroupsInRegion(theElems, theNodesNot, theShape)
-
+
## Double nodes on shared faces between groups of volumes and create flat elements on demand.
# The list of groups must describe a partition of the mesh volumes.
# The nodes of the internal faces at the boundaries of the groups are doubled.
@@ -4071,6 +4168,16 @@ class Mesh:
def DoubleNodesOnGroupBoundaries(self, theDomains, createJointElems ):
return self.editor.DoubleNodesOnGroupBoundaries( theDomains, createJointElems )
+ ## Double nodes on some external faces and create flat elements.
+ # Flat elements are mainly used by some types of mechanic calculations.
+ #
+ # Each group of the list must be constituted of faces.
+ # Triangles are transformed in prisms, and quadrangles in hexahedrons.
+ # @param theGroupsOfFaces - list of groups of faces
+ # @return TRUE if operation has been completed successfully, FALSE otherwise
+ def CreateFlatElementsOnFacesGroups(self, theGroupsOfFaces ):
+ return self.editor.CreateFlatElementsOnFacesGroups( theGroupsOfFaces )
+
def _valueFromFunctor(self, funcType, elemId):
fn = self.smeshpyD.GetFunctor(funcType)
fn.SetMesh(self.mesh)
@@ -4079,27 +4186,27 @@ class Mesh:
else:
val = 0
return val
-
+
## Get length of 1D element.
# @param elemId mesh element ID
# @return element's length value
# @ingroup l1_measurements
def GetLength(self, elemId):
- return self._valueFromFunctor(SMESH.FT_Length, elemId)
+ return self._valueFromFunctor(SMESH.FT_Length, elemId)
## Get area of 2D element.
# @param elemId mesh element ID
# @return element's area value
# @ingroup l1_measurements
def GetArea(self, elemId):
- return self._valueFromFunctor(SMESH.FT_Area, elemId)
+ return self._valueFromFunctor(SMESH.FT_Area, elemId)
## Get volume of 3D element.
# @param elemId mesh element ID
# @return element's volume value
# @ingroup l1_measurements
def GetVolume(self, elemId):
- return self._valueFromFunctor(SMESH.FT_Volume3D, elemId)
+ return self._valueFromFunctor(SMESH.FT_Volume3D, elemId)
## Get maximum element length.
# @param elemId mesh element ID
@@ -4110,7 +4217,7 @@ class Mesh:
ftype = SMESH.FT_MaxElementLength3D
else:
ftype = SMESH.FT_MaxElementLength2D
- return self._valueFromFunctor(ftype, elemId)
+ return self._valueFromFunctor(ftype, elemId)
## Get aspect ratio of 2D or 3D element.
# @param elemId mesh element ID
@@ -4121,7 +4228,7 @@ class Mesh:
ftype = SMESH.FT_AspectRatio3D
else:
ftype = SMESH.FT_AspectRatio
- return self._valueFromFunctor(ftype, elemId)
+ return self._valueFromFunctor(ftype, elemId)
## Get warping angle of 2D element.
# @param elemId mesh element ID
@@ -4302,12 +4409,20 @@ class Mesh_Algorithm:
name = GetName(geom)
pass
except:
+ pass
+ if not name and geom.GetShapeType() != geompyDC.GEOM.COMPOUND:
+ # for all groups SubShapeName() returns "Compound_-1"
name = mesh.geompyD.SubShapeName(geom, piece)
- if not name:
- name = "%s_%s"%(geom.GetShapeType(), id(geom%1000))
+ if not name:
+ name = "%s_%s"%(geom.GetShapeType(), id(geom)%10000)
+ # publish geom of sub-mesh (issue 0021122)
+ if not self.geom.IsSame( self.mesh.geom ) and not self.geom.GetStudyEntry():
+ studyID = self.mesh.smeshpyD.GetCurrentStudy()._get_StudyId()
+ if studyID != self.mesh.geompyD.myStudyId:
+ self.mesh.geompyD.init_geom( self.mesh.smeshpyD.GetCurrentStudy())
+ self.mesh.geompyD.addToStudyInFather( self.mesh.geom, self.geom, name )
pass
self.subm = mesh.mesh.GetSubMesh(geom, algo.GetName())
-
self.algo = algo
status = mesh.mesh.AddHypothesis(self.geom, self.algo)
TreatHypoStatus( status, algo.GetName(), name, True )
@@ -4340,8 +4455,11 @@ class Mesh_Algorithm:
pass
self.mesh.smeshpyD.SetName(hypo, hyp + a)
pass
+ geomName=""
+ if self.geom:
+ geomName = GetName(self.geom)
status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
- TreatHypoStatus( status, GetName(hypo), GetName(self.geom), 0 )
+ TreatHypoStatus( status, GetName(hypo), geomName, 0 )
return hypo
## Returns entry of the shape to mesh in the study
@@ -4356,6 +4474,29 @@ class Mesh_Algorithm:
if not entry: return ""
return entry
+ ## Defines "ViscousLayers" hypothesis to give parameters of layers of prisms to build
+ # near mesh boundary. This hypothesis can be used by several 3D algorithms:
+ # NETGEN 3D, GHS3D, Hexahedron(i,j,k)
+ # @param thickness total thickness of layers of prisms
+ # @param numberOfLayers number of layers of prisms
+ # @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh
+ # @param ignoreFaces geometrical face (or their ids) not to generate layers on
+ # @ingroup l3_hypos_additi
+ def ViscousLayers(self, thickness, numberOfLayers, stretchFactor, ignoreFaces=[]):
+ if not isinstance(self.algo, SMESH._objref_SMESH_3D_Algo):
+ raise TypeError, "ViscousLayers are supported by 3D algorithms only"
+ if not "ViscousLayers" in self.GetCompatibleHypothesis():
+ raise TypeError, "ViscousLayers are not supported by %s"%self.algo.GetName()
+ if ignoreFaces and isinstance( ignoreFaces[0], geompyDC.GEOM._objref_GEOM_Object ):
+ ignoreFaces = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in ignoreFaces ]
+ hyp = self.Hypothesis("ViscousLayers",
+ [thickness, numberOfLayers, stretchFactor, ignoreFaces])
+ hyp.SetTotalThickness(thickness)
+ hyp.SetNumberLayers(numberOfLayers)
+ hyp.SetStretchFactor(stretchFactor)
+ hyp.SetIgnoreFaces(ignoreFaces)
+ return hyp
+
# Public class: Mesh_Segment
# --------------------------
@@ -4424,7 +4565,7 @@ class Mesh_Segment(Mesh_Algorithm):
pass
hyp.SetUsePreestimatedLength( length == 0.0 )
return hyp
-
+
## Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
# @param n for the number of segments that cut an edge
# @param s for the scale factor (optional)
@@ -4625,7 +4766,7 @@ class Mesh_Segment(Mesh_Algorithm):
store_geom = self.geom
if type(vertex) is types.IntType:
if vertex == 0 or vertex == 1:
- vertex = self.mesh.geompyD.SubShapeAllSorted(self.geom, geompyDC.ShapeType["VERTEX"])[vertex]
+ vertex = self.mesh.geompyD.ExtractShapes(self.geom, geompyDC.ShapeType["VERTEX"],True)[vertex]
self.geom = vertex
pass
pass
@@ -4884,20 +5025,31 @@ class Mesh_Triangle(Mesh_Algorithm):
self.Parameters().SetOptionValue(optionName,level)
## Sets QuadAllowed flag.
- # Only for algoType == NETGEN || NETGEN_2D || BLSURF
+ # Only for algoType == NETGEN(NETGEN_1D2D) || NETGEN_2D || BLSURF
# @ingroup l3_hypos_netgen l3_hypos_blsurf
def SetQuadAllowed(self, toAllow=True):
if self.algoType == NETGEN_2D:
- if toAllow: # add QuadranglePreference
- self.Hypothesis("QuadranglePreference", UseExisting=1, CompareMethod=self.CompareEqualHyp)
- else: # remove QuadranglePreference
+ if not self.params:
+ # use simple hyps
+ hasSimpleHyps = False
+ simpleHyps = ["QuadranglePreference","LengthFromEdges","MaxElementArea"]
for hyp in self.mesh.GetHypothesisList( self.geom ):
- if hyp.GetName() == "QuadranglePreference":
- self.mesh.RemoveHypothesis( self.geom, hyp )
+ if hyp.GetName() in simpleHyps:
+ hasSimpleHyps = True
+ if hyp.GetName() == "QuadranglePreference":
+ if not toAllow: # remove QuadranglePreference
+ self.mesh.RemoveHypothesis( self.geom, hyp )
+ pass
+ return
pass
pass
+ if hasSimpleHyps:
+ if toAllow: # add QuadranglePreference
+ self.Hypothesis("QuadranglePreference", UseExisting=1, CompareMethod=self.CompareEqualHyp)
+ pass
+ return
pass
- return
+ pass
if self.Parameters():
self.params.SetQuadAllowed(toAllow)
return
@@ -4906,30 +5058,25 @@ class Mesh_Triangle(Mesh_Algorithm):
#
# @ingroup l3_hypos_netgen
def Parameters(self, which=SOLE):
- if self.params:
- return self.params
- if self.algoType == NETGEN:
- if which == SIMPLE:
- self.params = self.Hypothesis("NETGEN_SimpleParameters_2D", [],
+ if not self.params:
+ if self.algoType == NETGEN:
+ if which == SIMPLE:
+ self.params = self.Hypothesis("NETGEN_SimpleParameters_2D", [],
+ "libNETGENEngine.so", UseExisting=0)
+ else:
+ self.params = self.Hypothesis("NETGEN_Parameters_2D", [],
+ "libNETGENEngine.so", UseExisting=0)
+ elif self.algoType == MEFISTO:
+ print "Mefisto algo support no multi-parameter hypothesis"
+ elif self.algoType == NETGEN_2D:
+ self.params = self.Hypothesis("NETGEN_Parameters_2D_ONLY", [],
"libNETGENEngine.so", UseExisting=0)
+ elif self.algoType == BLSURF:
+ self.params = self.Hypothesis("BLSURF_Parameters", [],
+ "libBLSURFEngine.so", UseExisting=0)
else:
- self.params = self.Hypothesis("NETGEN_Parameters_2D", [],
- "libNETGENEngine.so", UseExisting=0)
- return self.params
- elif self.algoType == MEFISTO:
- print "Mefisto algo support no multi-parameter hypothesis"
- return None
- elif self.algoType == NETGEN_2D:
- print "NETGEN_2D_ONLY algo support no multi-parameter hypothesis"
- print "NETGEN_2D_ONLY uses 'MaxElementArea' and 'LengthFromEdges' ones"
- return None
- elif self.algoType == BLSURF:
- self.params = self.Hypothesis("BLSURF_Parameters", [],
- "libBLSURFEngine.so", UseExisting=0)
- return self.params
- else:
- print "Mesh_Triangle with algo type %s does not have such a parameter, check algo type"%self.algoType
- return None
+ print "Mesh_Triangle with algo type %s does not have such a parameter, check algo type"%self.algoType
+ return self.params
## Sets MaxSize
#
@@ -5026,14 +5173,14 @@ class Mesh_Quadrangle(Mesh_Algorithm):
# @param quadType defines the algorithm of transition between differently descretized
# sides of a geometrical face:
# - QUAD_STANDARD - both triangles and quadrangles are possible in the transition
- # area along the finer meshed sides.
+ # area along the finer meshed sides.
# - QUAD_TRIANGLE_PREF - only triangles are built in the transition area along the
# finer meshed sides.
# - QUAD_QUADRANGLE_PREF - only quadrangles are built in the transition area along
# the finer meshed sides, iff the total quantity of segments on
# all four sides of the face is even (divisible by 2).
# - QUAD_QUADRANGLE_PREF_REVERSED - same as QUAD_QUADRANGLE_PREF but the transition
- # area is located along the coarser meshed sides.
+ # area is located along the coarser meshed sides.
# - QUAD_REDUCED - only quadrangles are built and the transition between the sides
# is made gradually, layer by layer. This type has a limitation on
# the number of segments: one pair of opposite sides must have the
@@ -5166,33 +5313,34 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
#
# @ingroup l3_hypos_netgen
def Parameters(self, which=SOLE):
- if self.params:
- return self.params
+ if not self.params:
- if self.algoType == FULL_NETGEN:
- if which == SIMPLE:
- self.params = self.Hypothesis("NETGEN_SimpleParameters_3D", [],
- "libNETGENEngine.so", UseExisting=0)
- else:
- self.params = self.Hypothesis("NETGEN_Parameters", [],
+ if self.algoType == FULL_NETGEN:
+ if which == SIMPLE:
+ self.params = self.Hypothesis("NETGEN_SimpleParameters_3D", [],
+ "libNETGENEngine.so", UseExisting=0)
+ else:
+ self.params = self.Hypothesis("NETGEN_Parameters", [],
+ "libNETGENEngine.so", UseExisting=0)
+
+ elif self.algoType == NETGEN:
+ self.params = self.Hypothesis("NETGEN_Parameters_3D", [],
"libNETGENEngine.so", UseExisting=0)
- return self.params
- if self.algoType == GHS3D:
- self.params = self.Hypothesis("GHS3D_Parameters", [],
- "libGHS3DEngine.so", UseExisting=0)
- return self.params
+ elif self.algoType == GHS3D:
+ self.params = self.Hypothesis("GHS3D_Parameters", [],
+ "libGHS3DEngine.so", UseExisting=0)
- if self.algoType == GHS3DPRL:
- self.params = self.Hypothesis("GHS3DPRL_Parameters", [],
- "libGHS3DPRLEngine.so", UseExisting=0)
- return self.params
+ elif self.algoType == GHS3DPRL:
+ self.params = self.Hypothesis("GHS3DPRL_Parameters", [],
+ "libGHS3DPRLEngine.so", UseExisting=0)
+ else:
+ print "Warning: %s supports no multi-parameter hypothesis"%self.algo.GetName()
- print "Algo supports no multi-parameter hypothesis"
- return None
+ return self.params
## Sets MaxSize
- # Parameter of FULL_NETGEN
+ # Parameter of FULL_NETGEN and NETGEN
# @ingroup l3_hypos_netgen
def SetMaxSize(self, theSize):
self.Parameters().SetMaxSize(theSize)
@@ -5204,7 +5352,7 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
self.Parameters().SetSecondOrder(theVal)
## Sets Optimize flag
- # Parameter of FULL_NETGEN
+ # Parameter of FULL_NETGEN and NETGEN
# @ingroup l3_hypos_netgen
def SetOptimize(self, theVal):
self.Parameters().SetOptimize(theVal)
@@ -5911,7 +6059,7 @@ omniORB.registerObjref(StdMeshers._objref_StdMeshers_LocalLength._NP_RepositoryI
#Wrapper class for StdMeshers_LayerDistribution hypothesis
class LayerDistribution(StdMeshers._objref_StdMeshers_LayerDistribution):
-
+
def SetLayerDistribution(self, hypo):
StdMeshers._objref_StdMeshers_LayerDistribution.SetParameters(self,hypo.GetParameters())
hypo.ClearParameters();
@@ -5922,9 +6070,9 @@ omniORB.registerObjref(StdMeshers._objref_StdMeshers_LayerDistribution._NP_Repos
#Wrapper class for StdMeshers_SegmentLengthAroundVertex hypothesis
class SegmentLengthAroundVertex(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex):
-
+
## Set Length parameter value
- # @param length numerical value or name of variable from notebook
+ # @param length numerical value or name of variable from notebook
def SetLength(self, length):
length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex.GetLastParameters(self),1,1,length)
StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex.SetParameters(self,parameters)
@@ -5936,7 +6084,7 @@ omniORB.registerObjref(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex._
#Wrapper class for StdMeshers_Arithmetic1D hypothesis
class Arithmetic1D(StdMeshers._objref_StdMeshers_Arithmetic1D):
-
+
## Set Length parameter value
# @param length numerical value or name of variable from notebook
# @param isStart true is length is Start Length, otherwise false
@@ -5947,15 +6095,15 @@ class Arithmetic1D(StdMeshers._objref_StdMeshers_Arithmetic1D):
length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_Arithmetic1D.GetLastParameters(self),2,nb,length)
StdMeshers._objref_StdMeshers_Arithmetic1D.SetParameters(self,parameters)
StdMeshers._objref_StdMeshers_Arithmetic1D.SetLength(self,length,isStart)
-
+
#Registering the new proxy for Arithmetic1D
omniORB.registerObjref(StdMeshers._objref_StdMeshers_Arithmetic1D._NP_RepositoryId, Arithmetic1D)
#Wrapper class for StdMeshers_Deflection1D hypothesis
class Deflection1D(StdMeshers._objref_StdMeshers_Deflection1D):
-
+
## Set Deflection parameter value
- # @param deflection numerical value or name of variable from notebook
+ # @param deflection numerical value or name of variable from notebook
def SetDeflection(self, deflection):
deflection,parameters = ParseParameters(StdMeshers._objref_StdMeshers_Deflection1D.GetLastParameters(self),1,1,deflection)
StdMeshers._objref_StdMeshers_Deflection1D.SetParameters(self,parameters)
@@ -5966,7 +6114,7 @@ omniORB.registerObjref(StdMeshers._objref_StdMeshers_Deflection1D._NP_Repository
#Wrapper class for StdMeshers_StartEndLength hypothesis
class StartEndLength(StdMeshers._objref_StdMeshers_StartEndLength):
-
+
## Set Length parameter value
# @param length numerical value or name of variable from notebook
# @param isStart true is length is Start Length, otherwise false
@@ -5977,54 +6125,54 @@ class StartEndLength(StdMeshers._objref_StdMeshers_StartEndLength):
length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_StartEndLength.GetLastParameters(self),2,nb,length)
StdMeshers._objref_StdMeshers_StartEndLength.SetParameters(self,parameters)
StdMeshers._objref_StdMeshers_StartEndLength.SetLength(self,length,isStart)
-
+
#Registering the new proxy for StartEndLength
omniORB.registerObjref(StdMeshers._objref_StdMeshers_StartEndLength._NP_RepositoryId, StartEndLength)
#Wrapper class for StdMeshers_MaxElementArea hypothesis
class MaxElementArea(StdMeshers._objref_StdMeshers_MaxElementArea):
-
+
## Set Max Element Area parameter value
# @param area numerical value or name of variable from notebook
def SetMaxElementArea(self, area):
area ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_MaxElementArea.GetLastParameters(self),1,1,area)
StdMeshers._objref_StdMeshers_MaxElementArea.SetParameters(self,parameters)
StdMeshers._objref_StdMeshers_MaxElementArea.SetMaxElementArea(self,area)
-
+
#Registering the new proxy for MaxElementArea
omniORB.registerObjref(StdMeshers._objref_StdMeshers_MaxElementArea._NP_RepositoryId, MaxElementArea)
#Wrapper class for StdMeshers_MaxElementVolume hypothesis
class MaxElementVolume(StdMeshers._objref_StdMeshers_MaxElementVolume):
-
+
## Set Max Element Volume parameter value
# @param volume numerical value or name of variable from notebook
def SetMaxElementVolume(self, volume):
volume ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_MaxElementVolume.GetLastParameters(self),1,1,volume)
StdMeshers._objref_StdMeshers_MaxElementVolume.SetParameters(self,parameters)
StdMeshers._objref_StdMeshers_MaxElementVolume.SetMaxElementVolume(self,volume)
-
+
#Registering the new proxy for MaxElementVolume
omniORB.registerObjref(StdMeshers._objref_StdMeshers_MaxElementVolume._NP_RepositoryId, MaxElementVolume)
#Wrapper class for StdMeshers_NumberOfLayers hypothesis
class NumberOfLayers(StdMeshers._objref_StdMeshers_NumberOfLayers):
-
+
## Set Number Of Layers parameter value
# @param nbLayers numerical value or name of variable from notebook
def SetNumberOfLayers(self, nbLayers):
nbLayers ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_NumberOfLayers.GetLastParameters(self),1,1,nbLayers)
StdMeshers._objref_StdMeshers_NumberOfLayers.SetParameters(self,parameters)
StdMeshers._objref_StdMeshers_NumberOfLayers.SetNumberOfLayers(self,nbLayers)
-
+
#Registering the new proxy for NumberOfLayers
omniORB.registerObjref(StdMeshers._objref_StdMeshers_NumberOfLayers._NP_RepositoryId, NumberOfLayers)
#Wrapper class for StdMeshers_NumberOfSegments hypothesis
class NumberOfSegments(StdMeshers._objref_StdMeshers_NumberOfSegments):
-
+
## Set Number Of Segments parameter value
# @param nbSeg numerical value or name of variable from notebook
def SetNumberOfSegments(self, nbSeg):
@@ -6032,14 +6180,14 @@ class NumberOfSegments(StdMeshers._objref_StdMeshers_NumberOfSegments):
nbSeg , parameters = ParseParameters(lastParameters,1,1,nbSeg)
StdMeshers._objref_StdMeshers_NumberOfSegments.SetParameters(self,parameters)
StdMeshers._objref_StdMeshers_NumberOfSegments.SetNumberOfSegments(self,nbSeg)
-
+
## Set Scale Factor parameter value
# @param factor numerical value or name of variable from notebook
def SetScaleFactor(self, factor):
factor, parameters = ParseParameters(StdMeshers._objref_StdMeshers_NumberOfSegments.GetLastParameters(self),2,2,factor)
StdMeshers._objref_StdMeshers_NumberOfSegments.SetParameters(self,parameters)
StdMeshers._objref_StdMeshers_NumberOfSegments.SetScaleFactor(self,factor)
-
+
#Registering the new proxy for NumberOfSegments
omniORB.registerObjref(StdMeshers._objref_StdMeshers_NumberOfSegments._NP_RepositoryId, NumberOfSegments)
@@ -6110,7 +6258,7 @@ if not noNETGENPlugin:
NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetLocalLength(self, length)
## Set Max Element Area parameter value
- # @param area numerical value or name of variable from notebook
+ # @param area numerical value or name of variable from notebook
def SetMaxElementArea(self, area):
lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self)
area, parameters = ParseParameters(lastParameters,2,2,area)
@@ -6131,7 +6279,7 @@ if not noNETGENPlugin:
#Wrapper class for NETGENPlugin_SimpleHypothesis_3D hypothesis
class NETGEN_SimpleParameters_3D(NETGEN_SimpleParameters_2D,NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D):
## Set Max Element Volume parameter value
- # @param volume numerical value or name of variable from notebook
+ # @param volume numerical value or name of variable from notebook
def SetMaxElementVolume(self, volume):
lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.GetLastParameters(self)
volume, parameters = ParseParameters(lastParameters,3,3,volume)