Commit Graph

137 Commits

Author SHA1 Message Date
Abdullah Tahiri
e9cd316c60 Sketch: fix correct index in parameter dependency map for poles and knots 2020-12-20 19:27:29 +01:00
Abdullah Tahiri
04923686eb Sketcher: Sketch.cpp clean up old interface 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
0888c0dd64 Sketcher: Sketch.cpp - use SolverGeometryExtension as mechanism to convey dependent parameter information
=========================================================================================================

Former mechanism with hasDependentParameters is not flexible enough for the new kind of information.

This commit further enhances the calculation of dependent parameters and dependent parameter groups by
caching the parameter-geoelement (GeoId, PointPos) relationship during geometry creation.

This commit provides traditional information whether a parameter is dependent via SolverGeometryExtension. New
enhanced information about groups of dependent parameters are available via the Sketch API.
2020-12-19 11:58:54 +01:00
Abdullah Tahiri
573a850b99 Sketcher: Add ability to update a GeometryExtension of the solver 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
994bd9d92b Part/Sketcher - Construction Migration - step 3: Removal of Geometry construction data member
=============================================================================================

This commits removes the Geometry construction data member and adapts sketcher code to use
GeometryFacade to access construction information via the SketchGeometryExtension.
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
5a5e47560f Sketcher: Refactor for GCS magic numbers
========================================

- A small refactor to eliminate GCS magic numbers from Sketch.cpp.
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
f0d5d5739c Sketcher: Unit independent pole weight for B-Splines (Weight constraint)
========================================================================

Until now BSpline poles were circles relying on physical length units. This lead to several
problems:
- While the BSpline weight follows the circle size, weights do not have length units, but are adimensinal
- As representation of the BSpline depends on the physical size of the circle, the numerical value to be
  set to a pole circle differs from the numerical value of the weight.

The present commit:
1. Separates pole circle representation (physical size), from the numerical value used in the radius constraint,
so that the value in the constraint is the weight, the value representation is a factor of the weight value (in this
commit is getScaleFactor(), but this will change in the next commit). Dragging accounts for this scale factor too.
2. While Radius constraint button is used to constraint a B-Spline weight as before, this creates a Weight constraint,
which is a new type of constraint. This is done so that the value is truly adimensional and is so presented in all kind
of editors that rely on the units indicated by the constraint. It is obviously also shown as adimensional (thus without units),
in the 3D view and in the datum dialogs.
3. Because the circle of the pole of a B-Spline is not a geometric circle, but a graphical representation of the pole and how
it affects the corresponding B-Spline, constraint creation commands are limited so that no point on object, tangent, perpendicular
or SnellLaw constraints can be created on a B-Spline weight circle. This is also the case for the Diameter constraint, which won't
accept the circle. Equality constraints work either on only circles or only weights, but not on a mixture of them.

Bonus: This commit fixes a bug in master, that using the select equality constraint then click in two geometric elements mode, you
could make a circle equal to an ellipse resulting in malformed solver constraints.
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
2dc8743bbb Sketcher: Sketch solver interface using geometry state extension for BSpline knot checks
========================================================================================

Until this commit, B-Spline knots were stored, and checked at solver level as sketch points GeomPoints having the
construction status set to true.

This behaviour is removed to eventually enable normal non-construction points to define the shape out of edit mode.

This commit leverages the new mechanism for the solver interface.
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
1ff48ea432 Revert "Sketcher: Solver Interface - Treat length equality parameter as a driven parameter to enable redundant constraint reporting"
This reverts commit 34403fa31fa39ae4ac30732a2530e967be275940.
2020-11-27 18:30:39 +01:00
Abdullah Tahiri
89ac202e0e Sketcher: Solver Interface - Treat length equality parameter as a driven parameter to enable redundant constraint reporting 2020-11-27 14:31:54 +01:00
Abdullah Tahiri
00a1aa6225 Part: Geometry - encapsulate construction access 2020-10-25 03:52:51 +01:00
Abdullah Tahiri
4ed35140c0 Sketcher: Augment malformed constraint messages
===============================================

