#include <SketchPlugin_Feature.h>
#include <SketchPlugin_ConstraintCoincidence.h>
+#include <SketchPlugin_Line.h>
+#include <SketchPlugin_Arc.h>
+#include <SketchPlugin_Circle.h>
+#include <SketchPlugin_Point.h>
#include <QGroupBox>
#include <QGridLayout>
const double MaxCoordinate = 1e12;
+static QStringList MyFeaturesForCoincedence;
PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent,
ModuleBase_IWorkshop* theWorkshop,
const std::string& theParentId)
: ModuleBase_ModelWidget(theParent, theData, theParentId), myWorkshop(theWorkshop)
{
+ if (MyFeaturesForCoincedence.isEmpty()) {
+ MyFeaturesForCoincedence << SketchPlugin_Line::ID().c_str()
+ << SketchPlugin_Arc::ID().c_str()
+ << SketchPlugin_Point::ID().c_str()
+ << SketchPlugin_Circle::ID().c_str();
+ }
myLockApplyMgr = new PartSet_LockApplyMgr(theParent, myWorkshop);
// the control should accept the focus, so the boolen flag is corrected to be true
// the same constraints for the same points, oterwise the result line has zero length.
if (getPoint2d(aView, aShape, aX, aY))
PartSet_Tools::setConstraints(mySketch, feature(), attributeID(), aX, aY);
- else if (aShape.ShapeType() == TopAbs_EDGE)
- setConstraintWith(aObject);
-
+ else if (aShape.ShapeType() == TopAbs_EDGE) {
+ if (MyFeaturesForCoincedence.contains(myFeature->getKind().c_str()))
+ setConstraintWith(aObject);
+ }
// it is important to perform updateObject() in order to the current value is
// processed by Sketch Solver. Test case: line is created from a previous point
// to some distance, but in the area of the highlighting of the point. Constraint
TopoDS_Edge aEdge2 = TopoDS::Edge(aTEdge2);
SetMeasuredGeometry(aEdge1, aEdge2);
- // Compute intersection point
- TopoDS_Vertex aV1, aV2;
- TopExp::Vertices(aEdge1, aV1, aV2);
- gp_Pnt aPnt1 = BRep_Tool::Pnt(aV1);
- gp_Pnt aPnt2 = BRep_Tool::Pnt(aV2);
- std::shared_ptr<GeomAPI_Lin> aL1(new GeomAPI_Lin(aPnt1.X(), aPnt1.Y(), aPnt1.Z(),
- aPnt2.X(), aPnt2.Y(), aPnt2.Z()));
- TopExp::Vertices(aEdge2, aV1, aV2);
- aPnt1 = BRep_Tool::Pnt(aV1);
- aPnt2 = BRep_Tool::Pnt(aV2);
- std::shared_ptr<GeomAPI_Lin> aL2(new GeomAPI_Lin(aPnt1.X(), aPnt1.Y(), aPnt1.Z(),
- aPnt2.X(), aPnt2.Y(), aPnt2.Z()));
-
- std::shared_ptr<GeomAPI_Pnt> aInter = aL1->intersect(aL2);
- gp_Pnt aCenter = aInter->impl<gp_Pnt>();
+ gp_Pnt aCenter = CenterPoint();
gp_Pnt aFLyPnt(aFlyoutPnt->x(), aFlyoutPnt->y(), aFlyoutPnt->z());
double aDist = aCenter.Distance(aFLyPnt);