X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchAPI%2FSketchAPI_Sketch.h;h=bb83b18871ca5d7a065a5f9ef2fff127f61539cf;hb=1fd15bed1c62f994a3438bc4a12f44d0361f98c9;hp=3e531012dcfc64b7721e9d80aaa0c3d20335797e;hpb=08f1aef6629e6a63cc4671d271ded4de6e826948;p=modules%2Fshaper.git diff --git a/src/SketchAPI/SketchAPI_Sketch.h b/src/SketchAPI/SketchAPI_Sketch.h index 3e531012d..bb83b1887 100644 --- a/src/SketchAPI/SketchAPI_Sketch.h +++ b/src/SketchAPI/SketchAPI_Sketch.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2021 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,9 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ @@ -29,28 +28,37 @@ #include #include +#include #include #include +#include //-------------------------------------------------------------------------------------- class ModelAPI_CompositeFeature; class ModelAPI_Object; -class ModelHighAPI_Double; class ModelHighAPI_Integer; class ModelHighAPI_RefAttr; class ModelHighAPI_Reference; -class ModelHighAPI_Selection; class SketchAPI_Arc; class SketchAPI_MacroArc; class SketchAPI_Circle; class SketchAPI_MacroCircle; +class SketchAPI_Ellipse; +class SketchAPI_MacroEllipse; +class SketchAPI_EllipticArc; +class SketchAPI_MacroEllipticArc; +class SketchAPI_BSpline; class SketchAPI_IntersectionPoint; class SketchAPI_Line; class SketchAPI_Mirror; +class SketchAPI_Offset; class SketchAPI_Point; class SketchAPI_Projection; class SketchAPI_Rectangle; class SketchAPI_Rotation; class SketchAPI_Translation; + +//-------------------------------------------------------------------------------------- +typedef std::pair, ModelHighAPI_RefAttr> PointOrReference; //-------------------------------------------------------------------------------------- /**\class SketchAPI_Sketch * \ingroup CPPHighAPI @@ -99,6 +107,11 @@ public: SKETCHAPI_EXPORT void setPlane(const std::shared_ptr & thePlane); + /// Change sketch plane + SKETCHAPI_EXPORT + void setPlane(const ModelHighAPI_Selection & thePlane, + bool theRemoveExternalDependency = false); + /// Set external SKETCHAPI_EXPORT void setExternal(const ModelHighAPI_Selection & theExternal); @@ -107,6 +120,14 @@ public: SKETCHAPI_EXPORT void setExternal(std::shared_ptr thePlaneObject); + /// Change order of sketch results (faces) + SKETCHAPI_EXPORT + void changeFacesOrder(const std::list >& theFaces); + + /// List points not connected by constraints with other sketch entitites + SKETCHAPI_EXPORT + std::list< std::shared_ptr > getFreePoints(); + /// Add point SKETCHAPI_EXPORT std::shared_ptr addPoint( @@ -120,16 +141,18 @@ public: std::shared_ptr addPoint(const ModelHighAPI_Selection & theExternal); /// Add point SKETCHAPI_EXPORT - std::shared_ptr addPoint(const std::string & theExternalName); + std::shared_ptr addPoint(const std::wstring & theExternalName); /// Add intersection point SKETCHAPI_EXPORT std::shared_ptr - addIntersectionPoint(const ModelHighAPI_Selection & theExternal); + addIntersectionPoint(const ModelHighAPI_Selection & theExternal, + bool theKeepResult = false); /// Add point SKETCHAPI_EXPORT std::shared_ptr - addIntersectionPoint(const std::string & theExternalName); + addIntersectionPoint(const std::wstring & theExternalName, + bool theKeepResult = false); /// Add line SKETCHAPI_EXPORT @@ -145,7 +168,7 @@ public: std::shared_ptr addLine(const ModelHighAPI_Selection & theExternal); /// Add line SKETCHAPI_EXPORT - std::shared_ptr addLine(const std::string & theExternalName); + std::shared_ptr addLine(const std::wstring & theExternalName); /// Add rectangle SKETCHAPI_EXPORT @@ -156,6 +179,11 @@ public: std::shared_ptr addRectangle( const std::shared_ptr & theStartPoint, const std::shared_ptr & theEndPoint); + /// Add rectangle + SKETCHAPI_EXPORT + std::shared_ptr addRectangleCentered( + const std::pair, ModelHighAPI_RefAttr> & theCenter, + const std::pair, ModelHighAPI_RefAttr> & theCorner); /// Add circle SKETCHAPI_EXPORT @@ -194,7 +222,7 @@ public: std::shared_ptr addCircle(const ModelHighAPI_Selection & theExternal); /// Add circle SKETCHAPI_EXPORT - std::shared_ptr addCircle(const std::string & theExternalName); + std::shared_ptr addCircle(const std::wstring & theExternalName); /// Add arc SKETCHAPI_EXPORT @@ -226,19 +254,21 @@ public: const std::shared_ptr& theEnd, const std::shared_ptr& thePassed); - /// Add arc + /// Add transversal/tangent arc SKETCHAPI_EXPORT std::shared_ptr addArc( - const ModelHighAPI_RefAttr& theTangentPoint, + const ModelHighAPI_RefAttr& theConnectedPoint, double theEndX, double theEndY, - bool theInversed); + bool theInversed, + bool theTransversal = false); - /// Add arc + /// Add transversal/tangent arc SKETCHAPI_EXPORT std::shared_ptr addArc( - const ModelHighAPI_RefAttr& theTangentPoint, + const ModelHighAPI_RefAttr& theConnectedPoint, const std::shared_ptr& theEnd, - bool theInversed); + bool theInversed, + bool theTransversal = false); /// Add arc SKETCHAPI_EXPORT @@ -246,18 +276,96 @@ public: /// Add arc SKETCHAPI_EXPORT - std::shared_ptr addArc(const std::string & theExternalName); + std::shared_ptr addArc(const std::wstring & theExternalName); - /// Add projection + /// Add ellipse SKETCHAPI_EXPORT - std::shared_ptr addProjection( - const ModelHighAPI_Selection & theExternalFeature, - bool theKeepResult = false); + std::shared_ptr addEllipse( + double theCenterX, double theCenterY, + double theFocusX, double theFocusY, + double theMinorRadius); + /// Add ellipse + SKETCHAPI_EXPORT + std::shared_ptr addEllipse( + const std::shared_ptr& theCenter, + const std::shared_ptr& theFocus, + double theRadius); + /// Add ellipse + SKETCHAPI_EXPORT + std::shared_ptr addEllipse( + double thePoint1X, double thePoint1Y, + double thePoint2X, double thePoint2Y, + double thePassedX, double thePassedY, + bool isPoint1Center = true); + /// Add ellipse + SKETCHAPI_EXPORT + std::shared_ptr addEllipse( + const PointOrReference& thePoint1, + const PointOrReference& thePoint2, + const PointOrReference& thePassedPoint, + bool isPoint1Center = true); + /// Add ellipse + SKETCHAPI_EXPORT + std::shared_ptr addEllipse(const ModelHighAPI_Selection & theExternal); + /// Add ellipse + SKETCHAPI_EXPORT + std::shared_ptr addEllipse(const std::wstring & theExternalName); + + /// Add elliptic arc + SKETCHAPI_EXPORT + std::shared_ptr addEllipticArc( + double theCenterX, double theCenterY, + double theFocusX, double theFocusY, + double theStartX, double theStartY, + double theEndX, double theEndY, + bool theInversed = false); + /// Add elliptic arc + SKETCHAPI_EXPORT + std::shared_ptr addEllipticArc( + const PointOrReference& theCenter, + const PointOrReference& theMajorAxisPoint, + const PointOrReference& theStartPoint, + const PointOrReference& theEndPoint, + bool theInversed = false); + /// Add elliptic arc + SKETCHAPI_EXPORT + std::shared_ptr addEllipticArc(const ModelHighAPI_Selection & theExternal); + /// Add elliptic arc + SKETCHAPI_EXPORT + std::shared_ptr addEllipticArc(const std::wstring & theExternalName); + + /// Add B-spline + SKETCHAPI_EXPORT + std::shared_ptr addSpline( + const ModelHighAPI_Selection & external = ModelHighAPI_Selection(), + const int degree = -1, + const std::list& poles = std::list(), + const std::list& weights = std::list(), + const std::list& knots = std::list(), + const std::list& multiplicities = std::list(), + const bool periodic = false); + + /// Add interpolation feature + SKETCHAPI_EXPORT + std::shared_ptr addInterpolation( + const std::list& points, + const bool periodic = false, + const bool closed = false); + + /// Add approximation feature + SKETCHAPI_EXPORT + std::shared_ptr addApproximation( + const std::list& points, + const ModelHighAPI_Double& precision = ModelHighAPI_Double(1.e-3), + const bool periodic = false, + const bool closed = false); /// Add projection SKETCHAPI_EXPORT - std::shared_ptr addProjection(const std::string & theExternalName, - bool theKeepResult = false); + std::shared_ptr addProjection( + const ModelHighAPI_Selection & theExternalFeature, + bool keepResult = false, + bool keepRefToOriginal = true); /// Add mirror SKETCHAPI_EXPORT @@ -265,6 +373,13 @@ public: const ModelHighAPI_RefAttr & theMirrorLine, const std::list > & theObjects); + /// Add offset + SKETCHAPI_EXPORT + std::shared_ptr addOffset( + const std::list > & theObjects, + const ModelHighAPI_Double & theValue, + const bool theReversed); + /// Add translation SKETCHAPI_EXPORT std::shared_ptr addTranslation( @@ -281,7 +396,8 @@ public: const ModelHighAPI_RefAttr & theCenter, const ModelHighAPI_Double & theAngle, const ModelHighAPI_Integer & theNumberOfObjects, - bool theFullValue = false); + bool theFullValue = false, + bool theReversed = false); /// Add split SKETCHAPI_EXPORT @@ -300,7 +416,8 @@ public: std::shared_ptr setAngle( const ModelHighAPI_RefAttr & theLine1, const ModelHighAPI_RefAttr & theLine2, - const ModelHighAPI_Double & theValue); + const ModelHighAPI_Double & theValue, + const std::string& type = std::string()); /// Set complementary angle SKETCHAPI_EXPORT @@ -468,6 +585,8 @@ protected: //! Pointer on Sketch object typedef std::shared_ptr SketchPtr; +//-------------------------------------------------------------------------------------- + /**\ingroup CPPHighAPI * \brief Create Sketch feature */ @@ -487,7 +606,7 @@ SketchPtr addSketch(const std::shared_ptr & thePart, */ SKETCHAPI_EXPORT SketchPtr addSketch(const std::shared_ptr & thePart, - const std::string & theExternalName); + const std::wstring & theExternalName); /**\ingroup CPPHighAPI * \brief Create Sketch feature @@ -497,5 +616,13 @@ SketchPtr addSketch(const std::shared_ptr & thePart, std::shared_ptr thePlaneObject); //-------------------------------------------------------------------------------------- + +/** \ingroup CPPHighAPI + * \brief Copy sketch with all its sub-features + */ +SKETCHAPI_EXPORT +SketchPtr copySketch(const std::shared_ptr & thePart, + const SketchPtr & theSketch); + //-------------------------------------------------------------------------------------- #endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */