From: jfa Date: Mon, 20 Dec 2010 14:41:10 +0000 (+0000) Subject: 0021108: EDF 1668 SMESH: ExtrusionAlongPathX on a Mesh group. X-Git-Tag: V6_2_0~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a541693f0605b66c714c56b4090b3637368e8620;p=modules%2Fsmesh.git 0021108: EDF 1668 SMESH: ExtrusionAlongPathX on a Mesh group. --- diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index c6bc91e8d..26a480a4e 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -1129,7 +1129,8 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) "ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements", "RotationSweep","RotationSweepObject","RotationSweepObject1D","RotationSweepObject2D", "ExtrusionSweep","AdvancedExtrusion","ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D", - "ExtrusionAlongPath","ExtrusionAlongPathObject","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D", + "ExtrusionAlongPath","ExtrusionAlongPathObject","ExtrusionAlongPathX", + "ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D", "Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject", "FindCoincidentNodes",/*"FindCoincidentNodesOnPart",*/"MergeNodes","FindEqualElements", "MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders", @@ -1177,6 +1178,13 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) } } + // set "ExtrusionAlongPathX()" instead of "ExtrusionAlongPathObjX()" + if ( !isPyMeshMethod && method == "ExtrusionAlongPathObjX") + { + isPyMeshMethod=true; + theCommand->SetMethod("ExtrusionAlongPathX"); + } + // set "FindCoincidentNodesOnPart()" instead of "FindCoincidentNodesOnPartBut()" if ( !isPyMeshMethod && method == "FindCoincidentNodesOnPartBut") { diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 13e8d0a39..5144d33a9 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -2685,6 +2685,8 @@ ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object, SMESH::ElementType ElemType, SMESH::SMESH_MeshEditor::Extrusion_Error& Error) { + TPythonDump aPythonDump; // it is here to prevent dump of GetGroups() + SMESH::long_array_var anElementsId = Object->GetIDs(); SMESH::ListOfGroups * aGroups = extrusionAlongPathX(anElementsId, Path, @@ -2698,16 +2700,12 @@ ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object, (SMDSAbs_ElementType)ElemType, Error); - if ( !myPreviewMode ) { + if (!myPreviewMode) { bool isDumpGroups = aGroups && aGroups->length() > 0; - TPythonDump aPythonDump; - if(isDumpGroups) { - aPythonDump << "("<length() > 0; - TPythonDump aPythonDump; - if(isDumpGroups) { - aPythonDump << "("< 0: if err.code < len(stdErrors): errText = stdErrors[err.code] @@ -1881,15 +1880,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. @@ -1897,9 +1896,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 @@ -1913,17 +1912,17 @@ 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 + # 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 @@ -2379,7 +2378,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) @@ -2400,12 +2399,12 @@ class Mesh: pass else: id2 = None - + aMeasurements = self.smeshpyD.CreateMeasurements() aMeasure = aMeasurements.MinDistance(id1, id2) aMeasurements.Destroy() 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, @@ -2454,7 +2453,7 @@ class Mesh: aMeasure = aMeasurements.BoundingBox(srclist) aMeasurements.Destroy() return aMeasure - + # Mesh edition (SMESH_MeshEditor functionality): # --------------------------------------------- @@ -2684,10 +2683,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) @@ -2755,7 +2754,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) @@ -3077,7 +3076,7 @@ class Mesh: # @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 + # @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 @@ -3380,7 +3379,10 @@ 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 @@ -3388,7 +3390,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) @@ -3984,14 +3987,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 @@ -4000,7 +4003,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 @@ -4022,18 +4025,18 @@ class Mesh: # @ingroup l2_modif_edit def DoubleNodeGroups(self, 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 @@ -4045,7 +4048,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 @@ -4069,7 +4072,7 @@ 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 @@ -4092,7 +4095,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. @@ -4112,27 +4115,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 @@ -4143,7 +4146,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 @@ -4154,7 +4157,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 @@ -4460,7 +4463,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) @@ -5068,14 +5071,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 @@ -5954,7 +5957,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(); @@ -5965,9 +5968,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) @@ -5979,7 +5982,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 @@ -5990,15 +5993,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) @@ -6009,7 +6012,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 @@ -6020,54 +6023,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): @@ -6075,14 +6078,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) @@ -6153,7 +6156,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) @@ -6174,7 +6177,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)