[Sketcher] Fix check for fixed items in tangent+perpendicular

This commit is contained in:
0penBrain
2022-01-20 17:32:24 +01:00
committed by abdullahtahiriyo
parent 51d9ce64d0
commit 2c2b9752fd

View File

@@ -3725,12 +3725,6 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector<SelIdPair> &
int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef, GeoId3 = GeoEnum::GeoUndef;
Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none, PosId3 = Sketcher::PointPos::none;
// check if the edge already has a Block constraint
if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) {
showNoConstraintBetweenFixedGeometry();
return;
}
switch (seqIndex) {
case 0: // {SelEdge, SelEdgeOrAxis}
case 1: // {SelEdgeOrAxis, SelEdge}
@@ -3739,6 +3733,12 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector<SelIdPair> &
{
GeoId1 = selSeq.at(0).GeoId; GeoId2 = selSeq.at(1).GeoId;
// check if the edge already has a Block constraint
if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) {
showNoConstraintBetweenFixedGeometry();
return;
}
const Part::Geometry *geo1 = Obj->getGeometry(GeoId1);
const Part::Geometry *geo2 = Obj->getGeometry(GeoId2);
if (!geo1 || !geo2) {
@@ -3915,6 +3915,12 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector<SelIdPair> &
if (isEdge(GeoId1, PosId1) && isEdge(GeoId2, PosId2) && isVertex(GeoId3, PosId3)) {
// check if the edge already has a Block constraint
if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) {
showNoConstraintBetweenFixedGeometry();
return;
}
if(isBsplinePole(Obj, GeoId1) || isBsplinePole(Obj, GeoId2)) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
QObject::tr("Select an edge that is not a B-spline weight"));
@@ -4417,12 +4423,6 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector<SelIdPair> &selSeq
int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef, GeoId3 = GeoEnum::GeoUndef;
Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none, PosId3 = Sketcher::PointPos::none;
// check if the edge already has a Block constraint
if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) {
showNoConstraintBetweenFixedGeometry();
return;
}
switch (seqIndex) {
case 0: // {SelEdge, SelEdgeOrAxis}
case 1: // {SelEdgeOrAxis, SelEdge}
@@ -4431,6 +4431,12 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector<SelIdPair> &selSeq
{
GeoId1 = selSeq.at(0).GeoId; GeoId2 = selSeq.at(1).GeoId;
// check if the edge already has a Block constraint
if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) {
showNoConstraintBetweenFixedGeometry();
return;
}
const Part::Geometry *geom1 = Obj->getGeometry(GeoId1);
const Part::Geometry *geom2 = Obj->getGeometry(GeoId2);
@@ -4588,6 +4594,12 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector<SelIdPair> &selSeq
GeoId1 = selSeq.at(0).GeoId; GeoId2 = selSeq.at(1).GeoId;
PosId1 = selSeq.at(0).PosId; PosId2 = selSeq.at(1).PosId;
// check if the edge already has a Block constraint
if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) {
showNoConstraintBetweenFixedGeometry();
return;
}
if (isSimpleVertex(Obj, GeoId1, PosId1) ||
isSimpleVertex(Obj, GeoId2, PosId2)) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
@@ -4625,6 +4637,12 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector<SelIdPair> &selSeq
if (isEdge(GeoId1, PosId1) && isEdge(GeoId2, PosId2) && isVertex(GeoId3, PosId3)) {
// check if the edge already has a Block constraint
if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) {
showNoConstraintBetweenFixedGeometry();
return;
}
if(isBsplinePole(Obj, GeoId1) || isBsplinePole(Obj, GeoId2)) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
QObject::tr("Select an edge that is not a B-spline weight"));