Sketcher: Sketch autoscale (#21084)
* Working scale prototype * Call viewAll to fit geometries in the viewport post-scaling * Exclude angle dimensions * Scale the viewport rather than calling viewAll * Scale dimension annotation along geometries * Early return when counting more than one dimensional constraint * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Disable sketch autoscale if there are external geometries in the sketch * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add a setting to disable the feature _ and eventually parametrize * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Check for objects in the viewport in the sketch's ancestry to decide wheter or not to autoscale * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * More consistent camera scaling * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Check for visual indicator in the whole document * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Find visible items in nested assemblies * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Check visual elements in assemblies nested in assemblies * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Set the dimension even if the scaling fails * Allow constraints that interact with the origin axis/root * Remove unused variable * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Misc fixes from review * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -886,6 +886,13 @@ int SketchObject::setDatum(int ConstrId, double Datum)
|
||||
|
||||
return err;
|
||||
}
|
||||
double SketchObject::getDatum(int ConstrId) const
|
||||
{
|
||||
if (!this->Constraints[ConstrId]->isDimensional()) {
|
||||
return 0.0;
|
||||
}
|
||||
return this->Constraints[ConstrId]->getValue();
|
||||
}
|
||||
|
||||
int SketchObject::setDriving(int ConstrId, bool isdriving)
|
||||
{
|
||||
@@ -7596,6 +7603,22 @@ int SketchObject::getGeoIdFromCompleteGeometryIndex(int completeGeometryIndex) c
|
||||
else
|
||||
return (completeGeometryIndex - completeGeometryCount);
|
||||
}
|
||||
bool SketchObject::hasSingleScaleDefiningConstraint() const
|
||||
{
|
||||
const std::vector<Constraint*>& vals = this->Constraints.getValues();
|
||||
|
||||
bool foundOne = false;
|
||||
for (auto val : vals) {
|
||||
// An angle does not define scale
|
||||
if (val->isDimensional() && val->Type != Angle) {
|
||||
if (foundOne) {
|
||||
return false;
|
||||
}
|
||||
foundOne = true;
|
||||
}
|
||||
}
|
||||
return foundOne;
|
||||
}
|
||||
|
||||
std::unique_ptr<const GeometryFacade> SketchObject::getGeometryFacade(int GeoId) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user