X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_MacroEllipticArc.cpp;h=c309b0b2a480ca6a5f2ed834270f22db9ae77d8c;hb=77ce6d35ac8d2f0fdaecb4f23e0870bf74e36103;hp=984a759261cd1ace2416455d69f18a2531452b50;hpb=3c987a8d1b88765224e3ac1388afb91eae17e4d3;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp b/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp index 984a75926..c309b0b2a 100644 --- a/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2019 CEA/DEN, EDF R&D +// Copyright (C) 2017-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,6 +42,7 @@ #include +const double TOLERANCE = 1.e-7; const double paramTolerance = 1.e-4; const double PI = 3.141592653589793238463; @@ -93,7 +94,7 @@ void SketchPlugin_MacroEllipticArc::execute() Events_Loop::loop()->send(aMessage); } -void SketchPlugin_MacroEllipticArc::attributeChanged(const std::string& theID) +void SketchPlugin_MacroEllipticArc::attributeChanged(const std::string& /*theID*/) { static const int NB_POINTS = 4; std::string aPointAttrName[NB_POINTS] = { CENTER_ID(), @@ -132,6 +133,9 @@ void SketchPlugin_MacroEllipticArc::attributeChanged(const std::string& theID) myStartPnt = anEllipsePoints[2]; myEndPnt = anEllipsePoints[3]; + if (myCenter->distance(myMajorAxis) < TOLERANCE) + return; // ellipse is not valid + std::shared_ptr anEllipse; if (aNbInitialized == 2) { GeomDir2dPtr aXDir(new GeomAPI_Dir2d(anEllipsePoints[1]->x() - anEllipsePoints[0]->x(), @@ -350,6 +354,7 @@ AISObjectPtr SketchPlugin_MacroEllipticArc::getAISObject(AISObjectPtr thePreviou if (!anAIS) anAIS.reset(new GeomAPI_AISObject()); anAIS->createShape(aCompound); + SketchPlugin_Tools::customizeFeaturePrs(anAIS, boolean(AUXILIARY_ID())->value()); return anAIS; } @@ -359,7 +364,7 @@ GeomShapePtr SketchPlugin_MacroEllipticArc::getArcShape() return GeomShapePtr(); SketchPlugin_Sketch* aSketch = sketch(); - if (!aSketch) + if (!aSketch || myCenter->distance(myMajorAxis) < 1.e-7) return GeomShapePtr(); GeomPointPtr aCenter(aSketch->to3D(myCenter->x(), myCenter->y()));