Sketcher: Do not autoscale if there are blocked geometries

This commit is contained in:
theo-vt
2025-12-12 07:33:32 -05:00
committed by Chris Hennes
parent fc93004c89
commit 29eeab3624
3 changed files with 12 additions and 1 deletions

View File

@@ -9567,6 +9567,12 @@ bool SketchObject::arePointsCoincident(int GeoId1, PointPos PosId1, int GeoId2,
return false;
}
bool SketchObject::hasBlockConstraint() const
{
return std::ranges::any_of(Constraints.getValues(), [](auto& c) {
return c->Type == Block;
});
}
void SketchObject::getConstraintIndices(int GeoId, std::vector<int>& constraintList)
{

View File

@@ -648,6 +648,9 @@ public:
);
bool arePointsCoincident(int GeoId1, PointPos PosId1, int GeoId2, PointPos PosId2);
// Returns true if the sketch has 1 or more block constraint
bool hasBlockConstraint() const;
/// returns a list of indices of all constraints involving given GeoId
void getConstraintIndices(int GeoId, std::vector<int>& constraintList);

View File

@@ -418,10 +418,12 @@ void EditDatumDialog::performAutoScale(double newDatum)
// if there are external geometries, it is safe to assume that the sketch
// was drawn with these geometries as scale references (use <= 2 because
// the sketch axis are considered as external geometries)
// if the sketch has blocked geometries, it is considered a scale indicator
// and autoscale is not performed either
if ((autoScaleMode == static_cast<int>(SketcherGui::AutoScaleMode::Always)
|| (autoScaleMode == static_cast<int>(SketcherGui::AutoScaleMode::WhenNoScaleFeatureIsVisible)
&& !hasVisualFeature(sketch, nullptr, Gui::Application::Instance->activeDocument())))
&& sketch->getExternalGeometryCount() <= 2) {
&& sketch->getExternalGeometryCount() <= 2 && !sketch->hasBlockConstraint()) {
try {
// Handle the case where multiple datum constraints are present but only one is scale
// defining e.g. a bunch of angle constraints and a single length constraint