-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019 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
//
// 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<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SketchPlugin_Fillet.h"
const AttributePtr theAttribute);
SketchPlugin_Fillet::SketchPlugin_Fillet()
-: myFilletCreated(false)
+: myFilletCreated(false), myIsReversed(false)
{
+ myIsNotInversed[0] = myIsNotInversed[1] = true;
}
void SketchPlugin_Fillet::initAttributes()
// create feature for fillet arc
FeaturePtr aFilletArc = createFilletArc();
+ if (!aFilletArc) {
+ setError("Error: unable to create a fillet arc.");
+ return;
+ }
// collect features referred to the edges participating in fillet
AttributePoint2DPtr aFilletPoints[2];
anAISObject = AISObjectPtr(new GeomAPI_AISObject);
}
anAISObject->createShape(anArcShape);
+ bool isAxiliary = false;
+ AttributeBooleanPtr aAttr = boolean(AUXILIARY_ID());
+ if (aAttr.get())
+ isAxiliary = aAttr->value();
+ SketchPlugin_Tools::customizeFeaturePrs(anAISObject, isAxiliary);
return anAISObject;
}
if (!aFilletPoint2D.get())
return false;
- std::set<FeaturePtr> aFilletFeatures =
- SketchPlugin_Tools::findFeaturesCoincidentToPoint(aFilletPoint2D);
+ std::set<AttributePoint2DPtr> aCoincidentPoints =
+ SketchPlugin_Tools::findPointsCoincidentToPoint(aFilletPoint2D);
+ std::set<FeaturePtr> aFilletFeatures;
+ for (std::set<AttributePoint2DPtr>::iterator aCPIt = aCoincidentPoints.begin();
+ aCPIt != aCoincidentPoints.end(); ++aCPIt) {
+ std::shared_ptr<SketchPlugin_Feature> anOwner =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(
+ ModelAPI_Feature::feature((*aCPIt)->owner()));
+ if (anOwner && !anOwner->isExternal())
+ aFilletFeatures.insert(anOwner);
+ }
if (aFilletFeatures.size() != 2) {
setError("Error: Selected point does not have two suitable edges for fillet.");
return false;
if (!myBaseFeatures[0] || !myBaseFeatures[1])
calculateFilletParameters();
+ // fix for issue #2810 (sometimes, myCenterXY is NULL, fillet should report an error)
+ if (!myCenterXY)
+ return FeaturePtr();
+
// Create arc feature.
FeaturePtr aFilletArc = sketch()->addFeature(SketchPlugin_Arc::ID());
if (anEdge)
aLengths[i] = anEdge->length();
}
- return std::min(aLengths[0], aLengths[1]) / 6.0;
+ return (aLengths[0] < aLengths[1] ? aLengths[0] : aLengths[1]) / 6.0;
}
std::set<FeaturePtr> findFeaturesToRemove(const FeaturePtr theFeature,