Commit Graph

599 Commits

Author SHA1 Message Date
Ajinkya Dahale
909e5bfafb [Sketcher] Use replaceGeometries() in trim 2025-01-30 09:34:03 +01:00
Ajinkya Dahale
c8c8c2c208 [Sketcher] Move trim sub-steps to different functions 2025-01-30 09:34:03 +01:00
Ajinkya Dahale
77bb7ab2d4 [Sketcher] Move internal functions out of trim
Towards making it a function class or similar.
2025-01-30 09:34:03 +01:00
Benjamin Nauck
dd6aa9f3c7 Prefer to use BaseClass's isDerivedFrom<T> over non template or Base::Type's
Regex based changes, manually verified
2025-01-27 16:08:18 +01:00
Benjamin Nauck
ae15d98fd3 Use is<T>() when possible 2025-01-27 16:08:18 +01:00
Chris Hennes
666ede9019 Sketcher: Refactor C++20 code 2025-01-20 20:57:34 -06:00
Ajinkya Dahale
51cf34a596 [Sketcher] Refactor and fix an issue in transferConstraints 2025-01-16 15:56:22 +05:30
Ajinkya Dahale
73253bd2d4 [Sketcher] Fix issues in knot operations
For some reason this is not caught in the tests.
2025-01-16 15:56:22 +05:30
Ajinkya Dahale
aa1122c774 [Sketcher] Fix "used" B-spline poles being deleted 2025-01-16 15:56:22 +05:30
Ajinkya Dahale
821bc2ecdf [Sketcher] Incorporate review of #18665 by kadet
1. Replace `find_if` with `any_of` when the iterator is not used.
2. Use PascalCase for templated class.
2025-01-16 15:56:19 +05:30
Ajinkya Dahale
c6f5739763 [Sketcher] Refactor SketchObject::split
1. Now uses `Part::Geometry::createArc`.
2. Removed type-specific codes. It can be generalized now.
2025-01-16 15:55:14 +05:30
Ajinkya Dahale
e6becd0b61 [Sketcher] Further refactor modifyBSplineKnotMultiplicity 2025-01-16 15:55:14 +05:30
Ajinkya Dahale
12102abd6b [Sketcher] Incorporate review of #18665
...by hyarion on December 29.
2025-01-16 15:55:14 +05:30
Ajinkya Dahale
226d24792d [Sketcher] Fix some issues in trim
Fixes fails at cases where one (or both) of the remaining segments is (are)
degenerate. This existed pre-refactor.

Fixes cases where there are some constraints on internal geometry that do not
get deleted cleanly.

Also fixes a memory leak.
2025-01-16 15:55:14 +05:30
Ajinkya Dahale
e4f906c23b [Sketcher] Refactor SketchObject::trim
Cognitive complexity down to 57.
2025-01-16 15:55:14 +05:30
Ajinkya Dahale
3832db01ff [Sketcher] Refactor SketchObject::modifyBSplineKnotMultiplicity 2025-01-16 15:55:14 +05:30
Ajinkya Dahale
6ba1b0b7a9 [Sketcher] Refactor SketchObject::insertBSplineKnot() 2025-01-16 15:55:14 +05:30
Ajinkya Dahale
0ded3a4af1 [Sketcher] Refactor SketchObject::trim()
1. Use `Part::GeomCurve::createArc()`
2. Refactor constraint logic in `trim`
2025-01-16 15:55:14 +05:30
Ajinkya Dahale
5a01d438f2 [Sketcher] Refactor internal geometry operations
* Use range-for and rearrange for understandability.
* Break down into individual functions by geomtype.
* Also refactor `exposeInternalGeometryForType<Part::GeomBSplineCurve>`
* Use `Constraint::involves...()` in delete internal

