-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File: SketchPlugin_Fillet.cpp
-// Created: 19 Mar 2015
-// Author: Artem ZHIDKOV
+// Copyright (C) 2014-2017 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
#include "SketchPlugin_Fillet.h"
#include "SketchPlugin_ConstraintEqual.h"
#include "SketchPlugin_ConstraintCoincidence.h"
#include "SketchPlugin_ConstraintLength.h"
+#include "SketchPlugin_ConstraintMiddle.h"
#include "SketchPlugin_ConstraintTangent.h"
#include "SketchPlugin_ConstraintRadius.h"
#include "SketchPlugin_Tools.h"
#include <ModelAPI_Tools.h>
#include <ModelAPI_Validator.h>
+#include <GeomAlgoAPI_Circ2dBuilder.h>
#include <GeomAlgoAPI_EdgeBuilder.h>
#include <GeomAPI_Circ2d.h>
if (isUpdateFlushed)
Events_Loop::loop()->setFlushed(anUpdateEvent, false);
+ // set flag here to avoid building Fillet presentation if "Redisplay" event appears
+ myFilletCreated = true;
+
// Calculate Fillet parameters if does not yet
if (!myBaseFeatures[0] || !myBaseFeatures[1])
calculateFilletParameters();
if(isUpdateFlushed) {
Events_Loop::loop()->setFlushed(anUpdateEvent, true);
}
-
- myFilletCreated = true;
}
AISObjectPtr SketchPlugin_Fillet::getAISObject(AISObjectPtr thePrevious)
GeomShapePtr aShapeA = theFilletFeatures[0]->lastResult()->shape();
GeomShapePtr aShapeB = theFilletFeatures[1]->lastResult()->shape();
- std::shared_ptr<GeomAPI_Circ2d> aFilletCircle(
- new GeomAPI_Circ2d(aShapeA, aShapeB, theFilletRadius, theSketchPlane));
- if (!aFilletCircle->implPtr<char>())
+ GeomAlgoAPI_Circ2dBuilder aCircBuilder(theSketchPlane);
+ aCircBuilder.addTangentCurve(aShapeA);
+ aCircBuilder.addTangentCurve(aShapeB);
+ aCircBuilder.setRadius(theFilletRadius);
+
+ std::shared_ptr<GeomAPI_Circ2d> aFilletCircle = aCircBuilder.circle();
+ if (!aFilletCircle)
return;
theCenter = aFilletCircle->center()->xy();
SketchPlugin_Tools::findCoincidences(theConstraintCoincidence,
SketchPlugin_ConstraintCoincidence::ENTITY_A(),
- aCoincides);
+ aCoincides,
+ true);
SketchPlugin_Tools::findCoincidences(theConstraintCoincidence,
SketchPlugin_ConstraintCoincidence::ENTITY_B(),
- aCoincides);
+ aCoincides,
+ true);
// Remove points from set of coincides.
std::set<FeaturePtr> aNewSetOfCoincides;
for(std::set<FeaturePtr>::iterator anIt = aCoincides.begin(); anIt != aCoincides.end(); ++anIt) {
std::shared_ptr<SketchPlugin_SketchEntity> aSketchEntity =
std::dynamic_pointer_cast<SketchPlugin_SketchEntity>(*anIt);
- if(aSketchEntity.get() && aSketchEntity->isCopy()) {
+ if(aSketchEntity.get() && (aSketchEntity->isCopy() || aSketchEntity->isExternal())) {
continue;
}
if((*anIt)->getKind() == SketchPlugin_Line::ID()) {
continue;
}
if(aFeature->getKind() == SketchPlugin_ConstraintLength::ID()
- || aFeature->getKind() == SketchPlugin_ConstraintEqual::ID()) {
+ || aFeature->getKind() == SketchPlugin_ConstraintEqual::ID()
+ || aFeature->getKind() == SketchPlugin_ConstraintMiddle::ID()) {
aFeaturesToBeRemoved.insert(aFeature);
} else {
std::list<AttributePtr> anAttrs =