Sketcher: Reassign virtual space flag to constraints after modifying them through a default DHS
This commit is contained in:
@@ -1205,10 +1205,13 @@ protected:
|
||||
Sketcher::PythonConverter::Mode::OmitInternalGeometry)
|
||||
.c_str());
|
||||
|
||||
size_t initialConstraintCount = sketchgui->getSketchObject()->Constraints.getSize();
|
||||
auto shapeConstraints = toPointerVector(ShapeConstraints);
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc,
|
||||
Sketcher::PythonConverter::convert(sketchObj, shapeConstraints).c_str());
|
||||
|
||||
reassignVirtualSpace(initialConstraintCount);
|
||||
}
|
||||
|
||||
/** @brief Function to draw as an edit curve all the geometry in the ShapeGeometry vector.*/
|
||||
@@ -1226,6 +1229,39 @@ protected:
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
// Reassign the correct virtual space index for the added constraints
|
||||
void reassignVirtualSpace(size_t startIndex)
|
||||
{
|
||||
if (ShapeConstraints.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::stringstream stream;
|
||||
bool hasConstraintsInVirtualSpace = false;
|
||||
for (size_t i = 0; i < ShapeConstraints.size(); ++i) {
|
||||
if (ShapeConstraints[i]->isInVirtualSpace) {
|
||||
if (hasConstraintsInVirtualSpace) {
|
||||
stream << ",";
|
||||
}
|
||||
stream << i + startIndex;
|
||||
hasConstraintsInVirtualSpace = true;
|
||||
}
|
||||
}
|
||||
if (!hasConstraintsInVirtualSpace) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(),
|
||||
"setVirtualSpace([%s], True)",
|
||||
stream.str().c_str());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().error("%s\n", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector<std::vector<AutoConstraint>> sugConstraints;
|
||||
|
||||
|
||||
@@ -341,6 +341,7 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
listOfFacadeIds.clear();
|
||||
for (auto& geoId : listOfGeoIds) {
|
||||
const Part::Geometry* pGeo = Obj->getGeometry(geoId);
|
||||
long facadeId;
|
||||
|
||||
Reference in New Issue
Block a user