Enable a user recomputing an object/document to identify which sketch has the malformed constraints.
2020-07-02 19:54:15 +02:00
wmayer
184efc03bf Sketcher: [skip ci] fix -Wimplicit-fallthrough= 2020-06-10 13:09:58 +02:00
luz.paz
7008cf92de Sketcher: [skip ci] fix header uniformity
This PR fixes header uniformity across all Sketcher WB files
2019-12-22 01:00:29 +01:00
asapelkin
ced8100ab9 use emplace_back instead of push_back where justified 2019-11-21 14:48:09 +01:00
Abdullah Tahiri
3e72246e9f Sketcher: Solver interface of activated state 2019-06-22 08:26:31 +02:00
Abdullah Tahiri
893d7afccc Sketcher: PCH 2019-05-02 07:12:27 +02:00
Abdullah Tahiri
c5ff5d9d48 Sketch: Verbose to console output malformed constraints that are ignored by the solver 2019-04-24 17:56:37 +02:00
wmayer
174b7143ef PVS: V547 Expression is always true/false 2019-03-12 18:33:26 +01:00
Abdullah Tahiri
f053c13abf Fixes #3762 2019-02-15 19:08:44 +01:00
Abdullah Tahiri
563cbba250 Sketcher: fixes #3762 2019-01-12 17:26:19 +01:00
wmayer
21d01fe6fc Replace Base::Exception with appropriate subclass 2018-11-14 19:27:52 +01:00
Markus Lampert
e13c09235f Changed all catch types to references for polymorphic exceptions. 2018-08-08 15:45:30 +02:00
Abdullah Tahiri
b320f15909 Solver: Support for Diameter constraint 2018-07-30 00:47:20 +02:00
wmayer
5ff103615f fix -Wmaybe-uninitialized 2018-06-09 12:05:19 +02:00
wmayer
443dde8d6c fix const correctness 2018-05-31 12:49:23 +02:00
Abdullah Tahiri
040923fcef Solver: solver sketch level support for driven constraints and parameters
- Support for addition of driving information to GCS constraints
- Support for keeping track of value parameters of driven constraints
- Support for getting which QR algoritm is being used at GCS level
2018-05-31 11:40:16 +02:00
Abdullah Tahiri
f88daf23cc Solver: Solver Sketch level dependent parameters and solver geometric element management 2018-05-31 11:39:15 +02:00
Abdullah Tahiri
e97e616686 Sketcher: Fix crash on applying dimensional constraint to external element 2018-05-27 19:43:05 +02:00
wmayer
b780ba650f fix scan coverity issues 2018-02-10 14:29:49 +01:00
luz.paz
9ca8f2a3d2 Sketcher: comment typos
Found via `codespell`
[skip ci]
2018-01-25 18:47:34 -02:00
wmayer
c65585ccaf improve whitespace, fix const correctness 2018-01-23 00:40:41 +01:00
Abdullah Tahiri
46aa2c6356 Sketcher: Change nomenclature relating to Block constraint 2018-01-22 22:52:56 +01:00
Abdullah Tahiri
41fe55bda3 Sketcher: Block Constraint - Advanced redundant/conflict redundant handling
===========================================================================

Block constraint is naturally redundant/conflicting with almost any other constraint applied to an edge (certainly with constraints operating only on that element).

As such, a block constraint will have very little applicability in absence of a way to handle this redundancy/conflicting. For example, in the case of a BSpline all its
internal geometry (construction circles on poles and its constraints) would have to be removed before locking. This would mean that it is not possible to define the BSpline shape
and then block it, as when removing the internal geometry the shape would be lost. In other cases, like temporally blocking to avoid that a part of the sketch moves while performing some
operation with the idea of afterwards unblocking it, it would mean removing all constraints, to add the block constraint, then perform the action, then remove the block constraint and manually
constraint it again.

