void SketchPlugin_MacroEllipticArc::execute()
{
FeaturePtr anEllipse = createEllipticArcFeature();
+ constraintsForEllipticArc(anEllipse);
// message to init reentrant operation
static Events_ID anId = SketchPlugin_MacroArcReentrantMessage::eventId();
return aEllipseFeature;
}
+void SketchPlugin_MacroEllipticArc::constraintsForEllipticArc(FeaturePtr theEllipticArc)
+{
+ // tangency on-the-fly is not applicable for elliptic arcs
+ static const bool isTangencyApplicable = false;
+ // Create constraints.
+ SketchPlugin_Tools::createCoincidenceOrTangency(
+ this, CENTER_REF_ID(),
+ theEllipticArc->attribute(SketchPlugin_EllipticArc::CENTER_ID()),
+ ObjectPtr(), isTangencyApplicable);
+ // make coincidence only if PASSED_POINT_REF_ID() refers a point but not an object
+ if (!refattr(MAJOR_AXIS_POINT_REF_ID())->isObject()) {
+ SketchPlugin_Tools::createCoincidenceOrTangency(
+ this, MAJOR_AXIS_POINT_REF_ID(),
+ AttributePtr(),
+ theEllipticArc->lastResult(), isTangencyApplicable);
+ }
+ SketchPlugin_Tools::createCoincidenceOrTangency(
+ this, START_POINT_REF_ID(),
+ theEllipticArc->attribute(SketchPlugin_EllipticArc::START_POINT_ID()),
+ ObjectPtr(), isTangencyApplicable);
+ SketchPlugin_Tools::createCoincidenceOrTangency(
+ this, END_POINT_REF_ID(),
+ theEllipticArc->attribute(SketchPlugin_EllipticArc::END_POINT_ID()),
+ ObjectPtr(), isTangencyApplicable);
+}
+
AISObjectPtr SketchPlugin_MacroEllipticArc::getAISObject(AISObjectPtr thePrevious)
{
SketchPlugin_Sketch* aSketch = sketch();
public GeomAPI_IPresentable,
public ModelAPI_IReentrant
{
- public:
+public:
/// Elliptic arc feature kind
inline static const std::string& ID()
{
std::shared_ptr<GeomAPI_Shape> getArcShape();
FeaturePtr createEllipticArcFeature();
+ void constraintsForEllipticArc(FeaturePtr theEllipticArc);
private:
std::shared_ptr<GeomAPI_Pnt2d> myCenter;