Commit Graph

714 Commits

Author SHA1 Message Date
Ajinkya Dahale
4fb27ad758 [Sketcher] Refactor SketchObject::updateGeometryRefs() 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
8c5a2afce5 [Sketcher] Refactor SketchObject::onChanged()
Break into pieces depending on which property has been passed.
2026-01-06 05:59:10 +05:30
Ajinkya Dahale
5e67c91116 [Sketcher] Refactor removeAxesAlignment()
Use switch case for more readability, and move some if and for indentations
2026-01-06 05:59:10 +05:30
Ajinkya Dahale
0d1bf450e9 [Sketcher] Refactor SketchObject::validateExpression() 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
cd9e418549 [Sketcher] Refactor SketchObject::migrateSketch()
Manipulate some if-else statements, for loops, and possibly replace them with
std algorithms.
2026-01-06 05:59:10 +05:30
Ajinkya Dahale
973b7d778c [Sketcher] Refactor some if-else statements in SketchObject 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
f3616304d8 [Sketcher] Refactor addSymmetric and getSymmetric
Rearrange some if-else and use `std::find_if` instead of looping.

[Sketcher][WIP] Refactor `getSymmetric` and `addSymmetric`
2026-01-06 05:59:10 +05:30
Ajinkya Dahale
d31ddccd02 [Sketcher] Refactor delExternalPrivate() 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
b23d3736a7 [Sketcher] Move some checks to Constraint 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
ef8fe4d4d2 [Sketcher] Use range-for loop where straightforward 2026-01-06 05:59:04 +05:30
Ajinkya Dahale
f008424ef5 [Sketcher] Refactor SketchObject::addCopy()
if and for rearrangement for readability.
2026-01-06 05:42:44 +05:30
Ajinkya Dahale
6a3bbc195d [Sketcher] Refactor SketchObject some more 2026-01-06 05:42:44 +05:30
Ajinkya Dahale
45021f204a [Sketcher] Refactor based on loops and extraction into functions
May contain some untested changes
2026-01-06 05:42:44 +05:30
Ajinkya Dahale
a23197c3e9 [Sketcher] Refactor some loops for understandability
Changes include:
1. Modernize `for` loops with range whenever possible.
2. Flip `if` statements for a "flatter" flow.
3. Use internal functions for repeated identical tasks.
2026-01-06 05:42:44 +05:30
Ajinkya Dahale
287aeab832 [Sketcher] Refactor SketchObject:validateExternalLinks() 2026-01-06 05:42:44 +05:30
Ajinkya Dahale
0b812405a0 [Sketcher] Fix issue in replaceGeometries when more old than new 2026-01-06 05:42:44 +05:30
ᴩʜᴏɴᴇᴅʀᴏɪᴅ
d2c3486ff0 SPDX [ 41 ][ Src / Mod / Sketcher ] (#25135) 2025-12-25 12:00:22 -06:00
marbocub
b9e8370404 Sketcher: add reverse mapping correction to Carbon Copy (#25745)
* Sketcher: add reverse mapping correction to Carbon Copy

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Replace M_PI with std::numbers::pi

* Replace vector initialization with Base::Vector3d::UnitX/UnitY, apply suggestions from code review

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Fix guard clause logic, apply suggestions from code review

* Replace std::numbers::pi with pi via `using std::numbers`

* Fix issues reported by the linter

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kacper Donat <kadet1090@gmail.com>
2025-12-22 15:00:49 +01:00
Chris Hennes
3118469338 Merge pull request #25914 from AjinkyaDahale/sk-fix-25281
Sketcher: Handle angle constraint on sketchobject changes
2025-12-15 10:15:13 -06:00
theo-vt
e5946a624a Sketcher: Do not autoscale if there are blocked geometries 2025-12-15 09:20:20 -06:00
Ajinkya Dahale
d91bd7015a Sketcher: Only transfer angle to relevant segment on trim etc. 2025-12-12 11:23:00 +05:30
Ajinkya Dahale
f8aaeb2262 Sketcher: Handle angle constraint on sketchobject changes
Primarily trim, but also expected to affect split, extend etc.
2025-12-12 09:17:05 +05:30
PaddleStroke
7a75405249 Sketcher: Fix errors message when selecting circle seam point. (#25953) 2025-12-05 07:17:30 +00:00
PaddleStroke
018981eeec Sketcher: fix new external always construction (#25733) 2025-12-01 21:49:24 -06:00
PaddleStroke
fda6998b33 Sketcher: External Face: decide between defining and construction (#25390) 2025-11-24 10:47:12 -06:00
theo-vt
63c0ec02b9 Sketcher: Proceed to chamfer/fillet on a vertex if there are more than 2 lines but only two non-construction lines 2025-11-15 10:08:22 -06:00
pre-commit-ci[bot]
9fe130cd73 All: Reformat according to new standard 2025-11-11 13:49:01 +01:00
Ajinkya Dahale
971f1bd59b Sketcher: Only transfer equality in specific cases in trim
The transfer on should apply to (arcs of) conics.

Fixes #25008.
2025-11-05 12:48:05 -06:00
matthiasdanner
54c2470027 Sketcher: Fix Angle Constraint jumping to opposite side on movement (#24150)
* Sketcher: Fix Angle Constraint jumping to opposite side on movement

* implement way to dynamically disable snapping where not needed

---------

Co-authored-by: Matthias Danner <28687794+matthiasdanner@users.noreply.github.com>
2025-10-13 18:07:09 +02:00
PaddleStroke
a327c4a522 Sketcher: Fix toggle construction not undoable (#24539)
* Sketcher: Fix toggle construction not undoable

* [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>
2025-10-09 12:31:50 -05:00
theo-vt
5ab4080cf1 Sketcher: fix split breaking sketch (#23711)
* Sketcher: Scale: Reorder operations and delete original modified constraints to ensure validity

* Sketcher: replace boolean parameters for deletion with enum and expose solver override on some deletion functions in the python API

* Use correct flag in ::delGeometry

* Set default value of false to noSolve

* Sketcher: autoscale: use deleteAllGeometry

* Sketcher: Scale: revert to checking constraints for geoId validity and handle horizontal&vertical

* Sketcher.Split: Avoid early solve that can break sketch

* Avoid reintroducing a typo

* [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>
2025-09-23 12:00:36 -05:00
Markus Reitböck
45c02f7978 Sketcher: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
 should be considered an optimization, not a requirement. In particular, do not explicitly include a
 precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
 generated precompile header on the compiler command line instead. This is more portable across
 the major compilers and is likely to be easier to maintain. It will also avoid warnings being
 generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-23 00:51:00 +02:00
matthiasdanner
5f52aa5901 Fix "Show only Visible Constraints" option (#23187)
Co-authored-by: Matthias Danner <28687794+matthiasdanner@users.noreply.github.com>
2025-09-22 10:54:24 -05:00
Furgo
15adc6f2c8 Sketcher: improve Make Internals property tooltip (#23636)
* Sketcher: improve Make Internals property tooltip

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Sketcher: reword final MakeInternals tooltip

* Sketcher: apply final code review suggestion

Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>
2025-09-21 08:24:30 +00:00
theo-vt
22b2a7cd56 Sketcher: Use the right delete flag for delConstraints 2025-09-17 16:42:40 -05:00
theo-vt
57f4987ce3 Sketcher: fix invalid constraint on first dimension (#23024)
* Sketcher: Scale: Reorder operations and delete original modified constraints to ensure validity

* Sketcher: replace boolean parameters for deletion with enum and expose solver override on some deletion functions in the python API

* Use correct flag in ::delGeometry

* Set default value of false to noSolve

* Sketcher: autoscale: use deleteAllGeometry

* Sketcher: Scale: revert to checking constraints for geoId validity and handle horizontal&vertical
2025-09-07 18:03:15 +02:00
Valentin Rusu
fd1855268a Fix segfault where DatumLine does not have a refSubSHape 2025-08-19 11:54:32 +02:00
Johannes Wüller
1e42193ca6 Sketcher: Fix external geometry out-of-bounds vector access (#22181)
* Sketcher: Fix external geometry out-of-bounds vector access

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
Co-authored-by: Ajinkya Dahale <AjinkyaDahale@users.noreply.github.com>
Co-authored-by: Benjamin Bræstrup Sayoc <benj5378@outlook.com>
2025-07-29 18:36:17 +00:00
Chris Hennes
71a9a3af25 Sketcher: Clean up some old commented out code 2025-07-25 19:12:30 -05:00
Chris Hennes
359542df67 Sketcher: Extract "processFace" function
Tool-aided refactor, no functional changes.
2025-07-25 10:08:29 -05:00
Chris Hennes
06a8685990 Sketcher: Resolve "Declaration hides variable"
Reduce some code duplication via helper method.
2025-07-25 09:48:34 -05:00
Chris Hennes
70811ee630 Sketcher: Resolve "Type confusion" CodeQL critical warning 2025-07-25 09:21:43 -05:00
Ajinkya Dahale
1ff83fcf23 Sketcher: Improve constraint transfer in SketchObject::trim()
Provide new geos to `deriveConstraintsForPieces` manually, since they are
not (and likely cannot be at time of calling) added to the sketch. This will
make sure that the method has sufficient information to properly transfer/create
new constraints.
2025-07-19 03:25:38 +05:30
Ajinkya Dahale
095d905a86 Sketcher: Skip checks in deriveConstraintsForPieces when risky
Possibly fixes #22352.

It is possible to call the method when new geos are not yet created or added to
the sketch. In such cases, the values obtained can be "dirty", and is likely a
seg-fault.
2025-07-19 03:25:38 +05:30
theo-vt
41f539dbaf Sketcher: Only autoscale if the datum being edited is the scale defining datum (#22419) 2025-07-18 09:58:30 -05:00
theo-vt
076ea9b162 Sketcher: assign the old geometries' GeometryId[s] to new geometries after scaling (#22263)
* Reassign facade ids after scale operation if deleting geometries

* Fix failing CI
2025-07-14 17:39:03 +02:00
Fermín Olaiz
7fec747d90 Fix crash on out-of-bound vector access (#22397) 2025-07-09 19:07:11 +02:00
Max Wilfinger
36659f0176 Sketcher: Update UI strings for consistency (#22167)
* Sketcher: Update UI strings for consistency

* Update src/Mod/Sketcher/App/Sketch.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Update src/Mod/Sketcher/Gui/Command.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Update src/Mod/Sketcher/App/SketchObject.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Update src/Mod/Sketcher/Gui/Command.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Update src/Mod/Sketcher/Gui/Command.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Update src/Mod/Sketcher/Gui/Command.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Apply suggestions from code review

* Apply suggestions from code review

---------

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>
2025-06-30 22:51:46 +00:00
Chris Hennes
ec86e2a440 Sketcher: Remove redundant checks
Also cleanup missing curly braces.
2025-06-20 22:48:31 +02:00
Chris Hennes
bb1760546b Sketcher: Remove dead code 2025-06-20 22:41:59 +02:00