Commit Graph

2207 Commits

Author SHA1 Message Date
Ajinkya Dahale
c596c2fe3d [Sketcher] Constrain first pole when created
By doing this, duplicate radius constraints are not made when deleting and
redefining second pole.
2022-03-09 16:43:47 +01:00
Ajinkya Dahale
0f093f4221 [Sketcher] Safeguard against spurious pre-selection
Preselection is sometimes not updated under some circumstances
1. when deleting an object through python;
2. before autoconstraint when deleting previous pole in bspline creation mode.

When the preselected curve is the deleted object, segfault/crash can happen.
2022-03-09 16:43:47 +01:00
Ajinkya Dahale
1d9dd035e7 [Sketcher] Redraw correctly on pole delete in "create b-spline"
This ensures that the last preview line drawn is always at the cursor and that
the coordinates are always w.r.t. the last defined pole.
2022-03-09 16:43:47 +01:00
Uwe
9654786c67 [Gui] Quarter: remove unused includes 2022-03-09 01:12:15 +01:00
wmayer
6193fc9cdb Sketch: [skip ci] fix linking error with MSVC
For more details see: https://forum.freecadweb.org/viewtopic.php?f=10&t=66939
2022-03-09 01:11:15 +01:00
Uwe
bda12907de [Gui] rename the Qt header list 2022-03-07 20:35:38 +01:00
wmayer
1ca7429705 Gui: Optimize includes to reduce compile time 2022-03-07 20:29:18 +01:00
Yorik van Havre
7653a9473d Merged crowdin translations 2022-03-07 14:55:22 +01:00
Ajinkya Dahale
c7546287d2 [Sketcher] Check for b-spline before starting knot insertion "mode"
The DrawSketchHandler will otherwise give confusing error messages.
2022-03-07 14:27:28 +01:00
Ajinkya Dahale
6eedd0f9c5 [Sketcher] Remove "incomplete" from insert knot command
I had kept the qualifier there when developing the tool and forgot to remove it. At this time the tool is fairly well-developed.
2022-03-06 16:25:08 +01:00
Ajinkya Dahale
47a040537b [Sketcher] Allow deleting last knot during B-Spline creation 2022-03-06 16:14:07 +01:00
Ajinkya Dahale
00ef0e0504 [Sketcher] Reduce duplicate code in DrawSketchHandlerBSpline 2022-03-06 16:14:07 +01:00
wmayer
95c70e7f4c App: use forward declarations 2022-03-04 21:09:46 +01:00
wmayer
4ae1ca58d1 App: use forward declaration to reduce compile time 2022-03-04 17:27:53 +01:00
Abdullah Tahiri
464ae1f6b0 Sketcher: Clean up old crosshair code
====================================

- Remove old unconnected code
- Move member functions to correct cpp file
2022-03-04 06:26:46 +01:00
Abdullah Tahiri
2562c80c9b Sketcher: GeoElementId VAxis fix - windows 2022-03-02 15:00:40 +01:00
Abdullah Tahiri
919de5a233 Sketcher: Fix GeoElementId VAxis 2022-03-02 07:54:24 +01:00
Abdullah Tahiri
2add401282 Sketcher: GeoElementId - isCurve and PosIdAsInt members 2022-03-02 07:53:07 +01:00
mosfet80
e3d51eb3aa Update SketchObject.cpp
Initialize variable
2022-03-01 17:42:23 +01:00
0penBrain
c036128aa0 Sketch: Fix algorithm seeking for missing coincidences in Validate 2022-02-28 14:52:55 +01:00
wmayer
6e4c61881b Sketch: [skip ci] add unit test to detect missing point-on-point constraints 2022-02-28 14:50:35 +01:00
Ajinkya Dahale
15281aed86 [Sketcher] Allow setting B-Spline degree at creation 2022-02-27 16:48:23 +01:00
Ajinkya Dahale
f90a987cac [Sketcher] Create internal geometry after converting to NURBS
The control points are needed to edit the converted B-Spline
2022-02-25 18:45:12 +01:00
Ajinkya Dahale
690a7b4ab9 [Sketcher] Correct NURB to NURBS
The S in NURBS stands for Spline
2022-02-25 18:22:01 +01:00
wmayer
86c91d71a1 Sketcher: fix crash in function 'Convert to B-Spline'
See also the forum thread: https://forum.freecadweb.org/viewtopic.php?f=19&t=66470
2022-02-24 12:54:11 +01:00
Ajinkya Dahale
3e7830c21b [Sketcher] Allow multiplicity change of B-Spline end knots
The first and last knots (which are often also poles) of a B-Spline are not
represented in sketcher as knots, but as end points of the curve. This creates a
problem when we want to change the multiplicities of those knots. As a
workaround, these points are treated differently.

