Commit Graph

214 Commits

Author SHA1 Message Date
Abdullah Tahiri
b7f9cbaf8b Sketcher: Fix equality constraint command
=========================================

For select constraint then click elements mode.

Fixes:
https://forum.freecadweb.org/viewtopic.php?f=10&t=51716&p=458207#p457974
2020-12-16 15:21:21 +01:00
Abdullah Tahiri
40a2e52bc0 Sketcher: Fix crash on applying angle constraint on arc
=======================================================

The GeoId passed was Constraint::GeoUndef (-2000).

Fixes:
https://forum.freecadweb.org/viewtopic.php?f=10&t=51716&p=458202#p458160
2020-12-16 14:20:02 +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
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
Chris Hennes
4daf73c61a Release handler in commands where not needed
Fixes #0004478: Active constraint tool blocks sidebar tasks from working.

Many commands are interrupted by the existence of a handler. Rather than having these commands silently cancel, purge the handler if a command executes that does not need it.

When right-clicking on an item in the Constraint Task sidebar, any current operation is cancelled and the FreeCAD selection is synced with the selected items in the constraints QListWidget. This allows all of the menu items in the context menu to function properly: if the selection is not synced, anything that relies on the FreeCAD selection (like Delete) will sillently fail.
2020-11-07 20:17:19 +01:00
luz paz
fc1085d4dc Issue #4473: Expose openCommand() CommandConstraints.cpp to translation
`Sketcher/Gui/CommandConstraints.cpp` will now be parsed for translation. Based on https://github.com/FreeCAD/FreeCAD/pull/3993#issuecomment-715906238  
( ref. Issue #4473 )
2020-11-03 15:15:16 +01:00
Abdullah Tahiri
00a1aa6225 Part: Geometry - encapsulate construction access 2020-10-25 03:52:51 +01:00
Neinei0k
1a9dcdb3db Sketcher: Fix ticket #4399
The reason for this behaviour is that root point (origin) and axes are not treated as fixed geometry. Every external geometry has negative ID which is at most GeoEnum::RefExt defined as -3 in the file src/Mod/Sketcher/App/SketchObject.cpp. Ids of root point and axes are also defined in this file with id -1 for root point and horizontal axis, and -2 for vertical axis. To fix the problem, GeoEnum::RefExt id was replaced by root point id in the condition checking for the largest id of fixed geometry.
2020-10-25 02:27:06 +01:00
luz paz
a305b3b53f Sketcher: Capitalize opeCommand() text [skip-ci] 2020-10-24 12:26:35 +02:00
luz paz
8068a5307a Sketcher: Fix typos [skip-ci] 2020-10-24 12:26:35 +02:00
0penBrain
d13235c960 [Sketcher] Allow selection of 2 vertices for horizontal/vertical constraint in continuous mode
Fixes #4444
2020-10-21 17:22:53 +02:00
vocx-fc
273e6a30ae Sketcher: small style changes to make the lines shorter 2020-10-01 09:59:26 +02:00
vocx-fc
ec0acf44f1 Sketcher: rename constraint icons to be more consistent with the rest
`Sketcher_ConstrainBlock` to `Constraint_Block`.
`Sketcher_ConstrainLock` to `Constraint_Lock`, and the corresponding
`_Driven` variant.

Adjust the icons in the taskpanel for the sketcher constraints,
elements, and for the action menu for constraints.

Adjust the icon order in the `Sketcher.qrc` resource file.
2020-10-01 09:59:26 +02:00
wmayer
2b49d60ac5 Sketcher: [skip ci] fix build failure 2020-10-01 08:10:28 +02:00
John Yani
893fd13b99 HiDPI: Hot point scaling is only required for X11 2020-09-30 22:31:43 +02:00
Vanuan
65e66c9e62 High DPI support: Convert sketcher cursors to SVG
Remove xpm
2020-08-19 19:59:13 +02:00
Abdullah Tahiri
3e1746d373 Sketcher: Fix for failure of constraint substitution
====================================================

fixes #4105

When a constraint substitution is present, a solve must precede any call to the redundant removal to update the solver information.
2020-05-29 14:19:42 +02:00
Abdullah Tahiri
057d8798bb Sketcher: Fixing Driving constraint apparent redundancy
=======================================================

When adding a reference constraint of type radius or diameter to an external geometry using the method of select the
continuous mode method (select tool first, click geometry afterwards), with ActiveUpdate checked, there was a missing
solving to bring the solver information in line with the Driven constraint.

fixes #4054
2020-05-28 19:10:22 +02:00
0penBrain
47c0edfc04 [Sketcher] Harmonize points selection order for symmetry constraint ; fixes #3746 2020-05-03 08:11:47 +02:00
wmayer
ed04d40e2b Sketcher: modify PR 3201 a bit
+ remove unneeded class members from EditData class
+ do not include ui-header from within header files
+ fix possible memory leak in EditDatumDialog
+ when canceling dialog make sure sketch will be updated
2020-03-19 13:45:52 +01:00
0penBrain
d520de1aba [Sketcher] Constraint driving/driven status integration in dimension edition dialog
This integrates the ability to manage dimensional constraint driving/driven status
 in the constraint edition dialog box.
 It adds a checkbox in the dialog to show/select whether a constraint is driving or
 driven. When the constraint value is modified, it is automatically set as driving.
 Main focus is to allow to edit name (alias) of reference (driven) constraints
 directly in the constraint edition box.

 Resolves #3793, #3978
2020-03-19 13:45:52 +01:00
dulouie
134c841e08 Sketcher: fix contraints cmd crosshair color 2020-03-16 09:34:21 +01: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
wmayer
d488218701 [skip ci] fix more -Wgnu-zero-variadic-macro-arguments 2019-11-17 19:11:08 +01:00
luz.paz
044213d6ad Source typo fix (includes file rename) 2019-10-05 13:19:32 -04:00
luz.paz
fb32601746 Fix various (doxy) typos and whitespace issues
Found via `codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,currenty,dof,doubleclick,dum,eiter,elemente,feld,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./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`
2019-10-03 07:57:13 +02:00
wmayer
b1dd1e61a7 force strict ISO C++ (-Wpedantic)
for Fem, Import, PartDesign, Robot, Sketcher, TechDraw
2019-09-18 14:18:07 +02:00
wmayer
190d351a20 fix crash in polyline tool 2019-09-15 11:03:21 +02:00
Zheng, Lei
0f66755843 Sketcher: fix external editing 2019-08-17 15:32:50 +02:00
Zheng, Lei
d4ac072306 Gui: support in-place editing
The link support means that an object can now appear in more than one
places, and even inside a document different from its own. This patch
adds support for in-place editing, meaning that the object can be edited
at correct place regardless where it is.

See [here](https://git.io/fjPIk) for more info about the relavent APIs.

This patch includes two example of modifications to support in-place
editing. One is the ViewProviderDragger, which simply adds the dragger
node to editing root node by calling
View3DInventorViewer::setupEditingRoot(dragger). The other much more
complex one is ViewProviderSketch which calls setupEditingRoot(0) to
transfer all its children node into editing root. ViewProviderSketch
also includes various modifications to command invocation, because we
can no longer assume the active document is the owner of the editing
object.

This patch also includes necessary modification of the 'Show' module to
support in-place editing.
2019-08-17 15:08:32 +02:00
Abdullah Tahiri
34402cbe90 Sketcher: fixes no horizontal/vertical on segment after horizontal/vertical alignment
=====================================================================================

Selecting first the horizontal/vertical constraint and applying to a line segment with
a previous horizontal/vertical alignment constraint caused FreeCAD to refuse applying it.

fixes #4013
2019-06-22 09:58:42 +02:00
Abdullah Tahiri
a571376584 Sketcher: GUI command to activate/deactivate constraints 2019-06-22 08:26:31 +02:00
Abdullah Tahiri
22f34a53a9 Complete parameter comments 2019-03-14 23:46:46 +01:00
Abdullah Tahiri
434ad220cf Correct paramter comments 2019-03-14 23:46:45 +01:00
Abdullah Tahiri
1b64c1458b PVS Fix 2019-03-14 23:46:45 +01:00
triplus
92efd5fbe9 Improved icon themes support 2019-02-13 10:42:46 -02:00
luz.paz
4154f5dce5 Crowdin: cont... 2019-02-11 16:22:13 +01:00
luz.paz
334cd86e89 Crwodin: Sketcher/Gui/CommandConstraints.cpp s/root/origin/ 2019-01-30 11:08:03 -02:00
luz.paz
566a17985e Crowdin: Sketcher/Gui/CommandConstraints.cpp grammar fix 2019-01-30 11:08:03 -02:00
luz.paz
fc061528e3 Crowdin: Sketcher/Gui/CommandConstraints.cpp 2019-01-30 11:08:03 -02:00
Yorik van Havre
47f98403f3 Fixed wording as notifed on crowdin 2018-12-31 16:21:49 -02:00
Abdullah Tahiri
b784285d20 Sketcher: Tangency between arcofellipse and other curves
========================================================

Surprisingly there was no code to handle arcofellipse tangencies using AngleViaPoint constraint.

fixes #3659
2018-12-20 11:59:26 -02:00
wmayer
21d01fe6fc Replace Base::Exception with appropriate subclass 2018-11-14 19:27:52 +01:00
Abdullah Tahiri
da890f2863 Sketcher: Allow driven constraints when autoredundancy removal and autorecomputes active
==========================================================================================

https://forum.freecadweb.org/viewtopic.php?f=3&t=31998#p266626
2018-11-04 14:46:37 -03:00
Abdullah Tahiri
21f2e79021 Sketcher: Refactor code relating to dimensional constraint checks 2018-11-04 14:41:20 -03:00
wmayer
7d681a2979 0003544: Crash on creation of vertical dimension with Shift + V 2018-10-04 18:37:33 +02:00
Abdullah Tahiri
bb7e038a5a Sketcher: Correct checking of compatible equality geometry
=========================================================

Before this commit equality line to circle is allowed although the solver can not process it.

Similar happens for several combinations of incompatible edges.
2018-09-29 18:18:42 +02:00
Abdullah Tahiri
54a20d5ff9 Sketcher: No equality to be applied to external axes
fixes #3532
2018-09-29 18:18:02 +02:00
Abdullah Tahiri
779b4f641d Sketcher: Automatic redundant removal mechanism
===============================================

It is a long felt need that redundant constraints are not generated while autoconstraining.

The solver sketcher in v0.17 is überpicky with redundants due to the new popularity contest algorithm. The former behaviour is exhacerbated.

This new mode enables automatic redundant constraint removal.

In UI operations IN EDIT MODE, upon detection of redundancy by the solver, the Sketcher will remove all redundant constraints detected by that solve.

This makes the sketcher much less annoying.

How to test this?

The easiest example is to create a vertical line. Then make the endpoints symmetric with respect to the horizontal axis. Without this mode,
the vertical constraint and the symmetry constraint are redundant. With this mode, the vertical constraint gets automatically removed by the Sketcher.
2018-08-26 20:54:01 +02:00
luz.paz
9c2e9884e2 More typos 2018-08-18 21:48:43 +02:00