Commit Graph

476 Commits

Author SHA1 Message Date
wmayer
78ffa29629 Sketcher: expose the LabelDistance and LabelPosition members of Constraint to Python 2024-02-25 00:10:56 +01:00
Ajinkya Dahale
cf3e0c1b4a [Sketcher] Expose general tangency with B-splines to Sketcher
The following commits were squashed into this

[Sketcher] Handle some corner cases in AngleViaPoint

[Sketcher] Avoid redundant constraints with B-splines...

When involving tangent, perpendicular and angle constraints.

[Sketcher] Add pre-commit changes

[Sketcher] Do not allow 2-selection tangent with B-spline

Also...

[Sketcher] Report error when using direct tangency with B-splines

[Sketcher] Fix malformed constraint when B-spline is selected second

To clarify, this means the second curve selected. The position of the point in
selection order does not matter in angle-via-point.

[Sketcher] Fix wrong number for B-Spline tangent on redundancy

[Sketcher] Remove existing point-on-object in some redundant cases

Particularly when point constrained on a B-spline is being used for
tangent, perpendicular or angle via point with the same B-spline.

[Sketcher] Fix direction issue with B-spline tangents.

Without these changes the solver might try to "twist" the B-spline to make the
angle between curves be 0 instead of PI (which may be closer to the initial shape).
2024-02-08 20:04:28 +05:30
Florian Foinant-Willig
7343bf940b Sketcher: Extend distance constraint to arcs 2023-12-17 16:01:29 +01:00
Paddle
bf54c1f1ca When moving an angle, we did not take into account the case where they are reversed. This fixes that. 2023-11-24 15:07:30 +01:00
Florian Foinant-Willig
c0e8fa1e75 Sketcher: modernize type checking 2023-10-23 18:09:23 +02:00
Abdullah Tahiri
ead8a9a5d1 Sketcher: Example new type checking template function usage
===========================================================

