if CritType in [FT_BelongToGeom, FT_BelongToPlane, FT_BelongToGenSurface,
FT_BelongToCylinder, FT_LyingOnGeom]:
- # Checks that Threshold is GEOM object
+ # Check that Threshold is GEOM object
if isinstance(aThreshold, geomBuilder.GEOM._objref_GEOM_Object):
aCriterion.ThresholdStr = GetName(aThreshold)
aCriterion.ThresholdID = aThreshold.GetStudyEntry()
elif isinstance( aThreshold, str ):
aCriterion.ThresholdStr = aThreshold
else:
- print "Error: The Threshold should be a shape."
- return None
+ raise TypeError, "The Threshold should be a shape."
if isinstance(UnaryOp,float):
aCriterion.Tolerance = UnaryOp
UnaryOp = FT_Undefined
pass
+ elif CritType == FT_BelongToMeshGroup:
+ # Check that Threshold is a group
+ if isinstance(aThreshold, SMESH._objref_SMESH_GroupBase):
+ if aThreshold.GetType() != elementType:
+ raise ValueError, "Group type mismatches Element type"
+ aCriterion.ThresholdStr = aThreshold.GetName()
+ aCriterion.ThresholdID = salome.orb.object_to_string( aThreshold )
+ study = self.GetCurrentStudy()
+ if study:
+ so = study.FindObjectIOR( aCriterion.ThresholdID )
+ if so:
+ entry = so.GetID()
+ if entry:
+ aCriterion.ThresholdID = entry
+ else:
+ raise TypeError, "The Threshold should be a Mesh Group"
elif CritType == FT_RangeOfIds:
- # Checks that Threshold is string
+ # Check that Threshold is string
if isinstance(aThreshold, str):
aCriterion.ThresholdStr = aThreshold
else:
- print "Error: The Threshold should be a string."
- return None
+ raise TypeError, "The Threshold should be a string."
elif CritType == FT_CoplanarFaces:
- # Checks the Threshold
+ # Check the Threshold
if isinstance(aThreshold, int):
aCriterion.ThresholdID = str(aThreshold)
elif isinstance(aThreshold, str):
raise ValueError, "Invalid ID of mesh face: '%s'"%aThreshold
aCriterion.ThresholdID = aThreshold
else:
- raise ValueError,\
+ raise TypeError,\
"The Threshold should be an ID of mesh face and not '%s'"%aThreshold
elif CritType == FT_ConnectedElements:
- # Checks the Threshold
+ # Check the Threshold
if isinstance(aThreshold, geomBuilder.GEOM._objref_GEOM_Object): # shape
aCriterion.ThresholdID = aThreshold.GetStudyEntry()
if not aCriterion.ThresholdID:
else:
aCriterion.ThresholdStr = aThreshold # hope that it's point coordinates
else:
- raise ValueError,\
+ raise TypeError,\
"The Threshold should either a VERTEX, or a node ID, "\
"or a list of point coordinates and not '%s'"%aThreshold
elif CritType == FT_ElemGeomType:
- # Checks the Threshold
+ # Check the Threshold
try:
aCriterion.Threshold = self.EnumToLong(aThreshold)
assert( aThreshold in SMESH.GeometryType._items )
if isinstance(aThreshold, int):
aCriterion.Threshold = aThreshold
else:
- print "Error: The Threshold should be an integer or SMESH.GeometryType."
- return None
+ raise TypeError, "The Threshold should be an integer or SMESH.GeometryType."
pass
pass
elif CritType == FT_EntityType:
- # Checks the Threshold
+ # Check the Threshold
try:
aCriterion.Threshold = self.EnumToLong(aThreshold)
assert( aThreshold in SMESH.EntityType._items )
if isinstance(aThreshold, int):
aCriterion.Threshold = aThreshold
else:
- print "Error: The Threshold should be an integer or SMESH.EntityType."
- return None
+ raise TypeError, "The Threshold should be an integer or SMESH.EntityType."
pass
pass
elif CritType == FT_GroupColor:
- # Checks the Threshold
+ # Check the Threshold
try:
aCriterion.ThresholdStr = self.ColorToString(aThreshold)
except:
- print "Error: The threshold value should be of SALOMEDS.Color type"
- return None
+ raise TypeError, "The threshold value should be of SALOMEDS.Color type"
pass
elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_FreeNodes, FT_FreeFaces,
FT_LinearOrQuadratic, FT_BadOrientedVolume,
aThreshold = float(aThreshold)
aCriterion.Threshold = aThreshold
except:
- print "Error: The Threshold should be a number."
+ raise TypeError, "The Threshold should be a number."
return None
if Threshold == FT_LogicalNOT or UnaryOp == FT_LogicalNOT:
for attrName in dir(self):
attr = getattr( self, attrName )
if isinstance( attr, algoCreator ):
- #print "algoCreator ", attrName
setattr( self, attrName, attr.copy( self ))
pass
pass
faces = self._getIdSourceList( faces, SMESH.FACE, unRegister )
if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
- Axis = self.smeshpyD.GetDirStruct( Axis )
+ Axis = self.smeshpyD.GetAxisStruct( Axis )
if isinstance( Axis, list ):
Axis = SMESH.AxisStruct( *Axis )
# @ingroup l2_modif_extrurev
def RotationSweep(self, IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
- unRegister = genObjUnRegister()
- if IDsOfElements == []:
- IDsOfElements = self.mesh
- if IDsOfElements and \
- isinstance( IDsOfElements, list ) and \
- isinstance( IDsOfElements[0], int ):
- IDsOfElements = self.GetIDSource( IDsOfElements, SMESH.ALL )
- unRegister.set( IDsOfElements )
- if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
- Axis = self.smeshpyD.GetAxisStruct(Axis)
- AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
- NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
- Parameters = Axis.parameters + var_separator + AngleParameters + var_separator + Parameters
- self.mesh.SetParameters(Parameters)
- if TotalAngle and NbOfSteps:
- AngleInRadians /= NbOfSteps
- return self.editor.RotationSweepObjects([],[IDsOfElements],[IDsOfElements], Axis,
- AngleInRadians, NbOfSteps, Tolerance, MakeGroups)
+ return self.RotationSweepObjects([], IDsOfElements, IDsOfElements, Axis,
+ AngleInRadians, NbOfSteps, Tolerance,
+ MakeGroups, TotalAngle)
## Generates new elements by rotation of the elements of object around the axis
# @param theObject object which elements should be sweeped.
# @ingroup l2_modif_extrurev
def RotationSweepObject(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
- if isinstance( theObject, Mesh ):
- theObject = theObject.GetMesh()
- if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
- Axis = self.smeshpyD.GetAxisStruct(Axis)
- AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
- NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
- Parameters = Axis.parameters + var_separator + AngleParameters + var_separator + Parameters
- self.mesh.SetParameters(Parameters)
- if TotalAngle and NbOfSteps:
- AngleInRadians /= NbOfSteps
- return self.editor.RotationSweepObjects([],[theObject],[theObject], Axis,
- AngleInRadians, NbOfSteps, Tolerance )
+ return self.RotationSweepObjects( [], theObject, theObject, Axis,
+ AngleInRadians, NbOfSteps, Tolerance,
+ MakeGroups, TotalAngle )
## Generates new elements by rotation of the elements of object around the axis
# @param theObject object which elements should be sweeped.
# @ingroup l2_modif_extrurev
def RotationSweepObject1D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
- if isinstance( theObject, Mesh ):
- theObject = theObject.GetMesh()
- if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
- Axis = self.smeshpyD.GetAxisStruct(Axis)
- AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
- NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
- Parameters = Axis.parameters + var_separator + AngleParameters + var_separator + Parameters
- self.mesh.SetParameters(Parameters)
- if TotalAngle and NbOfSteps:
- AngleInRadians /= NbOfSteps
- return self.editor.RotationSweepObjects([],[theObject],[], Axis,
- AngleInRadians, NbOfSteps, Tolerance)
+ return self.RotationSweepObjects([],theObject,[], Axis,
+ AngleInRadians, NbOfSteps, Tolerance,
+ MakeGroups, TotalAngle)
## Generates new elements by rotation of the elements of object around the axis
# @param theObject object which elements should be sweeped.
# @ingroup l2_modif_extrurev
def RotationSweepObject2D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
- if isinstance( theObject, Mesh ):
- theObject = theObject.GetMesh()
- if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
- Axis = self.smeshpyD.GetAxisStruct(Axis)
- AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
- NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
- Parameters = Axis.parameters + var_separator + AngleParameters + var_separator + Parameters
- self.mesh.SetParameters(Parameters)
- if TotalAngle and NbOfSteps:
- AngleInRadians /= NbOfSteps
- return self.editor.RotationSweepObjects([],[],[theObject], Axis, AngleInRadians,
- NbOfSteps, Tolerance)
+ return self.RotationSweepObjects([],[],theObject, Axis, AngleInRadians,
+ NbOfSteps, Tolerance, MakeGroups, TotalAngle)
## Generates new elements by extrusion of the given elements and nodes
# @param nodes - nodes to extrude: a list including ids, groups, sub-meshes or a mesh
Parameters = StepVector.PS.parameters + var_separator + Parameters
self.mesh.SetParameters(Parameters)
- return self.editor.ExtrusionSweepObjects( nodes, edges, faces, StepVector, NbOfSteps, MakeGroups)
+ return self.editor.ExtrusionSweepObjects( nodes, edges, faces,
+ StepVector, NbOfSteps, MakeGroups)
## Generates new elements by extrusion of the elements with given ids
# @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
# @ingroup l2_modif_extrurev
def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False, IsNodes = False):
- if IDsOfElements == []:
- IDsOfElements = self.mesh
- unRegister = genObjUnRegister()
- if IDsOfElements and \
- isinstance( IDsOfElements, list ) and \
- isinstance( IDsOfElements[0], int ):
- IDsOfElements = self.GetIDSource( IDsOfElements, SMESH.ALL )
- unRegister.set( IDsOfElements )
- if isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object):
- StepVector = self.smeshpyD.GetDirStruct(StepVector)
- if isinstance( StepVector, list ):
- StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
- NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
- Parameters = StepVector.PS.parameters + var_separator + Parameters
- self.mesh.SetParameters(Parameters)
n,e,f = [],[],[]
- if IsNodes: n = [IDsOfElements]
- else : e,f, = [IDsOfElements],[IDsOfElements]
- return self.editor.ExtrusionSweepObjects(n,e,f, StepVector, NbOfSteps, MakeGroups)
+ if IsNodes: n = IDsOfElements
+ else : e,f, = IDsOfElements,IDsOfElements
+ return self.ExtrusionSweepObjects(n,e,f, StepVector, NbOfSteps, MakeGroups)
## Generates new elements by extrusion along the normal to a discretized surface or wire
# @param Elements elements to extrude - a list including ids, groups, sub-meshes or a mesh
if isinstance( Elements[0], int ):
Elements = self.GetIDSource( Elements, SMESH.ALL )
unRegister.set( Elements )
- else:
+ if not isinstance( Elements, list ):
Elements = [ Elements ]
StepSize,NbOfSteps,Parameters,hasVars = ParseParameters(StepSize,NbOfSteps)
self.mesh.SetParameters(Parameters)
return self.editor.ExtrusionByNormal(Elements, StepSize, NbOfSteps,
- UseInputElemsOnly, ByAverageNormal, MakeGroups, Dim)
+ ByAverageNormal, UseInputElemsOnly, MakeGroups, Dim)
## Generates new elements by extrusion of the elements which belong to the object
# @param theObject the object which elements should be processed.
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
# @ingroup l2_modif_extrurev
def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False, IsNodes=False):
- if isinstance( theObject, Mesh ):
- theObject = theObject.GetMesh()
- if isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object):
- StepVector = self.smeshpyD.GetDirStruct(StepVector)
- if isinstance( StepVector, list ):
- StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
- NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
- Parameters = StepVector.PS.parameters + var_separator + Parameters
- self.mesh.SetParameters(Parameters)
n,e,f = [],[],[]
- if IsNodes: n = [theObject]
- else : e,f, = [theObject],[theObject]
- return self.editor.ExtrusionSweepObjects(n,e,f, StepVector, NbOfSteps, MakeGroups)
+ if IsNodes: n = theObject
+ else : e,f, = theObject,theObject
+ return self.ExtrusionSweepObjects(n,e,f, StepVector, NbOfSteps, MakeGroups)
## Generates new elements by extrusion of the elements which belong to the object
# @param theObject object which elements should be processed.
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
# @ingroup l2_modif_extrurev
def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
- if ( isinstance( theObject, Mesh )):
- theObject = theObject.GetMesh()
- if ( isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object)):
- StepVector = self.smeshpyD.GetDirStruct(StepVector)
- if isinstance( StepVector, list ):
- StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
- NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
- Parameters = StepVector.PS.parameters + var_separator + Parameters
- self.mesh.SetParameters(Parameters)
- return self.editor.ExtrusionSweepObjects([],[theObject],[],
- StepVector, NbOfSteps, MakeGroups)
+ return self.ExtrusionSweepObjects([],theObject,[], StepVector, NbOfSteps, MakeGroups)
## Generates new elements by extrusion of the elements which belong to the object
# @param theObject object which elements should be processed.
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
# @ingroup l2_modif_extrurev
def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
- if ( isinstance( theObject, Mesh )):
- theObject = theObject.GetMesh()
- if ( isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object)):
- StepVector = self.smeshpyD.GetDirStruct(StepVector)
- if isinstance( StepVector, list ):
- StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
- NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
- Parameters = StepVector.PS.parameters + var_separator + Parameters
- self.mesh.SetParameters(Parameters)
- return self.editor.ExtrusionSweepObjects([],[],[theObject],
- StepVector, NbOfSteps, MakeGroups)
+ return self.ExtrusionSweepObjects([],[],theObject, StepVector, NbOfSteps, MakeGroups)
## Generates new elements by extrusion of the elements with given ids
# @param IDsOfElements is ids of elements
# @param HasAngles allows the shape to be rotated around the path
# to get the resulting mesh in a helical fashion
# @param Angles list of angles
+ # @param LinearVariation forces the computation of rotation angles as linear
+ # variation of the given Angles along path steps
# @param HasRefPoint allows using the reference point
# @param RefPoint the point around which the shape is rotated (the mass center of the
# shape by default). The User can specify any point as the Reference Point.
# @param MakeGroups forces the generation of new groups from existing ones
- # @param LinearVariation forces the computation of rotation angles as linear
- # variation of the given Angles along path steps
# @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error
# @ingroup l2_modif_extrurev
def ExtrusionAlongPathObjects(self, Nodes, Edges, Faces, PathMesh, PathShape=None,
- NodeStart=1, HasAngles=False, Angles=[],
- HasRefPoint=False, RefPoint=[0,0,0],
- MakeGroups=False, LinearVariation=False):
+ NodeStart=1, HasAngles=False, Angles=[], LinearVariation=False,
+ HasRefPoint=False, RefPoint=[0,0,0], MakeGroups=False):
unRegister = genObjUnRegister()
Nodes = self._getIdSourceList( Nodes, SMESH.NODE, unRegister )
Edges = self._getIdSourceList( Edges, SMESH.EDGE, unRegister )
def ExtrusionAlongPathX(self, Base, Path, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups, ElemType):
- if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
- RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
- pass
- elif isinstance( RefPoint, list ):
- RefPoint = PointStruct(*RefPoint)
- pass
- Angles,AnglesParameters,hasVars = ParseAngles(Angles)
- Parameters = AnglesParameters + var_separator + RefPoint.parameters
- self.mesh.SetParameters(Parameters)
-
- if isinstance(Path, Mesh): Path = Path.GetMesh()
-
- unRegister = genObjUnRegister()
- if isinstance(Base, list):
- if Base:
- Base = self.GetIDSource( Base, ElemType )
- unRegister.set( Base )
- else:
- Base = self.mesh
- else:
- if isinstance(Base, Mesh):
- Base = Base.GetMesh()
- if isinstance(Base, SMESH._objref_SMESH_IDSource):
- n,e,f = [],[],[]
- if ElemType == SMESH.NODE: n = [Base]
- if ElemType == SMESH.EDGE: e = [Base]
- if ElemType == SMESH.FACE: f = [Base]
- gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, Path, None, NodeStart,
- HasAngles, Angles, LinearVariation,
- HasRefPoint, RefPoint, MakeGroups)
- if MakeGroups: return gr,er
- return er
- else:
- raise RuntimeError, "Invalid Base for ExtrusionAlongPathX"
-
+ n,e,f = [],[],[]
+ if ElemType == SMESH.NODE: n = Base
+ if ElemType == SMESH.EDGE: e = Base
+ if ElemType == SMESH.FACE: f = Base
+ gr,er = self.ExtrusionAlongPathObjects(n,e,f, Path, None, NodeStart,
+ HasAngles, Angles, LinearVariation,
+ HasRefPoint, RefPoint, MakeGroups)
+ if MakeGroups: return gr,er
+ return er
## Generates new elements by extrusion of the given elements
# The path of extrusion must be a meshed edge.
def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False):
- if IDsOfElements == []:
- IDsOfElements = self.GetElementsId()
- if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
- RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
- pass
- if isinstance( PathMesh, Mesh ):
- PathMesh = PathMesh.GetMesh()
- Angles,AnglesParameters,hasVars = ParseAngles(Angles)
- Parameters = AnglesParameters + var_separator + RefPoint.parameters
- self.mesh.SetParameters(Parameters)
- n,e,f = [],[IDsOfElements],[IDsOfElements]
- gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape,
- NodeStart, HasAngles, Angles,
- LinearVariation,
- HasRefPoint, RefPoint, MakeGroups)
+ n,e,f = [],IDsOfElements,IDsOfElements
+ gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape,
+ NodeStart, HasAngles, Angles,
+ LinearVariation,
+ HasRefPoint, RefPoint, MakeGroups)
if MakeGroups: return gr,er
return er
def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False):
- if isinstance( theObject, Mesh ):
- theObject = theObject.GetMesh()
- if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
- RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
- if isinstance( PathMesh, Mesh ):
- PathMesh = PathMesh.GetMesh()
- Angles,AnglesParameters,hasVars = ParseAngles(Angles)
- Parameters = AnglesParameters + var_separator + RefPoint.parameters
- self.mesh.SetParameters(Parameters)
- n,e,f = [],[theObject],[theObject]
- gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
- HasAngles, Angles, LinearVariation,
- HasRefPoint, RefPoint, MakeGroups)
+ n,e,f = [],theObject,theObject
+ gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
+ HasAngles, Angles, LinearVariation,
+ HasRefPoint, RefPoint, MakeGroups)
if MakeGroups: return gr,er
return er
def ExtrusionAlongPathObject1D(self, theObject, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False):
- if isinstance( theObject, Mesh ):
- theObject = theObject.GetMesh()
- if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
- RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
- if isinstance( PathMesh, Mesh ):
- PathMesh = PathMesh.GetMesh()
- Angles,AnglesParameters,hasVars = ParseAngles(Angles)
- Parameters = AnglesParameters + var_separator + RefPoint.parameters
- self.mesh.SetParameters(Parameters)
- n,e,f = [],[theObject],[]
- gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
- HasAngles, Angles, LinearVariation,
- HasRefPoint, RefPoint, MakeGroups)
+ n,e,f = [],theObject,[]
+ gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
+ HasAngles, Angles, LinearVariation,
+ HasRefPoint, RefPoint, MakeGroups)
if MakeGroups: return gr,er
return er
def ExtrusionAlongPathObject2D(self, theObject, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False):
- if ( isinstance( theObject, Mesh )):
- theObject = theObject.GetMesh()
- if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)):
- RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
- if ( isinstance( PathMesh, Mesh )):
- PathMesh = PathMesh.GetMesh()
- Angles,AnglesParameters,hasVars = ParseAngles(Angles)
- Parameters = AnglesParameters + var_separator + RefPoint.parameters
- self.mesh.SetParameters(Parameters)
- n,e,f = [],[],[theObject]
- gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
- HasAngles, Angles, LinearVariation,
- HasRefPoint, RefPoint, MakeGroups)
+ n,e,f = [],[],theObject
+ gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
+ HasAngles, Angles, LinearVariation,
+ HasRefPoint, RefPoint, MakeGroups)
if MakeGroups: return gr,er
return er
self.functors[ funcType._v ] = fn
return fn
- def _valueFromFunctor(self, funcType, elemId):
+ ## Returns value of a functor for a given element
+ # @param funcType an item of SMESH.FunctorType enum
+ # @param elemId element or node ID
+ # @param isElem @a elemId is ID of element or node
+ # @return the functor value or zero in case of invalid arguments
+ def FunctorValue(self, funcType, elemId, isElem=True):
fn = self._getFunctor( funcType )
- if fn.GetElementType() == self.GetElementType(elemId, True):
+ if fn.GetElementType() == self.GetElementType(elemId, isElem):
val = fn.GetValue(elemId)
else:
val = 0
if elemId == None:
length = self.smeshpyD.GetLength(self)
else:
- length = self._valueFromFunctor(SMESH.FT_Length, elemId)
+ length = self.FunctorValue(SMESH.FT_Length, elemId)
return length
## Get area of 2D element or sum of areas of all 2D mesh elements
if elemId == None:
area = self.smeshpyD.GetArea(self)
else:
- area = self._valueFromFunctor(SMESH.FT_Area, elemId)
+ area = self.FunctorValue(SMESH.FT_Area, elemId)
return area
## Get volume of 3D element or sum of volumes of all 3D mesh elements
if elemId == None:
volume = self.smeshpyD.GetVolume(self)
else:
- volume = self._valueFromFunctor(SMESH.FT_Volume3D, elemId)
+ volume = self.FunctorValue(SMESH.FT_Volume3D, elemId)
return volume
## Get maximum element length.
ftype = SMESH.FT_MaxElementLength3D
else:
ftype = SMESH.FT_MaxElementLength2D
- return self._valueFromFunctor(ftype, elemId)
+ return self.FunctorValue(ftype, elemId)
## Get aspect ratio of 2D or 3D element.
# @param elemId mesh element ID
ftype = SMESH.FT_AspectRatio3D
else:
ftype = SMESH.FT_AspectRatio
- return self._valueFromFunctor(ftype, elemId)
+ return self.FunctorValue(ftype, elemId)
## Get warping angle of 2D element.
# @param elemId mesh element ID
# @return element's warping angle value
# @ingroup l1_measurements
def GetWarping(self, elemId):
- return self._valueFromFunctor(SMESH.FT_Warping, elemId)
+ return self.FunctorValue(SMESH.FT_Warping, elemId)
## Get minimum angle of 2D element.
# @param elemId mesh element ID
# @return element's minimum angle value
# @ingroup l1_measurements
def GetMinimumAngle(self, elemId):
- return self._valueFromFunctor(SMESH.FT_MinimumAngle, elemId)
+ return self.FunctorValue(SMESH.FT_MinimumAngle, elemId)
## Get taper of 2D element.
# @param elemId mesh element ID
# @return element's taper value
# @ingroup l1_measurements
def GetTaper(self, elemId):
- return self._valueFromFunctor(SMESH.FT_Taper, elemId)
+ return self.FunctorValue(SMESH.FT_Taper, elemId)
## Get skew of 2D element.
# @param elemId mesh element ID
# @return element's skew value
# @ingroup l1_measurements
def GetSkew(self, elemId):
- return self._valueFromFunctor(SMESH.FT_Skew, elemId)
+ return self.FunctorValue(SMESH.FT_Skew, elemId)
## Return minimal and maximal value of a given functor.
# @param funType a functor type, an item of SMESH.FunctorType enum
pass # end of Mesh class
+## class used to add to SMESH_MeshEditor methods removed from its CORBA API
+#
+class meshEditor(SMESH._objref_SMESH_MeshEditor):
+ def __init__(self):
+ SMESH._objref_SMESH_MeshEditor.__init__(self)
+ self.mesh = None
+ def __getattr__(self, name ): # method called if an attribute not found
+ if not self.mesh: # look for name() method in Mesh class
+ self.mesh = Mesh( None, None, SMESH._objref_SMESH_MeshEditor.GetMesh(self))
+ if hasattr( self.mesh, name ):
+ return getattr( self.mesh, name )
+ if name == "ExtrusionAlongPathObjX":
+ return getattr( self.mesh, "ExtrusionAlongPathX" )
+ print name, "NOT FOUND"
+ return None
+ pass
+omniORB.registerObjref(SMESH._objref_SMESH_MeshEditor._NP_RepositoryId, meshEditor)
+
## Helper class for wrapping of SMESH.SMESH_Pattern CORBA class
#
class Pattern(SMESH._objref_SMESH_Pattern):