From: dish Date: Fri, 25 Oct 2024 10:56:30 +0000 (+0000) Subject: [bos #29603][EDF](2024-T1) Create group: don't find all subshapes. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d42545a1e46d6a33f47da74f0d823dc6abc11855;p=modules%2Fgeom.git [bos #29603][EDF](2024-T1) Create group: don't find all subshapes. Add new GetInPlaceCombined method, which combines results of GetInPlace(_) (the "new" one) and GetInPlaceByHistory(_). --- diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index d1428637a..d41bc1574 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -37,25 +37,25 @@ module GEOM /*! * \brief Topological types of shapes (like Open Cascade types) */ - enum shape_type - { + enum shape_type + { /*! A collection of arbitrary shapes */ COMPOUND, - /*! A collection of solids */ - COMPSOLID, + /*! A collection of solids */ + COMPSOLID, /*! A part of 3D space bound by a shell */ - SOLID, + SOLID, /*! A collection of faces connected by some edges of their wire boundaries */ SHELL, /*! Part of a plane (in 2D geometry) or a surface (in 3D geometry) bounded by a closed wire */ - FACE, + FACE, /*! A sequence of edges connected by their vertices */ - WIRE, + WIRE, /*! Edge, a shape corresponding to a curve, and bound by a vertex at each extremity */ - EDGE, + EDGE, /*! A zero-dimensional shape corresponding to a point in geometry */ VERTEX, - /*! Arbitrary shape in a Compound (used for processing of Compounds in some operations) */ + /*! Arbitrary shape in a Compound (used for processing of Compounds in some operations) */ SHAPE, /*! Flat (top-level) contents of a Compound (used for processing of Compounds in some operations) */ FLAT @@ -89,7 +89,7 @@ module GEOM * For sphere and cylinder it means outside of volume, bounded by the surface. */ ST_OUT, - + /*! * Shape is in the direction defined by the normal and on surface. * ONOUT = ON || OUT @@ -156,13 +156,13 @@ module GEOM /*! Default (standard behaviour) */ FOM_Default, - /*! Use edges orientation - orientation of edges is used: if the edge is - * reversed, the curve from this edge is reversed before using it in + /*! Use edges orientation - orientation of edges is used: if the edge is + * reversed, the curve from this edge is reversed before using it in * the filling algorithm. */ FOM_UseOri, - /*! Auto-correct edges orientation - changes the orientation of the curves + /*! Auto-correct edges orientation - changes the orientation of the curves * using minimization of sum of distances between the end points of the edges. */ FOM_AutoCorrect @@ -177,7 +177,7 @@ module GEOM enum curve_type { /*! Polyline curve */ Polyline, - + /*! Bezier curve */ Bezier, @@ -312,8 +312,8 @@ module GEOM /*! * \brief Get internal (unique) entry of the object in the GEOM component's data tree. - * \note This is not an entry of the data object in SALOME study. - * This is internal function of GEOM component, though it can be used outside it for + * \note This is not an entry of the data object in SALOME study. + * This is internal function of GEOM component, though it can be used outside it for appropriate reason (e.g. for unique identification of geometry object). */ string GetEntry(); @@ -476,7 +476,7 @@ module GEOM void SetMarkerStd(in marker_type theType, in marker_size theSize ); /*! - * \brief Set custom point marker for the object. + * \brief Set custom point marker for the object. * * The texture can be added by LoadTexture() or AddTexture() functions. * \param theTextureId texture ID @@ -1500,7 +1500,7 @@ module GEOM in double theAngleLength, in double theAngleRotation); }; - + /*! * \brief Interface for 3D primitives creation * @@ -1631,7 +1631,7 @@ module GEOM /*! * \brief Create a cone with given height and radiuses at - * the origin of coordinate system. + * the origin of coordinate system. * * Axis of the cone will be collinear to the OZ axis of the coordinate system. * \param theR1 Radius of the first cone base. @@ -1759,18 +1759,18 @@ module GEOM /*! * \brief Add / Remove material to / from a solid by extrusion of the base shape on the given distance. - * \param theInitShape Initial shape on which to perform the feature.It has to be a solid or + * \param theInitShape Initial shape on which to perform the feature.It has to be a solid or * a compound made of a single solid - * \param theBase Edge or wire defining the base shape to be extruded. + * \param theBase Edge or wire defining the base shape to be extruded. * \param theHeight Prism dimension along the normal of the face. * \param theAngle Draft angel in degrees * \param theFuse If true material is added else material is removed - * \param theInvert If true material changes the direction + * \param theInvert If true material changes the direction * \return New GEOM_Object, containing the modified shape */ GEOM_Object MakeDraftPrism (in GEOM_Object theInitShape, in GEOM_Object theBase, - in double theHeight, + in double theHeight, in double theAngle, in boolean theFuse, in boolean theInvert); @@ -1793,7 +1793,7 @@ module GEOM /*! * \brief Create a shape by revolution of the base shape around the axis - * on the given angle. + * on the given angle. * * All the space, transfixed by the base * shape during its rotation around the axis on the given angle. @@ -1844,7 +1844,7 @@ module GEOM /*! * \brief Create a shape by extrusion of the profile shape along - * the path shape. + * the path shape. * * The path shape can be a wire or an edge. * the several profiles can be specified in the several locations of path. @@ -1878,7 +1878,7 @@ module GEOM /*! * \brief Create a shape by extrusion of the profile shape along - * the path shape. + * the path shape. * * The path shape can be a shell or a face. * the several profiles can be specified in the several locations of path. @@ -1967,7 +1967,7 @@ module GEOM in boolean isCopy, in boolean isInside); - + /*! * \brief Build a middle path of a pipe-like shape. * @@ -2148,7 +2148,7 @@ module GEOM * \return New GEOM_Object, containing the created solid (or compound of solids). */ GEOM_Object MakeSolidFromConnectedFaces (in ListOfGO theFacesOrShells, in boolean isIntersect); - + /*! * \brief Replace coincident faces in \a theShapes by one face. * \param theShapes Initial shapes. @@ -2222,7 +2222,7 @@ module GEOM in boolean theGroupsOnly); /*! - * \brief Deprecated method. + * \brief Deprecated method. * * Use MakeAllSubShapes() instead. */ @@ -2231,7 +2231,7 @@ module GEOM in boolean isSorted); /*! - * \brief Explode a shape on sub-shapes of a given type. + * \brief Explode a shape on sub-shapes of a given type. * * If the shape itself has the given type, it is also returned. * \param theShape Shape to be exploded. @@ -2413,10 +2413,10 @@ module GEOM * \param theMultiShare Specifies what type of shares should be checked: * - \c TRUE: search sub-shapes from 1st input shape shared with all other input shapes; * - \c FALSE: causes to search sub-shapes shared between couples of input shapes. - * \note If \a theShapes contains single compound, the shares between all possible couples of + * \note If \a theShapes contains single compound, the shares between all possible couples of * its top-level shapes are returned; otherwise, only shares between 1st input shape * and all rest input shapes are returned. - * + * * \return List of all found sub-shapes. */ ListOfGO GetSharedShapesMulti (in ListOfGO theShapes, @@ -2697,12 +2697,23 @@ module GEOM in short theShapeType, in shape_state theState); + /*! + * \brief Get sub-shape(s) of \a theShapeWhere, which are coincident with \a theShapeWhat or could be a part of it. + * Combines results of new GetInPlace(_) and GetInPlaceByHistory(_). + * \param theShapeWhere Shape to find sub-shapes of. + * \param theShapeWhat Shape, specifying what to find. + * \return Compound which includes all found sub-shapes if they have different types; + * or group of all found shapes of the equal type; or a single found sub-shape. + */ + GEOM_Object GetInPlaceCombined (in GEOM_Object theShapeWhere, + in GEOM_Object theShapeWhat); + /*! * \brief Get sub-shape(s) of \a theShapeWhere, which are * coincident with \a theShapeWhat or could be a part of it. * \param theShapeWhere Shape to find sub-shapes of. * \param theShapeWhat Shape, specifying what to find. - * \return Compound which includes all found sub-shapes if they have different types; + * \return Compound which includes all found sub-shapes if they have different types; * or group of all found shapes of the equal type; or a single found sub-shape. */ GEOM_Object GetInPlace (in GEOM_Object theShapeWhere, @@ -2726,17 +2737,17 @@ module GEOM * * \param theShapeWhere Shape to find sub-shapes of. * \param theShapeWhat Shape, specifying what to find. - * \return Compound which includes all found sub-shapes if they have different types; + * \return Compound which includes all found sub-shapes if they have different types; * or group of all found shapes of the equal type; or a single found sub-shape. */ GEOM_Object GetInPlaceByHistory (in GEOM_Object theShapeWhere, in GEOM_Object theShapeWhat); /*! - * \brief A sort of GetInPlace functionality, returning for each sub-shape ID of + * \brief A sort of GetInPlace functionality, returning for each sub-shape ID of * \a theShapeWhat a list of corresponding sub-shape IDs of \a theShapeWhere. - * For example, if theShapeWhat is a box and theShapeWhere is this box cut into - * two parts by a plane, then the result can be as this: + * For example, if theShapeWhat is a box and theShapeWhere is this box cut into + * two parts by a plane, then the result can be as this: * len( result_list ) = 35, * result_list[ 1 ] = [ 2, 36 ], which means that the box turned into two solids * with IDs 2 and 36 within theShapeWhere @@ -2879,7 +2890,7 @@ module GEOM }; - // # GEOM_IBlocksOperations: + // # GEOM_IBlocksOperations: /*! * \brief Interface for Blocks construction * Face from points or edges, Block from faces, @@ -2887,7 +2898,7 @@ module GEOM */ interface GEOM_IBlocksOperations : GEOM_IOperations { - + // # Creation of blocks /*! @@ -2925,7 +2936,7 @@ module GEOM /*! * \brief Create a hexahedral solid, bounded by the six given faces. Order of - * faces is not important. + * faces is not important. * * It is not necessary that Faces share the same edge. * \param theFace1,theFace2,theFace3,theFace4,theFace5,theFace6 Faces for the hexahedral solid. @@ -2948,9 +2959,9 @@ module GEOM GEOM_Object MakeHexa2Faces (in GEOM_Object theFace1, in GEOM_Object theFace2); - + // # Extract elements of blocks and blocks compounds - + /*! * \brief Get a vertex, found in the given shape by its coordinates. @@ -3060,7 +3071,7 @@ module GEOM in double theTolerance); // # Extract blocks from blocks compounds - + /*! * \brief Check, if the compound contains only specified blocks. @@ -3268,7 +3279,7 @@ module GEOM in long theNbTimesV); // # Special operation - propagation - + /*! * \brief Build all possible propagation groups. @@ -3419,7 +3430,7 @@ module GEOM * \param theShape Shape to be intersected. * \param thePlane Tool shape, to intersect theShape. * \return New GEOM_Object, containing the result shape. - * + * * \note This operation is a shortcut to the more general \ref MakePartition * operation, where \a theShape specifies single "object" (shape being partitioned) * and \a thePlane specifies single "tool" (intersector shape). Other parameters of @@ -3602,7 +3613,7 @@ module GEOM * \param theFuzzyParam The fuzzy tolerance to be used in the partition * algorithm, if the value is positive. * \return New GEOM_Object, containing the result shape. - * + * * \note This operation is a shortcut to the more general \ref MakePartition * operation, where \a theShape specifies single "object" (shape being partitioned) * and \a thePlane specifies single "tool" (intersector shape). Other parameters of @@ -3770,7 +3781,7 @@ module GEOM * \param theParamStep the step of the parameter. * \param theCurveType the type of the curve. * \return New GEOM_Object, containing the created curve. - */ + */ GEOM_Object MakeCurveParametric(in string thexExpr, in string theyExpr, in string thezExpr, @@ -3789,7 +3800,7 @@ module GEOM * \param theParamNbStep the number of steps of the parameter discretization. * \param theCurveType the type of the curve. * \return New GEOM_Object, containing the created curve. - */ + */ GEOM_Object MakeCurveParametricNew(in string thexExpr, in string theyExpr, in string thezExpr, @@ -3851,7 +3862,7 @@ module GEOM /*! * \brief Create a sketcher (wire or face), following the textual description, - * passed through \a theCommand argument. + * passed through \a theCommand argument. * * For format of the description string see the previous method.\n * @@ -3864,7 +3875,7 @@ module GEOM /*! * \brief Create a 3D sketcher, following the textual description, - * passed through \a theCommand argument. + * passed through \a theCommand argument. * * Format of the description string has to be the following: * @@ -3890,7 +3901,7 @@ module GEOM /*! * \brief Create a 3D sketcher, made of a straight segments, joining points - * with coordinates passed through \a theCoordinates argument. + * with coordinates passed through \a theCoordinates argument. * * Order of coordinates has to be the following: * x1, y1, z1, x2, y2, z2, ..., xN, yN, zN @@ -4149,7 +4160,7 @@ module GEOM long GetSubShapeIndex (in GEOM_Object theShape, in GEOM_Object theSubShape); }; - // # GEOM_IHealingOperations: + // # GEOM_IHealingOperations: /*! * \brief Interface for shape healing operations * @@ -4174,7 +4185,7 @@ module GEOM /*! * \brief Get default sequence of operators, their parameters and parameters' values - * of Shape Process operation. + * of Shape Process operation. * * In the current implementation the defaults are * read from the file pointed by CSF_ShHealingDefaults environmental variable. @@ -4492,22 +4503,22 @@ module GEOM /*! box with faces, parallel to global coordinate planes */ BOX, /*! other box */ - ROTATED_BOX, + ROTATED_BOX, /*! full torus */ - TORUS, - /*! cone */ - CONE, + TORUS, + /*! cone */ + CONE, /*! solid, bounded by polygons */ - POLYHEDRON, + POLYHEDRON, /*! other solid */ - SOLID, + SOLID, // FACEs /*! spherical face (closed) */ - SPHERE2D, + SPHERE2D, /*! cylindrical face with defined height */ CYLINDER2D, /*! toroidal face (closed) */ - TORUS2D, + TORUS2D, /*! conical face with defined height */ CONE2D, /*! planar, bounded by circle */ @@ -4515,42 +4526,42 @@ module GEOM /*! planar, bounded by ellipse */ DISK_ELLIPSE, /*! planar, bounded by segments */ - POLYGON, + POLYGON, /*! infinite planar */ - PLANE, + PLANE, /*! other planar */ - PLANAR, + PLANAR, /*! other face */ - FACE, + FACE, // EDGEs /*! full circle */ - CIRCLE, + CIRCLE, /*! arc of circle */ - ARC_CIRCLE, + ARC_CIRCLE, /*! full ellipse */ - ELLIPSE, + ELLIPSE, /*! arc of ellipse */ - ARC_ELLIPSE, + ARC_ELLIPSE, /*! infinite segment */ - LINE, + LINE, /*! segment */ - SEGMENT, + SEGMENT, /*! B-Spline curve */ - CRV_BSPLINE, + CRV_BSPLINE, /*! Bezier curve */ - CRV_BEZIER, + CRV_BEZIER, /*! hyperbola */ - HYPERBOLA, + HYPERBOLA, /*! parabola */ - PARABOLA, + PARABOLA, /*! other edge */ - EDGE, + EDGE, // VERTEX VERTEX, // ADVANCED shapes LCS, /*! all advanced shapes (temporary implementation) */ - ADVANCED + ADVANCED }; }; @@ -5059,7 +5070,7 @@ module GEOM * - edges intersecting by inner points; * - edge touching/intersecting face in the inner point; * - faces intersection by inner point - * + * * \param theResults result of check - list of failed checks and sub-shapes. * \param theShapeType1 Type of shape. * \param theShapeType2 Type of shape. @@ -5241,7 +5252,7 @@ module GEOM /*! * \brief Cut of lists of groups. * New group is created. It will contain only entities - * which are present in groups listed in theGList1 but + * which are present in groups listed in theGList1 but * are not present in groups from theGList2. * \param theGList1 is a list of GEOM groups to include elements of. * \param theGList2 is a list of GEOM groups to exclude elements of. @@ -5279,7 +5290,7 @@ module GEOM /*! * \brief Creates a field */ - GEOM_Field CreateField(in GEOM_Object shape, + GEOM_Field CreateField(in GEOM_Object shape, in string name, in field_data_type type, in short dimension, @@ -5522,7 +5533,7 @@ module GEOM GEOM_Object AddSubShape (in GEOM_Object theMainShape, in ListOfLong theIndices); // # GEOM_Objects IOR Management - + /*! * \brief Returns a GEOM_Object defined by its IOR * \param theIOR a string containing an IOR of the requested GEOM_Object @@ -5561,7 +5572,7 @@ module GEOM * Folder will have name theName. * If theFather is not NULL, the folder is placed under theFather object. * Otherwise, the folder takes place under root 'Geometry' object. - * + * * \param theName name of the folder * \param theFather parent object * \return SObject represented the created folder. @@ -5598,8 +5609,8 @@ module GEOM * \param where parent object where objects are moved to * \param row position in the parent object's children list at which objects are moved */ - void Move( in object_list what, - in SALOMEDS::SObject where, + void Move( in object_list what, + in SALOMEDS::SObject where, in long row ); /*! diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index edc8d56fd..c3a90aff8 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -152,7 +152,7 @@ namespace gp_Pnt aPoint = BRep_Tool::Pnt(theVertex); TopExp_Explorer anExp(theWhere, TopAbs_VERTEX); TopTools_MapOfShape aMap; - + for(; anExp.More(); anExp.Next()) { const TopoDS_Shape &aLocalShape = anExp.Current(); @@ -1529,7 +1529,7 @@ GEOMImpl_IShapesOperations::GetExistingSubObjects(Handle(GEOM_Object) theShap pd << "] = geompy.GetExistingSubObjects("; pd << theShape << ", " << (bool)theGroupsOnly << ")"; } - + return results; } @@ -1961,23 +1961,23 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetSubShapesIndic { MESSAGE("GEOMImpl_IShapesOperations::GetSubShapesIndices"); SetErrorCode(KO); - + Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; - + TopoDS_Shape aMainShape = theMainShape->GetValue(); if (aMainShape.IsNull()) { MESSAGE("NULL main shape"); return NULL; } - + TopTools_IndexedMapOfShape anIndices; TopExp::MapShapes(aMainShape, anIndices); - + std::list::iterator it; for (it=theSubShapes.begin(); it != theSubShapes.end(); ++it) { - TopoDS_Shape aSubShape = (*it)->GetValue(); + TopoDS_Shape aSubShape = (*it)->GetValue(); if (aSubShape.IsNull()) { MESSAGE("NULL subshape"); @@ -1985,8 +1985,8 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetSubShapesIndic } int id = anIndices.FindIndex(aSubShape); aSeq->Append(id); - } - + } + SetErrorCode(OK); return aSeq; } @@ -2219,12 +2219,12 @@ Standard_Integer GEOMImpl_IShapesOperations::NumberOfSubShapes for (iType = 0; iType < TopAbs_SHAPE; ++iType) nbTypes[iType] = 0; nbTypes[aShape.ShapeType()]++; - + TopTools_MapOfShape aMapOfShape; aMapOfShape.Add(aShape); TopTools_ListOfShape aListOfShape; aListOfShape.Append(aShape); - + TopTools_ListIteratorOfListOfShape itL (aListOfShape); for (; itL.More(); itL.Next()) { TopoDS_Iterator it (itL.Value()); @@ -2236,7 +2236,7 @@ Standard_Integer GEOMImpl_IShapesOperations::NumberOfSubShapes } } } - + if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE) nbShapes = aMapOfShape.Extent(); else @@ -2439,7 +2439,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes //purpose : // // NOTE on the implementation -// +// // 1) Resulting sub-shapes are published as a children of the 1st input shape // from theShapes list. Due to this reason only direct sub-shapes of the 1st // shape can be contained in the result of the operation (i.e. shares between @@ -2521,7 +2521,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes int nbIters = theMultiShare || theShapes.size() > 1 ? 1 : shapeSeq.Length()-1; // numShares factor to search (i.e. by what nb of shapes each found sub-shape should be shared) int nbShares = theMultiShare ? shapeSeq.Length()-1 : 1; - + for ( int iter = 1; iter <= nbIters; iter++) { for ( int ind = iter+1; ind <= shapeSeq.Length(); ind++) { if ( ind-1+nbShares > shapeSeq.Length() ) break; @@ -3340,7 +3340,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeExtraction // Fill in statistics. theStats.clear(); - Handle(TColStd_HArray1OfInteger) aStatIDsArray[3] = + Handle(TColStd_HArray1OfInteger) aStatIDsArray[3] = { aCI.GetRemovedIDs(), aCI.GetModifiedIDs(), aCI.GetAddedIDs() }; int i; int j; @@ -4538,6 +4538,137 @@ Handle(TColStd_HSequenceOfInteger) return aSeqOfIDs; } + +Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceCombined( + Handle(GEOM_Object) theShapeWhere, + Handle(GEOM_Object) theShapeWhat) +{ + SetErrorCode(KO); + + if (theShapeWhere.IsNull() || theShapeWhat.IsNull()) + return NULL; + + TopoDS_Shape aWhere = theShapeWhere->GetValue(); + TopoDS_Shape aWhat = theShapeWhat->GetValue(); + + if (aWhere.IsNull() || aWhat.IsNull()) { + SetErrorCode("Error: aWhere and aWhat TopoDS_Shape are Null."); + return NULL; + } + + /** Type of shape to be returned. */ + Standard_Integer aResultShapeType = -1; + /** Return value is a wrapped array of shapes. The map maintains uniqueness of the array content. */ + TopTools_MapOfShape aResultShapes; + + /** Return value is a wrapped array of shapes. The list maintains order of the array content as in return value of GEOMImpl_IShapesOperations::GetInPlace(_). */ + TopTools_ListOfShape aResultShapeList; + + + // Fill array of Where's indices. + TopTools_IndexedMapOfShape aWhereIndices; + TopExp::MapShapes(aWhere, aWhereIndices); + + + { // Search for the sub-shapes inside the aWhere shape using InPlace algorithm. + GEOMAlgo_GetInPlace aGIP; + if (!GEOMAlgo_GetInPlaceAPI::GetInPlace(aWhere, aWhat, aGIP)) { + SetErrorCode("Error in GEOMAlgo_GetInPlace"); + return NULL; + } + const TopoDS_Shape& aGIPResult = aGIP.Result(); + + + if (!aGIPResult.IsNull()) { + for (TopoDS_Iterator anIt(aGIPResult); anIt.More(); anIt.Next()) { + const TopoDS_Shape& aGIPResultSubShape = anIt.Value(); + + if (aWhereIndices.Contains(aGIPResultSubShape) && aResultShapes.Add(aGIPResultSubShape)) { + const TopAbs_ShapeEnum aType = aGIPResultSubShape.ShapeType(); + + if (aResultShapeType == -1) { + // Initialization. + aResultShapeType = aType; + } else if (aResultShapeType != TopAbs_SHAPE && aResultShapeType != aType) { + // Different types. + aResultShapeType = TopAbs_SHAPE; + } + + aResultShapeList.Append(aGIPResultSubShape); + } + } + } + } // Search for the sub-shapes inside the aWhere shape using InPlace algorithm. + + { // Search for the sub-shapes inside the aWhere shape using InPlaceByHistory algorithm. + Handle(GEOM_Function) aWhereFunction = theShapeWhere->GetLastFunction(); + if (aWhereFunction.IsNull() && aResultShapes.IsEmpty()) { + SetErrorCode("Error: Both GetInPlace and GetInPlaceByHistory algorithms found no shapes."); + return NULL; + } + + TopTools_ListOfShape aGIPBHShapeList; + const bool isFound = GEOMAlgo_GetInPlaceAPI::GetInPlaceByHistory(aWhereFunction, aWhereIndices, aWhat, aGIPBHShapeList); + if ( (!isFound || aGIPBHShapeList.Extent() < 1) && aResultShapes.IsEmpty() ) { + SetErrorCode("Error: Both GetInPlace and GetInPlaceByHistory algorithms found no shapes."); + return NULL; + } + + for (TopTools_ListIteratorOfListOfShape anItGIPBHShapeList(aGIPBHShapeList); anItGIPBHShapeList.More(); anItGIPBHShapeList.Next()) { + const TopoDS_Shape& aGIPBHResultShape = anItGIPBHShapeList.Value(); + + if (aWhereIndices.Contains(aGIPBHResultShape) && aResultShapes.Add(aGIPBHResultShape)) { + const TopAbs_ShapeEnum aType = aGIPBHResultShape.ShapeType(); + + if (aResultShapeType == -1) { + // Initialization. + aResultShapeType = aType; + } else if (aResultShapeType != TopAbs_SHAPE && aResultShapeType != aType) { + // Different types. + aResultShapeType = TopAbs_SHAPE; + } + + aResultShapeList.Append(aGIPBHResultShape); + } + } + } // Search for the sub-shapes inside the aWhere shape using InPlaceByHistory algorithm. + + Handle(TColStd_HArray1OfInteger) aResultShapeArray = new TColStd_HArray1OfInteger (1, aResultShapeList.Extent()); + TopTools_ListIteratorOfListOfShape anItResultShapeList(aResultShapeList); + for (Standard_Integer arrIdx = 1; anItResultShapeList.More(); anItResultShapeList.Next(), arrIdx++) { + aResultShapeArray->SetValue(arrIdx, aWhereIndices.FindIndex(anItResultShapeList.Value())); + } + + //Add a new object + Handle(GEOM_Object) aResult = GetEngine()->AddSubShape(theShapeWhere, aResultShapeArray); + if (aResult.IsNull()) { + SetErrorCode("Error in algorithm: result found, but cannot be returned."); + return NULL; + } + + const Standard_Boolean isSameType = (aResultShapeType != TopAbs_SHAPE); + + if ((aResultShapeArray->Length() > 1 && isSameType) || theShapeWhat->GetType() == GEOM_GROUP) { + //Set a GROUP type + aResult->SetType(GEOM_GROUP); + + //Set a sub-shape type + TopoDS_Shape aFirstFound = aResultShapeList.First(); + TopAbs_ShapeEnum aShapeType = aFirstFound.ShapeType(); + + TDF_Label aFreeLabel = aResult->GetFreeLabel(); + TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aShapeType); + } + + //Make a Python command + Handle(GEOM_Function) aFunction = aResult->GetFunction(1); + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetInPlaceCombined(" << theShapeWhere << ", " << theShapeWhat << ")"; + + SetErrorCode(OK); + return aResult; +} + + //============================================================================= /*! * case GetInPlace: diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx index dc352ba58..ea8ffc3fd 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx @@ -115,7 +115,7 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations Standard_EXPORT Handle(GEOM_Object) MakeWrappedFace(std::list theEdges, std::list theVertices, const Standard_Real theTolerance); - + Standard_EXPORT Handle(GEOM_Object) MakeFaceWithConstraints (std::list theConstraints); Standard_EXPORT Handle(GEOM_Object) MakeShell (std::list theShapes); @@ -152,7 +152,7 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations const Standard_Boolean theGroupsOnly); Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects(Handle(GEOM_Object) theShape, const Standard_Integer theTypes = All); - + enum ExplodeType { EXPLODE_OLD_INCLUDE_MAIN, EXPLODE_NEW_INCLUDE_MAIN, @@ -180,7 +180,7 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations Standard_EXPORT Standard_Integer GetSubShapeIndex (Handle(GEOM_Object) theMainShape, Handle(GEOM_Object) theSubShape); - + Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetSubShapesIndices (Handle(GEOM_Object) theMainShape, std::list theSubShapes); @@ -332,6 +332,12 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations Handle(GEOM_Object) theCenter, const Standard_Real theRadius); + /*! \returns Combined result of GetInPlace(_) and GetInPlaceByHistory(_). */ + Standard_EXPORT Handle(GEOM_Object) GetInPlaceCombined( Handle(GEOM_Object) theShapeWhere, + Handle(GEOM_Object) theShapeWhat); + + /*! \brief If theShapeWhere has curved subshapes, and centers of mass of these subshapes are closer + * to theShapeWhat than to subshapes themselves, such subshapes are not included into result.*/ Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere, Handle(GEOM_Object) theShapeWhat); @@ -461,7 +467,7 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations const Standard_Real theUMax, const Standard_Real theVMin, const Standard_Real theVMax); - + /*! * \brief Make a surface from a face. This function takes some face as * input parameter and creates new GEOM_Object, i.e. topological shape diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc index 1e02554d7..0689649e9 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.cc +++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc @@ -1020,11 +1020,11 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSubShapesIndices (GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfGO& theSubShapes) { GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; - + //Get the reference main shape Handle(::GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape); if (aMainShapeRef.IsNull()) return aSeq._retn(); - + //Get the subshapes std::list aShapes; int aLen = theSubShapes.length(); @@ -1039,14 +1039,14 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSubShapesIndices } //Get the IDs of inside - Handle(TColStd_HSequenceOfInteger) aHSeq = + Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetSubShapesIndices(aMainShapeRef, aShapes); - + if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn(); Standard_Integer aLength = aHSeq->Length(); aSeq->length(aLength); - + for (Standard_Integer i = 1; i <= aLength; i++) aSeq[i-1] = aHSeq->Value(i); @@ -1952,6 +1952,36 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs } +//============================================================================= +/*! + * GetInPlaceCombined + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceCombined( + GEOM::GEOM_Object_ptr theShapeWhere, + GEOM::GEOM_Object_ptr theShapeWhat +) { + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference objects + Handle(::GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere); + Handle(::GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat); + + if (aShapeWhere.IsNull() || + aShapeWhat.IsNull()) return aGEOMObject._retn(); + + //Get Shapes in place of aShapeWhat + Handle(::GEOM_Object) anObject = GetOperations()->GetInPlaceCombined(aShapeWhere, aShapeWhat); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + //============================================================================= /*! * GetInPlace diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.hh b/src/GEOM_I/GEOM_IShapesOperations_i.hh index 2d8cdf36e..2a784708c 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.hh +++ b/src/GEOM_I/GEOM_IShapesOperations_i.hh @@ -73,7 +73,7 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : const CORBA::Double theTolerance); GEOM::GEOM_Object_ptr MakeFaceWithConstraints (const GEOM::ListOfGO& theConstraints); - + GEOM::GEOM_Object_ptr MakeShell (const GEOM::ListOfGO& theFacesAndShells); GEOM::GEOM_Object_ptr MakeSolidShell (GEOM::GEOM_Object_ptr theShell); @@ -142,7 +142,7 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : CORBA::Long GetSubShapeIndex (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape); - + GEOM::ListOfLong* GetSubShapesIndices (GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfGO& theSubShapes); @@ -275,6 +275,9 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : CORBA::Short theShapeType, GEOM::shape_state theState); + GEOM::GEOM_Object_ptr GetInPlaceCombined (GEOM::GEOM_Object_ptr theShapeWhere, + GEOM::GEOM_Object_ptr theShapeWhat); + GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere, GEOM::GEOM_Object_ptr theShapeWhat); diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index 7cf3edc64..0b0d5299e 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -3113,7 +3113,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters) self._autoPublish(anObj, theName, "cylinder") return anObj - + ## Create a portion of cylinder with given base point, axis, radius, height and angle. # @param thePnt Central point of cylinder base. # @param theAxis Cylinder axis. @@ -3196,7 +3196,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): anObj.SetParameters(Parameters) self._autoPublish(anObj, theName, "cylinder") return anObj - + ## Create a portion of cylinder with given radius, height and angle at # the origin of coordinate system. Axis of the cylinder # will be collinear to the OZ axis of the coordinate system. @@ -3999,7 +3999,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. # - # @return New GEOM.GEOM_Object, containing the created pipe if + # @return New GEOM.GEOM_Object, containing the created pipe if # \a IsGenerateGroups is not set. Otherwise it returns a # list of GEOM.GEOM_Object. Its first element is the created pipe, the # remaining ones are created groups. @@ -4039,7 +4039,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - New GEOM.GEOM_Object, containing the created pipe if + New GEOM.GEOM_Object, containing the created pipe if IsGenerateGroups is not set. Otherwise it returns a list of GEOM.GEOM_Object. Its first element is the created pipe, the remaining ones are created groups. @@ -4076,7 +4076,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. # - # @return New GEOM.GEOM_Object, containing the created pipe if + # @return New GEOM.GEOM_Object, containing the created pipe if # \a IsGenerateGroups is not set. Otherwise it returns new # GEOM.ListOfGO. Its first element is the created pipe, the # remaining ones are created groups. @@ -4112,7 +4112,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - New GEOM.GEOM_Object, containing the created pipe if + New GEOM.GEOM_Object, containing the created pipe if IsGenerateGroups is not set. Otherwise it returns new GEOM.ListOfGO. Its first element is the created pipe, the remaining ones are created groups. @@ -4197,7 +4197,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. # - # @return New GEOM.GEOM_Object, containing the created solids if + # @return New GEOM.GEOM_Object, containing the created solids if # \a IsGenerateGroups is not set. Otherwise it returns new # GEOM.ListOfGO. Its first element is the created solids, the # remaining ones are created groups. @@ -4242,7 +4242,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - New GEOM.GEOM_Object, containing the created solids if + New GEOM.GEOM_Object, containing the created solids if IsGenerateGroups is not set. Otherwise it returns new GEOM.ListOfGO. Its first element is the created solids, the remaining ones are created groups. @@ -4320,7 +4320,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. # - # @return New GEOM.GEOM_Object, containing the created solids if + # @return New GEOM.GEOM_Object, containing the created solids if # \a IsGenerateGroups is not set. Otherwise it returns new # GEOM.ListOfGO. Its first element is the created solids, the # remaining ones are created groups. @@ -4345,7 +4345,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - New GEOM.GEOM_Object, containing the created solids if + New GEOM.GEOM_Object, containing the created solids if IsGenerateGroups is not set. Otherwise it returns new GEOM.ListOfGO. Its first element is the created solids, the remaining ones are created groups. @@ -4378,7 +4378,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. # - # @return New GEOM.GEOM_Object, containing the created pipe if + # @return New GEOM.GEOM_Object, containing the created pipe if # \a IsGenerateGroups is not set. Otherwise it returns new # GEOM.ListOfGO. Its first element is the created pipe, the # remaining ones are created groups. @@ -4408,7 +4408,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - New GEOM.GEOM_Object, containing the created pipe if + New GEOM.GEOM_Object, containing the created pipe if IsGenerateGroups is not set. Otherwise it returns new GEOM.ListOfGO. Its first element is the created pipe, the remaining ones are created groups. @@ -4433,7 +4433,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # @param theThickness Thickness of the resulting solid # @param theFacesIDs the list of face IDs to be removed from the # result. It is ignored if \a theShape is a face or a shell. - # It is empty by default. + # It is empty by default. # @param theInside If true the thickness is applied towards inside # @param theName Object name; when specified, this parameter is used # for result publication in the study. Otherwise, if automatic @@ -4456,7 +4456,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): theThickness Thickness of the resulting solid theFacesIDs the list of face IDs to be removed from the result. It is ignored if theShape is a face or a - shell. It is empty by default. + shell. It is empty by default. theInside If true the thickness is applied towards inside theName Object name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic @@ -4483,7 +4483,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # @param theThickness Thickness of the resulting solid # @param theFacesIDs the list of face IDs to be removed from the # result. It is ignored if \a theShape is a face or a shell. - # It is empty by default. + # It is empty by default. # @param theInside If true the thickness is applied towards inside # # @return The modified shape @@ -4503,7 +4503,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): theThickness Thickness of the resulting solid theFacesIDs the list of face IDs to be removed from the result. It is ignored if \a theShape is a face or - a shell. It is empty by default. + a shell. It is empty by default. theInside If true the thickness is applied towards inside Returns: @@ -4960,7 +4960,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): RaiseIfFailed("MakeFaceFromSurface", self.ShapesOp) self._autoPublish(anObj, theName, "face") return anObj - + ## Create a non-planar face from a list of closed edges and a list of vertices. # @param theEdges list of Edges(must be closed but not nesessarily belong to the same plane). # @param theVertices list of vertices through which the result face must pass. @@ -4993,7 +4993,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): RaiseIfFailed("MakeWrappedFace", self.ShapesOp) self._autoPublish(anObj, theName, "face") return anObj - + ## Create a face from a set of edges with the given constraints. # @param theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples): # - edges should form a closed wire; @@ -5002,9 +5002,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # @param theName Object name; when specified, this parameter is used # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. - # + # # @return New GEOM.GEOM_Object, containing the created face. - # + # # @ref tui_creation_face "Example" @ManageTransactions("ShapesOp") def MakeFaceWithConstraints(self, theConstraints, theName=None): @@ -5123,7 +5123,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): RaiseIfFailed("MakeCompound", self.ShapesOp) self._autoPublish(anObj, theName, "compound") return anObj - + ## Create a solid (or solids) from the set of faces and/or shells. # @param theFacesOrShells List of faces and/or shells. # @param isIntersect If TRUE, forces performing intersections @@ -5368,7 +5368,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. # - # @note If @a theShapes contains single compound, the shares between all possible couples of + # @note If @a theShapes contains single compound, the shares between all possible couples of # its top-level shapes are returned; otherwise, only shares between 1st input shape # and all rest input shapes are returned. # @@ -5392,7 +5392,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): for result publication in the study. Otherwise, if automatic publication is switched on, default value is used for result name. - Note: if theShapes contains single compound, the shares between all possible couples of + Note: if theShapes contains single compound, the shares between all possible couples of its top-level shapes are returned; otherwise, only shares between 1st input shape and all rest input shapes are returned. @@ -6052,6 +6052,47 @@ class geomBuilder(GEOM._objref_GEOM_Gen): RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp) return aList + + ## Get sub-shape(s) of theShapeWhere, which are + # coincident with \a theShapeWhat or could be a part of it. + # @param theShapeWhere Shape to find sub-shapes of. + # @param theShapeWhat Shape, specifying what to find. + # for result publication in the study. Otherwise, if automatic + # publication is switched on, default value is used for result name. + # + # @return Compound which includes all found sub-shapes if they have different types; + # or group of all found shapes of the equal type; or a single found sub-shape. + # + # @note Combines results of new GetInPlace(_) and GetInPlaceByHistory(_). + # + # @ref swig_GetInPlace "Example" + @ManageTransactions("ShapesOp") + def GetInPlaceCombined(self, theShapeWhere, theShapeWhat, theName=None): + """ + Get sub-shape(s) of theShapeWhere, which are + coincident with theShapeWhat or could be a part of it. + + Parameters: + theShapeWhere Shape to find sub-shapes of. + theShapeWhat Shape, specifying what to find. + theName Object name; when specified, this parameter is used + for result publication in the study. Otherwise, if automatic + publication is switched on, default value is used for result name. + + Returns: + Compound which includes all found sub-shapes if they have different types; + or group of all found shapes of the equal type; or a single found sub-shape. + + Note: + Combines results of new GetInPlace(_) and GetInPlaceByHistory(_). + """ + anObj = self.ShapesOp.GetInPlaceCombined(theShapeWhere, theShapeWhat) + + RaiseIfFailed("GetInPlaceCombined", self.ShapesOp) + self._autoPublish(anObj, theName, "inplace") + return anObj + + ## Get sub-shape(s) of theShapeWhere, which are # coincident with \a theShapeWhat or could be a part of it. # @param theShapeWhere Shape to find sub-shapes of. @@ -6062,7 +6103,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. # - # @return Compound which includes all found sub-shapes if they have different types; + # @return Compound which includes all found sub-shapes if they have different types; # or group of all found shapes of the equal type; or a single found sub-shape. # # @note This function has a restriction on argument shapes. @@ -6088,7 +6129,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - Compound which includes all found sub-shapes if they have different types; + Compound which includes all found sub-shapes if they have different types; or group of all found shapes of the equal type; or a single found sub-shape. @@ -6125,7 +6166,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. # - # @return Compound which includes all found sub-shapes if they have different types; + # @return Compound which includes all found sub-shapes if they have different types; # or group of all found shapes of the equal type; or a single found sub-shape. # # @ref swig_GetInPlace "Example" @@ -6147,7 +6188,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - Compound which includes all found sub-shapes if they have different types; + Compound which includes all found sub-shapes if they have different types; or group of all found shapes of the equal type; or a single found sub-shape. """ # Example: see GEOM_TestOthers.py @@ -6159,8 +6200,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen): ## A sort of GetInPlace functionality, returning IDs of sub-shapes. # For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape # IDs of @a theShapeWhere. - # For example, if theShapeWhat is a box and theShapeWhere is this box cut into - # two parts by a plane, then the result can be as this: + # For example, if theShapeWhat is a box and theShapeWhere is this box cut into + # two parts by a plane, then the result can be as this: # len( result_list ) = 35, # result_list[ 1 ] = [ 2, 36 ], which means that the box (ID 1) turned into two # solids with IDs 2 and 36 within theShapeWhere @@ -6173,8 +6214,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen): A sort of GetInPlace functionality, returning IDs of sub-shapes. For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape IDs of @a theShapeWhere. - For example, if theShapeWhat is a box and theShapeWhere is this box cut into - two parts by a plane, then the result can be as this: + For example, if theShapeWhat is a box and theShapeWhere is this box cut into + two parts by a plane, then the result can be as this: len( result_list ) = 35, result_list[ 1 ] = [ 2, 36 ], which means that the box (ID 1) turned into two solids with IDs 2 and 36 within theShapeWhere @@ -6839,7 +6880,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): faces, edges and vertices only. E.g. for theShapeType FACE, theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns all faces of theShape that have tolerances greater then 1.e7. - + Parameters: theShape the shape to be exploded theShapeType the type of sub-shapes to be returned (see @@ -6875,7 +6916,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): def IsSubShapeBelongsTo(self, aSubObject, anObject, aSubObjectIndex = 0, anObjectIndex = 0): """ Check if the object is a sub-object of another GEOM object. - + Parameters: aSubObject Checked sub-object (or its parent object, in case if \a theSubObjectIndex is non-zero). @@ -8594,7 +8635,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): Returns: New GEOM.GEOM_Object, containing the result shape. - + Note: This operation is a shortcut to the more general MakePartition operation, where theShape specifies single "object" (shape being partitioned) and thePlane specifies single "tool" (intersector shape). Other parameters of @@ -8602,7 +8643,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): - Limit: GEOM::SHAPE (shape limit corresponds to the type of theShape) - KeepNonlimitShapes: 0 - KeepInside, RemoveInside, RemoveWebs, Materials (obsolete parameters): empty - + I.e. the following two operations are equivalent: Result = geompy.MakeHalfPartition(Object, Plane) Result = geompy.MakePartition([Object], [Plane]) @@ -11879,7 +11920,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences - GEOM.SI_ALL(5) - all interferences. - + Returns: TRUE, if the shape contains no self-intersections. """ @@ -11910,7 +11951,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): theTolerance Specifies a distance between shapes used for detecting gaps: - if theTolerance <= 0, algorithm detects intersections (default behavior) - if theTolerance > 0, algorithm detects gaps - + Returns: TRUE, if the shape contains no self-intersections. """ @@ -11963,7 +12004,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): - if theTolerance > 0, algorithm detects gaps theDeflection Linear deflection coefficient that specifies quality of tessellation: - if theDeflection <= 0, default deflection 0.001 is used - + Returns: TRUE, if there are intersections (gaps) between source shapes List of sub-shapes IDs from 1st shape that localize intersection. @@ -12166,7 +12207,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): Note: this function is deprecated, it is kept for backward compatibility only Use Import instead, where is a name of desirable format to import. - Parameters: + Parameters: theFileName The file, containing the shape. theFormatName Specify format for the file reading. Available formats can be obtained with geompy.InsertOp.ImportTranslators() method. @@ -12213,7 +12254,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen): # @note As the byte-stream representing the shape data can be quite large, this method # is not automatically dumped to the Python script with the DumpStudy functionality; # so please use this method carefully, only for strong reasons. - # + # # @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's # data stream. # @@ -12272,8 +12313,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen): Note: this function is deprecated, it is kept for backward compatibility only Use Export instead, where is a name of desirable format to export. - - Parameters: + + Parameters: theObject Shape to be stored in the file. theFileName Name of the file to store the given shape in. theFormatName Specify format for the shape storage. @@ -14528,7 +14569,7 @@ def New( instance=None): return geom -# Register methods from the plug-ins in the geomBuilder class +# Register methods from the plug-ins in the geomBuilder class plugins_var = os.environ.get( "GEOM_PluginsList" ) plugins = None @@ -14546,7 +14587,7 @@ if plugins is not None: continue exec( "from salome.%s import %s" % (pluginName, pluginBuilderName)) plugin = eval( pluginBuilderName ) - + # add methods from plugin module to the geomBuilder class for k in dir( plugin ): if k[0] == '_': continue @@ -14558,4 +14599,4 @@ if plugins is not None: pass del pluginName pass - pass + pass