Commit Graph

721 Commits

Author SHA1 Message Date
PaddleStroke
fc82d71c15 Sketcher: Fix symmetry of slot redundancy false positive (#26604)
* Sketcher: Fix symmetry of slot redundancy false positive

Perturb symmetric geometries when using the 'create symmetric constraints' option to avoid numerical singularities in the solver (Jacobian Rank).
If geometry is "perfect", the solver cannot distinguish between the derivative of a Symmetry constraint and an Equal constraint, flagging one as redundant.
2026-01-13 13:48:41 -06:00
Saksham Malhotra
db8c90b788 Fix sketch redundancy warning (#26064) 2026-01-08 07:53:26 +00:00
Leandro Heck
d0c7ab7d62 Sketcher: Support Bezier and Offset curves as external geometry (#25144)
* Sketcher: Support Bezier and Offset curves as external geometry

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

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

* Sketcher: Fix adding projection of external arc of circle

In processEdge() it's checked if first and last point of the projected arc of circle are almost equal. If yes then a full circle
is assumed but this conclusion is not necessarily correct because it's still possible that the external arc of circle is very
short. The better criterion is to check the parameter range of the arc of circle.

See also: https://github.com/FreeCAD/FreeCAD/pull/25144#issuecomment-3502916685

---------

Co-authored-by: wwmayer <wmayer@freecad.org>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-01-07 09:23:28 +01:00
pre-commit-ci[bot]
c19eb5c0e0 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-01-06 01:40:39 +00:00
Ajinkya Dahale
9791d3f6d5 Sketcher: Override clang-format for some readability
See https://github.com/FreeCAD/FreeCAD/pull/22951#discussion_r2314544159.
2026-01-06 07:08:17 +05:30
Ajinkya Dahale
e9469d93cc [Sketcher] Use replaceGeometries() in join() 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
50a091c0ca [Sketcher] Use auto where possible 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
c02969da9c [Sketcher] Refactor SketchObject::updateGeometryRefs() 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
9993cc123c [Sketcher] Refactor SketchObject::onChanged()
Break into pieces depending on which property has been passed.
2026-01-06 05:59:10 +05:30
Ajinkya Dahale
e34d6604d7 [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
abc3c74abd [Sketcher] Refactor SketchObject::validateExpression() 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
585ce5ec03 [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
169a10c7d2 [Sketcher] Refactor some if-else statements in SketchObject 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
0c2f4df8d5 [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
78cdd8d59d [Sketcher] Refactor delExternalPrivate() 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
0ea4c7c280 [Sketcher] Move some checks to Constraint 2026-01-06 05:59:10 +05:30
Ajinkya Dahale
38a0443195 [Sketcher] Use range-for loop where straightforward 2026-01-06 05:59:04 +05:30
Ajinkya Dahale
db5ffb4769 [Sketcher] Refactor SketchObject::addCopy()
if and for rearrangement for readability.
2026-01-06 05:42:44 +05:30
Ajinkya Dahale
43a257a1cb [Sketcher] Refactor SketchObject some more 2026-01-06 05:42:44 +05:30
Ajinkya Dahale
8e46e74ee5 [Sketcher] Refactor based on loops and extraction into functions
May contain some untested changes
2026-01-06 05:42:44 +05:30
Ajinkya Dahale
a16be08159 [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
ca97889e47 [Sketcher] Refactor SketchObject:validateExternalLinks() 2026-01-06 05:42:44 +05:30
Ajinkya Dahale
404482f48e [Sketcher] Fix issue in replaceGeometries when more old than new 2026-01-06 05:42:44 +05:30
ᴩʜᴏɴᴇᴅʀᴏɪᴅ
670da3d796 SPDX [ 41 ][ Src / Mod / Sketcher ] (#25135) 2025-12-25 12:00:22 -06:00
marbocub
176ef6da4e 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
16032ae34c 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
29eeab3624 Sketcher: Do not autoscale if there are blocked geometries 2025-12-15 09:20:20 -06:00
Ajinkya Dahale
0800791a0f Sketcher: Only transfer angle to relevant segment on trim etc. 2025-12-12 11:23:00 +05:30
Ajinkya Dahale
78e5729520 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
a49d106807 Sketcher: Fix errors message when selecting circle seam point. (#25953) 2025-12-05 07:17:30 +00:00
PaddleStroke
6ddb0165ff Sketcher: fix new external always construction (#25733) 2025-12-01 21:49:24 -06:00
PaddleStroke
74aafcee75 Sketcher: External Face: decide between defining and construction (#25390) 2025-11-24 10:47:12 -06:00
theo-vt
15d9e14851 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]
25c3ba7338 All: Reformat according to new standard 2025-11-11 13:49:01 +01:00
Ajinkya Dahale
857190a20a 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
62c222c211 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
331e51cdfc 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
c6c084f22c 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
ef670e7880 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
46ec53f4da 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
7640a03cc8 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
fa2e5cd5fe Sketcher: Use the right delete flag for delConstraints 2025-09-17 16:42:40 -05:00
theo-vt
eab485656f 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
1c67ab7be2 Fix segfault where DatumLine does not have a refSubSHape 2025-08-19 11:54:32 +02:00
Johannes Wüller
3321b13218 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
29da89febd Sketcher: Clean up some old commented out code 2025-07-25 19:12:30 -05:00
Chris Hennes
3679a2adca Sketcher: Extract "processFace" function
Tool-aided refactor, no functional changes.
2025-07-25 10:08:29 -05:00
Chris Hennes
403056fa20 Sketcher: Resolve "Declaration hides variable"
Reduce some code duplication via helper method.
2025-07-25 09:48:34 -05:00
Chris Hennes
ab91372e28 Sketcher: Resolve "Type confusion" CodeQL critical warning 2025-07-25 09:21:43 -05:00
Ajinkya Dahale
114d3dcd87 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