Just two small refactor examples of how to use the type checking template functions.
2023-10-07 23:12:46 +02:00
howie-j
12f80320fc [Sketcher] Fix angle constraint expression regression (#10743)
* fix 10742

* moved expression string modifier to helper function

* Tests: Add example tests for SketchObject

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

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

* made expr modifier func static, pass by value and added unit tests

---------

Co-authored-by: Chris Hennes <chennes@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-25 10:44:31 -05:00
wmayer
b2d255e5fc Sketch: fix a few minor issues:
* fix compiler warning about unused variable
* fix const correctness
* fix access type of setExpression()
* removed duplicated method
2023-09-19 22:01:19 +02:00
Paddle
3c275de11d Implement a function in sketchObject that swap an angle constraint to its supplementary. 2023-09-19 07:22:50 +02:00
Paddle
2c2a977e04 Add setter/getter for constraint expression. 2023-09-19 07:22:50 +02:00
luzpaz
3518ace910 Fix typos 2023-09-14 20:53:04 -05:00
wmayer
948cbfccd9 modernize C++: avoid bind
In many cases std::bind() is kept because the code is much simpler
2023-08-08 21:10:16 +02:00
wmayer
52e1c7c33b modernize C++: move from boost::bind to std::bind 2023-08-08 17:36:13 +02:00
Ajinkya Dahale
a52bc93da0 [Sketcher] Create SketchObject::buildShape()
Needs changes in TopoShape and creation of ExternalGeometryFacade.

Also contains the squashed ticket:

[Sketcher] Hide unimplemented code

These will eventually be implemented in phase 3 of toponaming.

[Sketcher] Implement trivial `checkSubName` to appease Windows

[Sketcher] Modify `GeoEnum` usage
2023-07-21 22:43:45 -05:00
Abdullah Tahiri
0f14065d0a Sketcher: App - Clang-format 2023-05-20 07:55:05 +02:00
luzpaz
38a01939e0 Migrate domain name from freecadweb to freecad (#9352)
* Migrate domain name from freecadweb to freecad
* Migrate src/Mod/Material files
* Migrate Stylesheet related files
* Migrate *.svg files
* Migrate miscellaneous files
* Migrate some build files
* Migrate recently added TD AR_IRAM template files

Closes #6415
2023-04-24 15:19:20 -05:00
Ajinkya Dahale
d14daed442 [Sketcher] Constrain first pole weight in exposeInternalGeometry
This commit is part of a project funded by the Open Toolchain Foundation under the title "Open Toolchain Foundation - Curve drawing tool in Sketcher Workbench"
2023-03-24 16:30:48 +01:00
Abdullah Tahiri
aca75815dc Sketcher: SketchObject using the new notification system
========================================================

- CriticalMessage old signal is reconverted to new notification system. This enables to remove the obsolete old system.

- An example of how common errors can be provided with translation support is added, so that App notifications appear
translated in the NotificationArea.
2023-03-12 06:06:29 +01:00
luzpaz
593ab90400 Sketcher: convert indentations to spaces 2023-01-23 15:46:49 +01:00
Ajinkya Dahale
fe90c2e9ca [Sketcher] Do not filter out point-on-B-spline when trimming
Fixes #7770.

Until Point-on-B-spline is actually merged this will result in a malformed
constraint. It will however still allow a trim of the B-spline to result in a
coincident constraint.
2023-01-21 21:42:57 +01:00
Abdullah Tahiri
04a7478afb Sketcher: Do not mark as fully constrained sketches that do not converge
=======================================================================

In uncommon situations, the analysis of QR decomposition leads to full rank, but the result does not converge.

We avoid marking a sketch as fully constrained when no convergence is achieved.
2023-01-09 17:11:14 +01:00
Abdullah Tahiri
8a3b3537b3 Sketcher: Avoid trying to lock tangency for tangency at knot point constraint 2022-12-24 18:22:16 -06:00
Ajinkya Dahale
75f2a1d69a [Sketcher] Use tangent at B-spline knot constraint
Also squashes:

[Sketcher] Make tangent-at-knot with just knot and line

[Sketcher] Disallow tangent at C0 knot

If passed on to planegcs can cause segmentation fault.

[Sketcher] (Re-)Support tangent at B-spline end-knots

New code had introduced problems for non-periodic spline end-points, and
periodic spline "end-points" were not supported anyway.

(here end-points mean star/end points)
2022-12-24 18:22:16 -06:00
Abdullah Tahiri
fdb2e1ad01 Sketcher: Split - remove unnecessary return after exception 2022-12-21 16:01:23 +01:00
Ajinkya Dahale
ce08cebc1f [Sketcher] Handle split curve corner case
It is possible to ask for splitting at an end point of the curve. This leads to
a `CADKernelError` and leaves us with a "hanging" clone. This check prevents that.
2022-12-21 16:01:23 +01:00
Abdullah Tahiri
7d9b24f2b7 Sketcher: Split functionality fixes
===================================

Changes from naked pointers to smart pointers are motivated to the use of functions that can reasonably throw under certain circumnstances (such as trim).

When introducing smart pointers, it is not necessary to explicitly delete the new geometry array at the end of the function.

When using the new facility to add a smart pointer geometry (previous commit), the copies generated in the split algorithm can be reused, which renders
keeping track of the new geometry for memory management unnecessary.

As geometry is added to the property which each call to addGeometry, the stored newIds can be reused if access is necessary to geometry pointers afterwards
(e.g. for constraint management).
2022-12-21 16:01:23 +01:00
Abdullah Tahiri
e5e508c326 Sketcher: SketchObject new addGeometry method for smart pointers
================================================================

This new facility avoids to have to create a new copy() when a user copy is already created.

As the user copy is reused via move semantics, memory management is simplified.

CAVEAT: When this facility is used, the client code has to ensure whether a copy() or a clone() of the Part::Geometry
should be undertaken. The different between both is that the former creates a new uuid (tag), whereas the latter does not.
2022-12-21 16:01:23 +01:00
Ajinkya Dahale
3c11d09c15 [Sketcher] Refactor SketchObject::split() for code reuse
This provides some manageability with increasing supported curves.
2022-12-21 16:01:23 +01:00
Ajinkya Dahale
d82fe9e34c [Sketcher] Support splitting ellipses 2022-12-21 16:01:23 +01:00
Ajinkya Dahale
19f9c94389 [Sketcher] Support splitting arcs of conics
This commit also squashes:

[Sketcher] Remove redundant geometry type check

(Arc of) a circle is (an arc of) a conic.
2022-12-21 16:01:23 +01:00
Ajinkya Dahale
947d34f01d [Sketcher] Support splitting arcs of ellipses 2022-12-21 16:01:23 +01:00
Ajinkya Dahale
3716a15dd7 [Sketcher] Support splitting b-splines 2022-12-21 16:01:23 +01:00
Abdullah Tahiri
dda2d4761e Sketcher: Use new critical message mechanism to notify parabola migration
=========================================================================

A migrated parabola cannot be openned with a previous version of FreeCAD. The user is notified upfront.
2022-12-21 16:01:23 +01:00
Abdullah Tahiri
727140ab04 Sketcher: Automatic migration of parabola axis to internal geometry 2022-12-21 16:01:23 +01:00
Abdullah Tahiri
93c26a6c63 Sketcher: Make parabola axis to be internal alignment 2022-12-21 16:01:23 +01:00
Uwe
365d968ae8 [Sketch] App P - End: remove unused headers
- also some sorting
2022-12-11 22:36:00 +01:00
Ajinkya Dahale
54db25968d [Sketcher] Convert curves to splines before joining 2022-12-04 08:17:20 +01:00
Ajinkya Dahale
01866dfbfc [Sketcher] Add methods and tools for joining curves
Algorithm to join b-splines:
The code simple concatenates the knots, poles, weights, and knot multiplicities
together, removing data on the connection point of the second curve. Some
further study is needed to see if/when it will give an exact/good connection.

Icon courtesy @bitacovir.
2022-12-04 08:17:20 +01:00
Adrian Insaurralde Avalos
6e69f58bb9 [fixes #5965] CarbonCopy: if existing use constraint name in expressions 2022-12-02 10:47:26 +01:00
0penBrain
8a574f5a51 Sketcher: Clone: do not apply parallel constraint if angle constraint is applied on arc 2022-11-18 08:18:58 +01:00
Ajinkya Dahale
f75bd1eed7 [Sketcher] Do not make knots construction points 2022-11-16 15:35:37 +01:00
Ajinkya Dahale
c624d40476 [Sketcher] Allow driving constraint on construction geometry
Fixes issue #7442.

Also, the following commits are squashed into this one:

[Sketcher] Remove unnecessary variables

[Sketcher] Use `setDriving` within `toggleDriving`

Suggestion courtesy @0penbrain.

[Sketcher] Remove redundant check: `SketchObject::testDrivingChange`

`GeoEnum::GeoUndef = -2000` so checking if it's `< 0` is redundant.
2022-10-16 11:20:15 +02:00
Ajinkya Dahale
1b2ffdc5f6 [Sketcher] Fix Typo in comment
threated -> treated
2022-09-14 00:34:57 -05:00
berniev
f4ffd15864 Mod: redundant void 2 2022-08-08 10:27:50 +02:00
berniev
53ba98d636 Mod: use empty 2022-08-06 19:30:13 +02:00
Uwe
140e89e858 Mod: remove some more superfluous Boolean checks 2022-07-19 02:40:59 +02:00
Uwe
763a575b23 Mod: remove some unnecessary nullptr checks 2022-07-18 12:58:12 +02:00
Uwe
0399b3f087 [Sketch] remove superfluous nullptr checks 2022-07-18 02:51:49 +02:00
Abdullah Tahiri
b0492010d0 Sketcher: SketchObject - Add ability to diagnose constraint redundancy before addition
======================================================================================

It preserves the SketchObject properties. Therefore it does not trigger any property update, redraws, ...
2022-06-28 18:58:15 +02:00
Abdullah Tahiri
d6fcce96b1 Sketcher: Fix warning not all enum handled in switch 2022-06-26 06:39:10 +02:00