Suppress clang-tidy/clazy warnings by using `[[maybe_unused]]`.

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2025-01-16 15:54:47 +05:30
Ajinkya Dahale
bc2b35da4e [Sketcher] Helper functions for deleting geometry
Some tests probably needed
2025-01-16 15:52:02 +05:30
Ajinkya Dahale
2249c99b33 [Sketcher] Write SketchObject::replaceGeometries() 2025-01-16 15:52:02 +05:30
Ajinkya Dahale
5c52353480 [Sketcher] Refactor SketchObject::join() (expected trivial)
No tests are added since this commit only adjusts if-then statements.
2025-01-16 15:52:02 +05:30
Ajinkya Dahale
5a4072587b [Sketcher] Some trivial for loop changes in SketchObject
No tests added since this should be no more different than existing code.
2025-01-16 15:52:02 +05:30
Jiří Pinkava
973ad7b5c8 Sketcher: clean-up geometry history configuation
Keep code almost 1:1 with LS3 branch, just ensure the variable is
initialized and code is documented
2024-12-16 12:07:40 -05:00
wmayer
ab5b53e972 Sketcher: Fix warning [-Wmaybe-uninitialized] 2024-12-10 12:32:41 -05:00
luzpaz
20d64a7f0f Fix various typos
Found via `codespell -q 3 -L aci,addmin,ake,aline,alle,alledges,alocation,als,ang,anid,anormal,aply,apoints,ba,beginn,behaviour,bloaded,bottome,brushin,bu,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childrens,childs,colour,colours,commen,connexion,currenty,documentin,dof,doubleclick,dum,eiter,elemente,ende,feld,finde,findf,findn,fle,freez,graphin,hist,iff,incrementin,indexin,indicies,initialisation,initialise,initialised,initialises,initialisiert,inout,ist,itsel,kilometre,leadin,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oce,oder,ontop,orgin,orginx,orginy,ot,pard,parm,parms,pres,programm,que,rady,recurrance,renderin,rin,ro,rougly,sectionin,seperator,serie,shs,sinc,siz,som,strack,substraction,te,technic,thist,thru,tread,tru,ue,uint,unter,uptodate,vas,vertexes,vew,wallthickness,whitespaces -S "./.git,*.po,*.ts,*.pdf,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml,./src/Base/StackWalker.cpp,./build/doc/SourceDoc,./tools/build/WindowsInstaller/lang,./src/Mod/TechDraw/Templates/locale"`
2024-12-10 15:09:51 +01:00
Syres916
74e7df9676 [Sketcher] [Post 1.0] Allow CarbonCopy to work with SketchObjectPython (#15594) 2024-12-09 11:31:04 -06:00
Chris Hennes
fde778faeb Merge pull request #18273 from Ondsel-Development/sk_group_drag
Sketcher: Group dragging
2024-12-09 12:29:49 -05:00
Chris Hennes
b87bdc1f84 Merge pull request #18126 from Ondsel-Development/core_LCS2
Core datums : Card2 : Core implementation
2024-12-06 12:12:04 -05:00
PaddleStroke
b92bda03da Sketcher: Rename movePoint to moveGeometries. 2024-12-06 16:45:47 +01:00
PaddleStroke
760091bc8a Sketcher: Fix first external geo deletion failure. 2024-12-05 15:23:25 +01:00
wmayer
c1a75bbafc Fix compiler warnings 2024-12-04 09:50:09 -05:00
PaddleStroke
70972b3926 Sketcher: Group dragging 2024-12-04 10:58:29 +01:00
Ajinkya Dahale
6c3d2eff64 [Sketcher] Use variable for frequently used static cast in trim 2024-12-04 00:57:41 +05:30
Ajinkya Dahale
b2c806d227 [Sketcher] Remove some commented code from SketchObject::trim()
...and replace with a TODO
2024-12-04 00:57:41 +05:30
Ajinkya Dahale
0b32db53ed [Sketcher] Use switch-case in getPointForGeometry()
Minor readability improvement.
2024-12-04 00:57:41 +05:30
Ajinkya Dahale
5262482bc4 [Sketcher] Refactor SketchObject::trim()
1. Use `Part::GeomCurve::createArc()`
2. Refactor constraint logic in `trim`
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
0d27efbc2f [Sketcher] Some trivial for loop changes in SketchObject 2024-12-04 00:57:40 +05:30
Ajinkya Dahale
7d8a8b7cc8 [Sketcher] Attempt to fix toponaming issue on trim refactor
TNP fix algorithm doesn't seem to like when edge with geoId 0 is deleted/made
construction after new geometry is added. Instead, we just ensure that one of
the newly added geometries becomes geoId 0 instead.

Making a `generateId(const Part::Geometry*)` was part of earlier attempts, but
still appears to remain relevant. This part can be reverted if necessary.
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
263331f6fb [Sketcher] Refactor SketchObject::trim()
DO NOT MERGE because not complete: not all constraints are not transferred.

Includes:

* Adjust `deriveConstraintsForPieces` for trim
* Make sure new points are constrained on the cutting edges
* Add constraints at trim end(s) dependent on pre-exisiting ones with cutting curve(s). Also change tests to reflect that auto-coincidence can now be applied to non-periodic curves as well.

Known issue(s):
* Some redundant constraints may be added under certain circumstances (e.g. in
presence of perpendicular-via-point)
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
c823a6b270 [Sketcher] Refactor SketchObject::split() 2024-12-04 00:57:40 +05:30
Ajinkya Dahale
b991c2fbc2 [Sketcher] Add tests for split and trim
Includes:
* Tests for splitting and trimming of various types of curves
* Assertions on constraints expected to be added on these curves
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
423fb77e1f [Sketcher] Refactor SketchObject::AutoLockTangencyAndPerpty() 2024-12-04 00:57:40 +05:30
Ajinkya Dahale
4cc21e26e1 [Sketcher] Refactor SketchObject::delGeometry()
Just dropped cognitive complexity to 25.
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
5f86d7f5a8 [Sketcher] Refactor SketchObject::getPoint()
...to reduce cognitive complexity.

Use templates to break longer functions. Also makes it possible to avoid
repetition of type-checking logic.
2024-12-04 00:57:39 +05:30
PaddleStroke
0e5e071d72 Sketcher: Intersection externals 2024-11-29 11:36:55 -05:00
PaddleStroke
f3c79302c4 Sketcher: Defining External geos. 2024-11-29 11:36:55 -05:00
PaddleStroke
1c514f5a15 External geos : Enable face selection 2024-11-29 11:36:55 -05:00
PaddleStroke
3c1358da10 Core: Rename 'OriginFeature' file to 'Datums' 2024-11-26 15:36:48 +01:00
PaddleStroke
89fcfe95ee Sketcher: Offset & tranforms: enable external geos input. (#17615)
* Sketcher: Offset & tranforms: enable external geos input.
* Sketcher: enable delGeometries to handle external geos.
2024-11-25 10:57:16 -06:00