-# -*- 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
if studyID != geompyD.myStudyId:
geompyD.init_geom( smeshpyD.GetCurrentStudy())
pass
- name = "%s_%s"%(self.geom.GetShapeType(), id(self.geom)%100)
- geompyD.addToStudy( self.geom, name )
+ 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):
## 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
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):
## Generates new elements by extrusion of the elements with given ids
# @param IDsOfElements the list of elements ids for extrusion
- # @param StepVector vector or DirStruct, 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
## Generates new elements by extrusion of the elements which belong to the object
# @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
+ # @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
## Generates new elements by extrusion of the elements which belong to the object
# @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
+ # @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
## Generates new elements by extrusion of the elements which belong to the object
# @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
+ # @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
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)