SHAPER 9.16.0
SketchPlugin_Fillet.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef SketchPlugin_Fillet_H_
21#define SketchPlugin_Fillet_H_
22
23#include "SketchPlugin.h"
24
25#include "SketchPlugin_SketchEntity.h"
26
27#include <GeomAPI_IPresentable.h>
28#include <GeomDataAPI_Point2D.h>
29
30class GeomAPI_XY;
31
37{
38 public:
40 inline static const std::string& ID()
41 {
42 static const std::string MY_FEATURE_ID("SketchFillet");
43 return MY_FEATURE_ID;
44 }
45
47 inline static const std::string& FILLET_POINT_ID()
48 {
49 static const std::string ID("fillet_point");
50 return ID;
51 }
52
54 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
55 {
56 static std::string MY_KIND = SketchPlugin_Fillet::ID();
57 return MY_KIND;
58 }
59
61 SKETCHPLUGIN_EXPORT virtual void execute();
62
64 SKETCHPLUGIN_EXPORT virtual void initAttributes();
65
67 SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
68
71 SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}
72
73 SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}
74
77 SKETCHPLUGIN_EXPORT virtual void move(const double, const double) {}
78
81
82private:
83 bool calculateFilletParameters();
84
86 FeaturePtr createFilletArc();
87
89 FeaturePtr createFilletApex(const std::shared_ptr<GeomAPI_Pnt2d>& theCoordinates);
90
96 void removeReferencesButKeepDistances(std::set<FeaturePtr>& theFeaturesToRemove,
97 const AttributePoint2DPtr theFilletPoints[2]);
98
99 bool findFeaturesContainingFilletPoint(std::shared_ptr<GeomDataAPI_Point2D> theFilletPoint);
100
101private:
102 FeaturePtr myBaseFeatures[2];
103 std::string myFeatAttributes[4]; // attributes of features
104 bool myIsReversed;
105 bool myIsNotInversed[2]; // indicates which point the features share
106 bool myFilletCreated;
107 std::shared_ptr<GeomAPI_XY> myCenterXY;
108 std::shared_ptr<GeomAPI_XY> myTangentXY1;
109 std::shared_ptr<GeomAPI_XY> myTangentXY2;
110};
111
112#endif
A class which defines an interface of object which is able to create its own presentation.
Definition: GeomAPI_IPresentable.h:29
2 coordinates: they may represent vector or point or something else
Definition: GeomAPI_XY.h:32
Feature for creation of a new arc filleting two objects which have coincident point.
Definition: SketchPlugin_Fillet.h:37
virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
Returns the AIS preview.
Definition: SketchPlugin_Fillet.cpp:168
SketchPlugin_Fillet()
Use plugin manager for features creation.
Definition: SketchPlugin_Fillet.cpp:85
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: SketchPlugin_Fillet.cpp:91
virtual void execute()
Creates a new part document if needed.
Definition: SketchPlugin_Fillet.cpp:96
virtual void move(const double, const double)
Reimplemented from SketchPlugin_Feature::move().
Definition: SketchPlugin_Fillet.h:77
static const std::string & ID()
Feature kind.
Definition: SketchPlugin_Fillet.h:40
virtual bool isMacro() const
Reimplemented from ModelAPI_Feature::isMacro().
Definition: SketchPlugin_Fillet.h:71
virtual const std::string & getKind()
Definition: SketchPlugin_Fillet.h:54
virtual bool isPreviewNeeded() const
Returns true if preview update during the edition needed.
Definition: SketchPlugin_Fillet.h:73
static const std::string & FILLET_POINT_ID()
Attribute name of fillet point.
Definition: SketchPlugin_Fillet.h:47
Sketch Entity for creation of the new feature in PartSet.
Definition: SketchPlugin_SketchEntity.h:45