Add new GetInPlaceCombined method, which combines results of GetInPlace(_) (the "new" one) and GetInPlaceByHistory(_).
/*!
* \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
* 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
/*! 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
enum curve_type {
/*! Polyline curve */
Polyline,
-
+
/*! Bezier curve */
Bezier,
/*!
* \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();
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
in double theAngleLength,
in double theAngleRotation);
};
-
+
/*!
* \brief Interface for 3D primitives creation
*
/*!
* \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.
/*!
* \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);
/*!
* \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.
/*!
* \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.
/*!
* \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.
in boolean isCopy,
in boolean isInside);
-
+
/*!
* \brief Build a middle path of a pipe-like shape.
*
* \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.
in boolean theGroupsOnly);
/*!
- * \brief Deprecated method.
+ * \brief Deprecated method.
*
* Use MakeAllSubShapes() instead.
*/
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.
* \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,
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,
*
* \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
};
- // # GEOM_IBlocksOperations:
+ // # GEOM_IBlocksOperations:
/*!
* \brief Interface for Blocks construction
* Face from points or edges, Block from faces,
*/
interface GEOM_IBlocksOperations : GEOM_IOperations
{
-
+
// # Creation of blocks
/*!
/*!
* \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.
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.
in double theTolerance);
// # Extract blocks from blocks compounds
-
+
/*!
* \brief Check, if the compound contains only specified blocks.
in long theNbTimesV);
// # Special operation - propagation
-
+
/*!
* \brief Build all possible propagation groups.
* \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
* \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
* \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,
* \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,
/*!
* \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
*
/*!
* \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:
*
/*!
* \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
long GetSubShapeIndex (in GEOM_Object theShape, in GEOM_Object theSubShape);
};
- // # GEOM_IHealingOperations:
+ // # GEOM_IHealingOperations:
/*!
* \brief Interface for shape healing operations
*
/*!
* \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.
/*! 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 */
/*! 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
};
};
* - 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.
/*!
* \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.
/*!
* \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,
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
* 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.
* \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 );
/*!
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();
pd << "] = geompy.GetExistingSubObjects(";
pd << theShape << ", " << (bool)theGroupsOnly << ")";
}
-
+
return results;
}
{
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<Handle(GEOM_Object)>::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");
}
int id = anIndices.FindIndex(aSubShape);
aSeq->Append(id);
- }
-
+ }
+
SetErrorCode(OK);
return aSeq;
}
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());
}
}
}
-
+
if (TopAbs_ShapeEnum(theShapeType) == TopAbs_SHAPE)
nbShapes = aMapOfShape.Extent();
else
//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
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;
// 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;
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:
Standard_EXPORT Handle(GEOM_Object) MakeWrappedFace(std::list<Handle(GEOM_Object)> theEdges,
std::list<Handle(GEOM_Object)> theVertices,
const Standard_Real theTolerance);
-
+
Standard_EXPORT Handle(GEOM_Object) MakeFaceWithConstraints (std::list<Handle(GEOM_Object)> theConstraints);
Standard_EXPORT Handle(GEOM_Object) MakeShell (std::list<Handle(GEOM_Object)> theShapes);
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,
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<Handle(GEOM_Object)> theSubShapes);
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);
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
(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<Handle(::GEOM_Object)> aShapes;
int aLen = theSubShapes.length();
}
//Get the IDs of <theSubShapes> inside <theMainShape>
- 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);
}
+//=============================================================================
+/*!
+ * 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
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);
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);
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);
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.
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.
# 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.
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.
# 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.
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.
# 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.
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.
# 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.
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.
# 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.
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.
# @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
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
# @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
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:
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.
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;
# @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):
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
# 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.
#
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.
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.
# 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.
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.
# 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"
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
## 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
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
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
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).
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
- 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])
- 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.
"""
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.
"""
- 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.
Note: this function is deprecated, it is kept for backward compatibility only
Use Import<FormatName> instead, where <FormatName> 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.
# @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.
#
Note: this function is deprecated, it is kept for backward compatibility only
Use Export<FormatName> instead, where <FormatName> 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.
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
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
pass
del pluginName
pass
- pass
+ pass