[Sketcher] Stop treating knots as fixed in GUI commands
This stops constraints from becoming non-driving when not set. Follow 0penbrain's comments typo
This commit is contained in:
committed by
abdullahtahiriyo
parent
7cd2cbd29c
commit
430b0baa00
@@ -1445,9 +1445,9 @@ void CmdSketcherConstrainLock::activated(int iMsg)
|
||||
|
||||
lastconstraintindex+=2;
|
||||
|
||||
if (edgeisblocked || GeoId[0] <= Sketcher::GeoEnum::RefExt
|
||||
|| isBsplineKnot(Obj,GeoId[0])
|
||||
|| constraintCreationMode==Reference) {
|
||||
if (edgeisblocked
|
||||
|| GeoId[0] <= Sketcher::GeoEnum::RefExt
|
||||
|| constraintCreationMode==Reference) {
|
||||
// it is a constraint on a external line, make it non-driving
|
||||
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)",
|
||||
@@ -2287,7 +2287,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg)
|
||||
|
||||
// it is a constraint on a external line, make it non-driving
|
||||
if (arebothpointsorsegmentsfixed || GeoId1 <= Sketcher::GeoEnum::RefExt ||
|
||||
isBsplineKnot(Obj,GeoId1) || constraintCreationMode==Reference) {
|
||||
constraintCreationMode==Reference) {
|
||||
const std::vector<Sketcher::Constraint *> &ConStr = Obj->Constraints.getValues();
|
||||
|
||||
Gui::cmdAppObjectArgs(selection[0].getObject(), "setDriving(%i,%s)",
|
||||
@@ -2379,9 +2379,8 @@ void CmdSketcherConstrainDistance::applyConstraint(std::vector<SelIdPair> &selSe
|
||||
GeoId1,ActLength);
|
||||
|
||||
if (arebothpointsorsegmentsfixed
|
||||
|| GeoId1 <= Sketcher::GeoEnum::RefExt
|
||||
|| isBsplineKnot(Obj,GeoId1)
|
||||
|| constraintCreationMode==Reference) {
|
||||
|| GeoId1 <= Sketcher::GeoEnum::RefExt
|
||||
|| constraintCreationMode==Reference) {
|
||||
// it is a constraint on a external line, make it non-driving
|
||||
const std::vector<Sketcher::Constraint *> &ConStr = Obj->Constraints.getValues();
|
||||
|
||||
@@ -3104,8 +3103,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg)
|
||||
GeoId1,static_cast<int>(PosId1),ActY);
|
||||
|
||||
if (GeoId1 <= Sketcher::GeoEnum::RefExt
|
||||
|| isBsplineKnot(Obj,GeoId1)
|
||||
|| constraintCreationMode==Reference) {
|
||||
|| constraintCreationMode==Reference) {
|
||||
// it is a constraint on a external line, make it non-driving
|
||||
const std::vector<Sketcher::Constraint *> &ConStr = Obj->Constraints.getValues();
|
||||
|
||||
|
||||
@@ -160,15 +160,6 @@ bool SketcherGui::checkBothExternal(int GeoId1, int GeoId2)
|
||||
return (GeoId1 < 0 && GeoId2 < 0);
|
||||
}
|
||||
|
||||
bool SketcherGui::checkBothExternalOrBSplinePoints(const Sketcher::SketchObject* Obj,int GeoId1, int GeoId2)
|
||||
{
|
||||
if (GeoId1 == GeoEnum::GeoUndef || GeoId2 == GeoEnum::GeoUndef)
|
||||
return false;
|
||||
else
|
||||
return (GeoId1 < 0 && GeoId2 < 0) || (isBsplineKnot(Obj,GeoId1) && isBsplineKnot(Obj,GeoId2)) ||
|
||||
(GeoId1 < 0 && isBsplineKnot(Obj,GeoId2)) || (GeoId2 < 0 && isBsplineKnot(Obj,GeoId1));
|
||||
}
|
||||
|
||||
bool SketcherGui::isPointOrSegmentFixed(const Sketcher::SketchObject* Obj, int GeoId)
|
||||
{
|
||||
const std::vector< Sketcher::Constraint * > &vals = Obj->Constraints.getValues();
|
||||
@@ -176,7 +167,7 @@ bool SketcherGui::isPointOrSegmentFixed(const Sketcher::SketchObject* Obj, int G
|
||||
if (GeoId == GeoEnum::GeoUndef)
|
||||
return false;
|
||||
else
|
||||
return checkConstraint(vals, Sketcher::Block, GeoId, Sketcher::PointPos::none) || GeoId <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId);
|
||||
return checkConstraint(vals, Sketcher::Block, GeoId, Sketcher::PointPos::none) || GeoId <= Sketcher::GeoEnum::RtPnt;
|
||||
}
|
||||
|
||||
bool SketcherGui::areBothPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj, int GeoId1, int GeoId2)
|
||||
@@ -186,8 +177,8 @@ bool SketcherGui::areBothPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj
|
||||
if (GeoId1 == GeoEnum::GeoUndef || GeoId2 == GeoEnum::GeoUndef)
|
||||
return false;
|
||||
else
|
||||
return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::PointPos::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId1)) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::PointPos::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId2)));
|
||||
return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::PointPos::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::PointPos::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt));
|
||||
}
|
||||
|
||||
bool SketcherGui::areAllPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj, int GeoId1, int GeoId2, int GeoId3)
|
||||
@@ -197,9 +188,9 @@ bool SketcherGui::areAllPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj,
|
||||
if (GeoId1 == GeoEnum::GeoUndef || GeoId2 == GeoEnum::GeoUndef || GeoId3 == GeoEnum::GeoUndef)
|
||||
return false;
|
||||
else
|
||||
return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::PointPos::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId1)) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::PointPos::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId2)) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId3, Sketcher::PointPos::none) || GeoId3 <= Sketcher::GeoEnum::RtPnt || isBsplineKnot(Obj,GeoId3)));
|
||||
return ((checkConstraint(vals, Sketcher::Block, GeoId1, Sketcher::PointPos::none) || GeoId1 <= Sketcher::GeoEnum::RtPnt) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId2, Sketcher::PointPos::none) || GeoId2 <= Sketcher::GeoEnum::RtPnt) &&
|
||||
(checkConstraint(vals, Sketcher::Block, GeoId3, Sketcher::PointPos::none) || GeoId3 <= Sketcher::GeoEnum::RtPnt));
|
||||
}
|
||||
|
||||
bool SketcherGui::isSimpleVertex(const Sketcher::SketchObject* Obj, int GeoId, PointPos PosId)
|
||||
|
||||
@@ -72,8 +72,6 @@ void getIdsFromName(const std::string &name, const Sketcher::SketchObject* Obj,
|
||||
|
||||
bool checkBothExternal(int GeoId1, int GeoId2);
|
||||
|
||||
bool checkBothExternalOrBSplinePoints(const Sketcher::SketchObject* Obj,int GeoId1, int GeoId2);
|
||||
|
||||
bool isPointOrSegmentFixed(const Sketcher::SketchObject* Obj, int GeoId);
|
||||
|
||||
bool areBothPointsOrSegmentsFixed(const Sketcher::SketchObject* Obj, int GeoId1, int GeoId2);
|
||||
|
||||
Reference in New Issue
Block a user