NOTE: While it is technically possible to have end knots in a non-periodic
spline with degree <= degree of the curve, `Geom_BSplineCurve::RemoveKnot()`
fails for the first and last knots, so we are stuck with this. So, this commit
effectively only makes knot multiplicity change possible for periodic splines.
For non-periodic splines this commit just changes the confusing "no knot is
selected" message to an unhelpful "multiplicity modification failed".
2022-02-19 16:10:43 +01:00
Ajinkya Dahale
e8f7a58fc9 [Sketcher] Fix some strings in CommandConstraints.cpp 2022-02-19 16:10:43 +01:00
Ajinkya Dahale
3960325821 [Sketcher] Use knot insertion pointer when using that tool
Icon courtesy @bitacovir, adapted from https://forum.freecadweb.org/viewtopic.php?f=34&t=66262&p=572480#p572471.
2022-02-18 16:05:54 +01:00
Ajinkya Dahale
c912d5002f [Sketcher] Use point-and-click for knot insertion
Here, point and click means we can move the cursor around and select a point on
the curve, instead of having to enter a value in a dialog (just like we do for
geometry creation and constraints). Continuous mode is also supported, but these
only apply to one B-Spline which should selected before pressing the tool button.

A `DrawSketchHandlerBSplineInsertKnot` is created to handle all the graphical aspects.

Finer control may be desirable but that awaits tool settings task box or similar
changes where keyboard input can be used.

Made some changes as per comments by @abdullahtahiriyo. Also change `activated`
to follow recent NVI changes.
2022-02-18 16:05:54 +01:00
Uwe
5a3b1c4ebe [Sketch] ViewProviderSketch: add missing include 2022-02-18 03:27:53 +01:00
Uwe
87d293f404 [Sketch] ViewProviderSketch: remove unused includes
- also sort the includes
2022-02-18 03:15:27 +01:00
wmayer
c5dfa7fa01 Sketcher: fix warnings:
* fix -Winconsistent-missing-override
* fix -Woverloaded-virtual that is also a bug because the DrawSketchHandlerArcOfParabola didn't set the suitable mouse cursor
2022-02-17 21:14:37 +01:00
Abdullah Tahiri
d8c052c666 DrawSketchHandler: activation and deactivation via NVI pattern
==============================================================

With the introduction of overridable default behaviour for commands, it makes sense to keep control of the execution path of the activation and deactivation.

Non-virtual interface pattern enforces execution control of the virtual functions, while allowing the behaviour to be overriden in a case by case basis.
2022-02-17 19:37:48 +01:00
wmayer
c3511ba2f0 Sketch: make sure that Attachment editor shows up in the context-menu 2022-02-17 19:27:11 +01:00
0penBrain
3b1d8fd918 [Sketcher] Fix typo 2022-02-17 16:17:04 +01:00
0penBrain
a360829e9b [Sketcher] Disable constraint selectability on Shift press 2022-02-17 16:17:04 +01:00
0penBrain
34106f49e7 [Sketcher] Disable constraints selection when geometry/constraint handler is active 2022-02-17 16:17:04 +01:00
wmayer
6e012520d9 Sketcher: for Linux systems put definition of GeoElementId members back to header file to fix possible linker errors 2022-02-15 22:01:51 +01:00
0penBrain
30daaa66bc Sketcher: add GeoID on extended naming of geometries 2022-02-15 14:02:07 +01:00
0penBrain
6037553f3c Sketcher: add construction mode display for points in element list 2022-02-15 14:02:07 +01:00
Ajinkya Dahale
8888489aed [Sketcher] Add comment suggesting future segfault fixes
Apparently B-Spline knot insertion is challenging the sketcher update process
and spurious GUI updates sometimes occur in the intermediate step after the
knot is inserted but before the internal geometries are re-defined. This set of
comments points to a previous fix and related discussion as a suggestion.
2022-02-15 13:44:02 +01:00
Ajinkya Dahale
82edb612ad [Sketcher] Check constraint type before drawing icons
Change is in `EditModeConstraintCoinManager::drawConstraintIcon` on the lines of 247a9f0876.
2022-02-15 13:44:02 +01:00
Ajinkya Dahale
4ad0bdc5b2 [Sketcher] Reformat statements in EditModeConstraintCoinManager.cpp 2022-02-15 13:44:02 +01:00
wmayer
5e5e69013b Sketcher: fix linking errors with Conda builds 2022-02-14 12:41:07 +01:00
Yorik van Havre
19b89b1085 Merged crowdin translations 2022-02-14 12:31:57 +01:00
Ajinkya Dahale
4e0498c48e [Sketcher] Use proper formatting for knot list in dialog 2022-02-12 11:00:39 +01:00
Ajinkya Dahale
d53eabed07 [Sketcher] Make B-Spline curvature comb piecewise
This allows for better display of discontinuity in curvature and tangent
information.
2022-02-12 11:00:39 +01:00
wmayer
2e48c62c37 Sketcher: [skip ci] fix build failure with Qt 5.9 2022-02-09 17:45:24 +01:00
Ajinkya Dahale
588331515d [Sketcher] Fix some points mentioned in #6323
Knot insertions dialog uses decimal precision from preferences.

Sets the spinbox step for knot insertion dialog such that it goes from min to
max knot in 1000 steps.

Removes the mention of multiplicity option from the tooltip.
2022-02-09 13:53:46 +01:00
Abdullah Tahiri
faf60a5ed4 Sketcher: remove extra semicolon 2022-02-06 07:02:25 +01:00