Handling this situation in a user expected way means ignoring certain constraints (those causing the redundancy/conflicting), so that the solver is not aware of them and does not complain. However,
generally ignoring those constraints has a negative effect, in that constraints applied by the user on already blocked geometry, or constraints that otherwise lead to a conflicting or redundant
situation as a consequence of actions (further constraining) after the Block constrain is applied are ignored, thereby not properly informing the user of this situation, which is undesirable.

This new mechanism takes account on the position of the constraints relative to the involved blocked constraint(s). As such, redundant/conflicting constraints that were added before the Block
constraint are ignored, whereas those constraints that lead to a redundant/conflicting situation and added AFTER the block constraint was already in place, those are not ignored and are reported
accordingly.
2018-01-22 22:52:56 +01:00
Abdullah Tahiri
7d2aab853e Sketcher: Blocked Constraint solver level 2018-01-22 22:52:56 +01:00
Abdullah Tahiri
e85da016fe Sketcher: Solver angle -pi,pi conversion corrected
fixes #3288
2018-01-01 20:28:53 +01:00
wmayer
125329f0bd simplify debugging of changing datum constraints 2017-12-31 11:48:44 +01:00
luzpaz
4eb5a431fa Sketcher: comment typos 2017-12-25 10:59:48 +01:00
Abdullah Tahiri
f2cca2e05a Sketcher Solver: Means to reset the initilization of movement
=============================================================

Just amazed it was working "so well" without never reseting to zero this.

It might bring advantages and close bugs... who knows!
2017-12-12 22:20:27 +01:00
Abdullah Tahiri
a309e417fc Sketcher: New Setting for improved dragging mode 2017-12-12 22:20:27 +01:00
Abdullah Tahiri
a014c1cbc1 Sketcher: Clean code and adapt previous solution only to non-relative cases
===========================================================================

Cleaning up ViewProviderSketch, as relative mode is never used for points.

Adapting the recalculation of the initial solution only to non-relative cases.

For relative movement cases (movePoint with relative=true) no cases where such a solution will be advantageous have been identified
and applying a similar solution involves changing the current behaviour too much, as to run the risk of introducing further bugs.

Decision to be revised if such cases where an advantage can be found are discovered.
2017-12-12 22:20:27 +01:00
Abdullah Tahiri
7b086ba8b2 Sketcher: jumping while dragging - force recalculate initial solution
=====================================================================

fixes #1734

Upon dragging, the initial solution is first calculated and them DogLeg is left with the work of solving for a solution next to the initial solution.

When the change is too big and the gradients are no longer accurate to continue dragging, the dragging flips and jumps.

The solution offered here is, not to update always the solution, as this also creates artifacts, but update it if the dragging goes beyond 20 times the initial dragging distance.

https://forum.freecadweb.org/viewtopic.php?f=3&t=7589#p203580

https://forum.freecadweb.org/viewtopic.php?f=3&t=7589#p203712
2017-12-12 22:20:27 +01:00
wmayer
9612c31572 fixes #0003176: Sketcher: always over-constrained when referencing external B-Spline 2017-12-02 13:02:42 +01:00
luzpaz
35ec477426 More typos, grammar fixes, uniformity 2017-11-15 10:46:43 -05:00
Abdullah Tahiri
968f01e206 Sketcher: Force solver to return non-driving angles in [-pi,pi] 2017-04-23 06:00:40 +02:00
Abdullah Tahiri
be09213bfb Sketcher: Fixes #3009 error with geompoints in sketcher
=======================================================

Introduction of construction points as fixed solver entities introduced this bug, as there was no specific code to check for points as they were by default construction.
2017-04-17 20:47:30 +02:00
wmayer
5f86aae9a5 fix scan coverity issues 2017-04-11 19:01:32 +02:00
wmayer
ca343c43ab fix scan coverity issues: unchecked dynamic_cast 2017-04-11 12:45:02 +02:00
wmayer
35884fd3c2 fix -Wsign-compare 2017-04-08 13:57:29 +02:00
Abdullah Tahiri
5072938482 Sketcher: OCC checks for knot functionality 2017-04-08 12:58:06 +02:00