- def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps,
- ExtrFlags, SewTolerance, MakeGroups=False):
- if ( isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object)):
- StepVector = self.smeshpyD.GetDirStruct(StepVector)
- if isinstance( StepVector, list ):
- StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
- if MakeGroups:
- return self.editor.AdvancedExtrusionMakeGroups(IDsOfElements, StepVector, NbOfSteps,
- ExtrFlags, SewTolerance)
- self.editor.AdvancedExtrusion(IDsOfElements, StepVector, NbOfSteps,
- ExtrFlags, SewTolerance)
- return []
+ def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False, IsNodes = False):
+ n,e,f = [],[],[]
+ 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.
+ # Only faces can be extruded so far. A sub-mesh should be a sub-mesh on geom faces.
+ # @param StepSize length of one extrusion step (the total extrusion
+ # length will be \a NbOfSteps * \a StepSize ).
+ # @param NbOfSteps number of extrusion steps.
+ # @param ByAverageNormal if True each node is translated by \a StepSize
+ # along the average of the normal vectors to the faces sharing the node;
+ # else each node is translated along the same average normal till
+ # intersection with the plane got by translation of the face sharing
+ # the node along its own normal by \a StepSize.
+ # @param UseInputElemsOnly to use only \a Elements when computing extrusion direction
+ # for every node of \a Elements.
+ # @param MakeGroups forces generation of new groups from existing ones.
+ # @param Dim dimension of elements to extrude: 2 - faces or 1 - edges. Extrusion of edges
+ # is not yet implemented. This parameter is used if \a Elements contains
+ # both faces and edges, i.e. \a Elements is a Mesh.
+ # @return the list of created groups (SMESH_GroupBase) if \a MakeGroups=True,
+ # empty list otherwise.
+ # @ingroup l2_modif_extrurev
+ def ExtrusionByNormal(self, Elements, StepSize, NbOfSteps,
+ ByAverageNormal=False, UseInputElemsOnly=True, MakeGroups=False, Dim = 2):
+ unRegister = genObjUnRegister()
+ if isinstance( Elements, Mesh ):
+ Elements = [ Elements.GetMesh() ]
+ if isinstance( Elements, list ):
+ if not Elements:
+ raise RuntimeError, "Elements empty!"
+ if isinstance( Elements[0], int ):
+ Elements = self.GetIDSource( Elements, SMESH.ALL )
+ unRegister.set( Elements )
+ 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,
+ ByAverageNormal, UseInputElemsOnly, MakeGroups, Dim)