}
//Make a Python command
- GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution("
+ GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolutionAxisAngle("
<< theBase << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)";
SetErrorCode(OK);
#include "GEOMAlgo_FinderShapeOnQuad.hxx"
#include "GEOMAlgo_FinderShapeOn2.hxx"
#include "GEOMAlgo_ClsfBox.hxx"
-//#include "GEOMAlgo_ClsfSurf.hxx"
#include "GEOMAlgo_Gluer1.hxx"
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
#include "GEOMAlgo_CoupleOfShapes.hxx"
#include <BRepExtrema_ExtCF.hxx>
#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <BRepGProp.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
// Check presence of triangulation, build if need
- if (!CheckTriangulation(theShape))
+ if (!CheckTriangulation(theShape)) {
+ SetErrorCode("Cannot build triangulation on the shape");
return aSeqOfIDs;
+ }
// Call algo
GEOMAlgo_FinderShapeOn1 aFinder;
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
// Check presence of triangulation, build if need
- if (!CheckTriangulation(aShape))
+ if (!CheckTriangulation(aShape)) {
+ SetErrorCode("Cannot build triangulation on the shape");
return aSeqOfIDs;
+ }
// Call algo
gp_Pnt aPntTL = BRep_Tool::Pnt(TopoDS::Vertex(aTL));
SL.Append( aShapes( OrderInd(Index) ));
}
+//=======================================================================
+//function : CompsolidToCompound
+//purpose :
+//=======================================================================
+TopoDS_Shape GEOMImpl_IShapesOperations::CompsolidToCompound (const TopoDS_Shape& theCompsolid)
+{
+ if (theCompsolid.ShapeType() != TopAbs_COMPSOLID) {
+ return theCompsolid;
+ }
+
+ TopoDS_Compound aCompound;
+ BRep_Builder B;
+ B.MakeCompound(aCompound);
+
+ TopTools_MapOfShape mapShape;
+ TopoDS_Iterator It (theCompsolid, Standard_True, Standard_True);
+
+ for (; It.More(); It.Next()) {
+ TopoDS_Shape aShape_i = It.Value();
+ if (mapShape.Add(aShape_i)) {
+ B.Add(aCompound, aShape_i);
+ }
+ }
+
+ return aCompound;
+}
+
//=======================================================================
//function : CheckTriangulation
//purpose :
{
TopExp_Explorer exp (aShape, TopAbs_FACE);
if (!exp.More()) {
- SetErrorCode("Shape without faces given");
return false;
}
class Handle(GEOM_Object);
class Handle(TColStd_HArray1OfInteger);
-class GEOMImpl_IShapesOperations : public GEOM_IOperations {
+class GEOMImpl_IShapesOperations : public GEOM_IOperations
+{
public:
Standard_EXPORT GEOMImpl_IShapesOperations(GEOM_Engine* theEngine, int theDocID);
Standard_EXPORT ~GEOMImpl_IShapesOperations();
const GEOMAlgo_State theState);
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
- const Standard_Integer theShapeType,
- const Handle(GEOM_Object)& theAxis,
- const Standard_Real theRadius,
- const GEOMAlgo_State theState);
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+ GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theAxis,
+ const Standard_Real theRadius,
+ const GEOMAlgo_State theState);
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
- const Standard_Integer theShapeType,
- const Handle(GEOM_Object)& theCenter,
- const Standard_Real theRadius,
- const GEOMAlgo_State theState);
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+ GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theCenter,
+ const Standard_Real theRadius,
+ const GEOMAlgo_State theState);
- Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape,
- const Standard_Integer theShapeType,
- const Handle(GEOM_Object)& theAx1,
- const GEOMAlgo_State theState);
+ Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
+ GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theAx1,
+ const GEOMAlgo_State theState);
Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
GetShapesOnPlaneWithLocationIDs (const Handle(GEOM_Object)& theShape,
const Handle(GEOM_Object)& thePnt,
const GEOMAlgo_State theState);
- Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape,
- const Standard_Integer theShapeType,
- const Handle(GEOM_Object)& theAxis,
- const Standard_Real theRadius,
- const GEOMAlgo_State theState);
+ Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
+ GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theAxis,
+ const Standard_Real theRadius,
+ const GEOMAlgo_State theState);
- Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape,
- const Standard_Integer theShapeType,
- const Handle(GEOM_Object)& theCenter,
- const Standard_Real theRadius,
- const GEOMAlgo_State theState);
+ Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
+ GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theCenter,
+ const Standard_Real theRadius,
+ const GEOMAlgo_State theState);
/*!
* \brief Find subshapes complying with given status about quadrangle
Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere,
Handle(GEOM_Object) theShapeWhat);
- Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL);
-
/*!
* \brief Searches a shape equal to theWhat in the context of theWhere
* \param theShapeWhere - a context shap
const Standard_Integer theShapeType,
GEOMAlgo_State theState);
+ public:
+ /*!
+ * \brief Sort shapes in the list by their coordinates.
+ * \param SL The list of shapes to sort.
+ */
+ Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL);
+
+ /*!
+ * \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND.
+ *
+ * If the argument shape is not of type TopoDS_COMPSOLID, this method returns it as is.
+ *
+ * \param theCompsolid The compsolid to be converted.
+ * \retval TopoDS_Shape Returns the resulting compound.
+ */
+ Standard_EXPORT static TopoDS_Shape CompsolidToCompound (const TopoDS_Shape& theCompsolid);
+
+ /*!
+ * \brief Build a triangulation on \a theShape if it is absent.
+ * \param theShape The shape to check/build triangulation on.
+ * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
+ */
+ Standard_EXPORT static bool CheckTriangulation (const TopoDS_Shape& theShape);
+
private:
Handle(GEOM_Object) MakeShape (list<Handle(GEOM_Object)> theShapes,
const Standard_Integer theObjectType,
const TCollection_AsciiString& theMethodName);
// ----------------------------------------------------
- // methods common for all GetShapesOnXXX() functions
+// methods common for all GetShapesOnXXX() functions
// ----------------------------------------------------
- bool CheckTriangulation (const TopoDS_Shape& aShape);
-
/*!
* \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK
* \param theShapeType - the shape type to check
#include <Standard_Stream.hxx>
#include <GEOMImpl_PipeDriver.hxx>
+
+#include <GEOMImpl_IShapesOperations.hxx>
+#include <GEOMImpl_IPipeDiffSect.hxx>
+#include <GEOMImpl_IPipeShellSect.hxx>
#include <GEOMImpl_IPipe.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
+#include <ShapeAnalysis_FreeBounds.hxx>
+#include <ShapeAnalysis_Edge.hxx>
+
#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_Sewing.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepOffsetAPI_MakePipeShell.hxx>
#include <TopAbs.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Face.hxx>
-#include <BRepOffsetAPI_MakePipeShell.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <GEOMImpl_IPipeDiffSect.hxx>
-#include <GEOMImpl_IPipeShellSect.hxx>
-
-#include <Standard_NullObject.hxx>
-#include <Standard_TypeMismatch.hxx>
-#include <Standard_ConstructionError.hxx>
-#include "utilities.h"
-#include <TopExp_Explorer.hxx>
-#include <TopTools_SequenceOfShape.hxx>
-#include <BRep_Builder.hxx>
#include <TopoDS_Compound.hxx>
-#include <ShapeAnalysis_FreeBounds.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
-#include <ShapeAnalysis_Edge.hxx>
+#include <TopTools_SequenceOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopExp.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
+
#include <GeomAPI_ProjectPointOnCurve.hxx>
-#include <Precision.hxx>
#include <Geom_TrimmedCurve.hxx>
-#include <BRepBuilderAPI_Sewing.hxx>
-//#include <BRepTools.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+
+#include <Precision.hxx>
+#include <Standard_NullObject.hxx>
+#include <Standard_TypeMismatch.hxx>
+#include <Standard_ConstructionError.hxx>
+
+#include "utilities.h"
//=======================================================================
}
FindNextPairOfFaces(F1other, aMapEdgeFaces1, aMapEdgeFaces2, FF, aCI);
-
}
}
Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
}
- aFunction->SetValue(aShape);
+ TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
+ aFunction->SetValue(aRes);
log.SetTouched(Label());
if(aCI) delete aCI;
#include <Standard_Stream.hxx>
#include <GEOMImpl_PrismDriver.hxx>
+
+#include <GEOMImpl_IShapesOperations.hxx>
#include <GEOMImpl_IPrism.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
if (aShape.IsNull()) return 0;
- aFunction->SetValue(aShape);
+ TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
+ aFunction->SetValue(aRes);
log.SetTouched(Label());
#include <Standard_Stream.hxx>
#include <GEOMImpl_RevolutionDriver.hxx>
+
+#include <GEOMImpl_IShapesOperations.hxx>
#include <GEOMImpl_IRevolution.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
}
if (aShape.IsNull()) return 0;
- aFunction->SetValue(aShape);
- log.SetTouched(Label());
+ TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
+ aFunction->SetValue(aRes);
+
+ log.SetTouched(Label());
- return 1;
+ return 1;
}