# Build a cylinder
# ----------------
-base = geompy.MakeVertex(0, 0, 0)
+base = geompy.MakeVertex(0, 0, 0)
direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
cylinder = geompy.MakeCylinder(base, direction, radius, height)
size = radius/2.0
-box_rot = geompy.MakeBox(-size, -size, 0, +size, +size, height)
+box_rot = geompy.MakeBox(-size, -size, 0, +size, +size, height)
box_axis = geompy.MakeLine(base, direction)
-box = geompy.MakeRotation(box_rot, box_axis, math.pi/4)
+box = geompy.MakeRotation(box_rot, box_axis, math.pi/4)
hole = geompy.MakeCut(cylinder, box)
blocks_part = geompy.MakePartition([hole], [plane_a, plane_b], [], [], geompy.ShapeType["SOLID"])
blocks_list = [box] + geompy.SubShapeAll(blocks_part, geompy.ShapeType["SOLID"])
-blocks_all = geompy.MakeCompound(blocks_list)
-blocks = geompy.MakeGlueFaces(blocks_all, 0.0001)
+blocks_all = geompy.MakeCompound(blocks_list)
+blocks = geompy.MakeGlueFaces(blocks_all, 0.0001)
geompy.addToStudy(blocks, "cylinder:blocks")
t = geompy.ShapeType[type]
g = geompy.CreateGroup(shape, t)
- geompy.addToStudy(g, name)
- g.SetName(name)
+ geompy.addToStudyInFather(shape, g, name)
if base!=None:
l = geompy.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, GEOM.ST_ON)
base_b = geompy.MakeVertex(0, 0, height)
group_b = group("baseB", blocks, "FACE", base_b, direction)
-group_1 = group("limit", blocks, "SOLID")
+group_1 = group("limit", blocks, "SOLID")
group_1_all = geompy.SubShapeAllIDs(blocks, geompy.ShapeType["SOLID"])
geompy.UnionIDs(group_1, group_1_all)
group_1_box = geompy.GetBlockNearPoint(blocks, base)
smesh.SetCurrentStudy(salome.myStudy)
-def discretize(x, y, z, n, s=blocks):
- p = geompy.MakeVertex(x, y, z)
- e = geompy.GetEdgeNearPoint(s, p)
- a = hexa.Segment(e)
- a.NumberOfSegments(n)
- a.Propagation()
+def discretize(x, y, z, nbSeg, shape=blocks):
+ vert = geompy.MakeVertex( x, y, z )
+ edge = geompy.GetEdgeNearPoint( shape, vert )
+ algo = hexa.Segment( edge )
+ algo.NumberOfSegments( nbSeg )
+ algo.Propagation()
hexa = smesh.Mesh(blocks)
{
SMESH_TRY;
SMESH::long_array_var res = new SMESH::long_array;
-
- SMESH::array_of_ElementType_var types = elementIDs->GetTypes();
- if ( types->length() == 1 && // a part contains only nodes or 0D elements
- ( types[0] == SMESH::NODE || types[0] == SMESH::ELEM0D || types[0] == SMESH::BALL) &&
- type != types[0] ) // but search of elements of dim > 0
- return res._retn();
+ if ( type != SMESH::NODE )
+ {
+ SMESH::array_of_ElementType_var types = elementIDs->GetTypes();
+ if ( types->length() == 1 && // a part contains only nodes or 0D elements
+ ( types[0] == SMESH::NODE || types[0] == SMESH::ELEM0D || types[0] == SMESH::BALL) &&
+ type != types[0] ) // but search of elements of dim > 0
+ return res._retn();
+ }
if ( SMESH::DownCast<SMESH_Mesh_i*>( elementIDs )) // elementIDs is the whole mesh
return FindElementsByPoint( x,y,z, type );
SMESHDS_Mesh* meshDS = SMESH::DownCast<SMESH_Mesh_i*>( mesh )->GetImpl().GetMeshDS();
if ( !idSourceToSet( elementIDs, meshDS, elements,
- SMDSAbs_ElementType(type), /*emptyIfIsMesh=*/true))
+ ( type == SMESH::NODE ? SMDSAbs_All : (SMDSAbs_ElementType) type ),
+ /*emptyIfIsMesh=*/true))
return res._retn();
typedef SMDS_SetIterator<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator > TIter;