Sketcher: fix crash, when cloning element having a non-driving distance, radius, diameter or angle constraint; fixes #4393

This commit is contained in:
Thomas Gimpel
2020-06-30 23:08:35 +02:00
committed by abdullahtahiriyo
parent 9e619ed55e
commit 33841eb827

View File

@@ -3939,6 +3939,7 @@ int SketchObject::addCopy(const std::vector<int> &geoIdList, const Base::Vector3
// Distances on a single Element are mapped to equality constraints in clone mode
Constraint *constNew = (*it)->copy();
constNew->Type = Sketcher::Equal;
constNew->isDriving = true;
constNew->Second = geoIdMap[(*it)->First]; // first is already (*it->First)
newconstrVals.push_back(constNew);
}
@@ -3946,6 +3947,7 @@ int SketchObject::addCopy(const std::vector<int> &geoIdList, const Base::Vector3
// Angles on a single Element are mapped to parallel constraints in clone mode
Constraint *constNew = (*it)->copy();
constNew->Type = Sketcher::Parallel;
constNew->isDriving = true;
constNew->Second = geoIdMap[(*it)->First]; // first is already (*it->First)
newconstrVals.push_back(constNew);
}
@@ -3968,6 +3970,7 @@ int SketchObject::addCopy(const std::vector<int> &geoIdList, const Base::Vector3
// Distances on a two Elements, which must be points of the same line are mapped to equality constraints in clone mode
Constraint *constNew = (*it)->copy();
constNew->Type = Sketcher::Equal;
constNew->isDriving = true;
constNew->FirstPos = Sketcher::none;
constNew->Second = geoIdMap[(*it)->First]; // first is already (*it->First)
constNew->SecondPos = Sketcher::none;