Commit Graph

375 Commits

Author SHA1 Message Date
Abdullah Tahiri
00a1aa6225 Part: Geometry - encapsulate construction access 2020-10-25 03:52:51 +01:00
wmayer
b5d3ba129c Sketcher: [skip ci] fix crash when deleting a selected geometry directly with delGeometry() 2020-10-23 11:56:17 +02:00
wmayer
09c72214e8 Sketcher: [skip ci] remove AutoTransaction from ViewProviderSketch::mouseButtonPressed because it breaks the open/commit transaction logic 2020-10-22 19:35:31 +02:00
Neinei0k
b1afdc8f61 Sketcher: Merged constraint selection fix.
When the sketch is not in XY plane, individual constraints from the merged constraint icon can't be selected. Constraint icon coordinates are given in sketcher coordinates. The function getCoordsOnSketchPlane projects vector in global coordinates to the sketch plane. So, it makes no sense to use sketcher coordinates with it. If the sketch is in the XY plane, then the global coordinates are the same as sketcher coordinates. The solution is to get global coordinates of the icon from the sketcher coordinates and use it to project icon to the screen.
2020-10-22 13:52:31 +02:00
Neinei0k
061b6fb620 [Sketcher] Changes to drawing of constraint icons.
* Change the formula to calculate maximum distance for merging of constraint icons.
* Ignore z coordinate while calculating the distance between icons. It is irrelevant but can slightly differ between icons.
* Choose first icon from the group of nearby icons as a location of the composite icon, instead of choosing icon closest to the average position. Fixes jittering of the icon while one of the constraints is moved.
2020-10-15 10:09:30 +02:00
Neinei0k
2d939f2751 [Sketcher] Fix merged constraint preselection bug
Constraint icons that located close to each other get merged into a single icon. If you zoom in, individual constraints on these icons can't be selected anymore because their relative positions, which must depend on the zoom, don't change. The problem is solved by multiplying relative position by the scale factor which depends on the magnification.
2020-10-12 16:22:56 +02:00
vocx-fc
273e6a30ae Sketcher: small style changes to make the lines shorter 2020-10-01 09:59:26 +02:00
Syres916
50d531061b [Sketcher] Improve Solver Message Visibility...
...when using dark(er) style sheets.
See discussion https://forum.freecadweb.org/viewtopic.php?f=3&t=50094
2020-09-13 12:52:28 +02:00
wmayer
aa1afb5221 Part: [skip ci] move grid handling from ViewProvider2DObject to ViewProvider2DObjectGrid 2020-08-07 17:11:02 +02:00
wmayer
1d9a59e499 Part: [skip ci] move grid handling from ViewProvider2DObject to ViewProvider2DObjectGrid 2020-08-07 16:48:07 +02:00
0penBrain
4840d60ef2 [GUI/Sketcher] Add option to disable grid auto-sizing based on shape boundbox
Sketcher makes use of this option to self-manage the overall grid size
2020-08-07 13:30:42 +02:00
wmayer
f37c728a2c Coverity: Division or modulo by float zero 2020-07-20 17:34:26 +02:00
wmayer
46a7a68064 PVS: V1046 Unsafe usage of the 'bool' and 'int' types together in the operation '&='. 2020-07-18 10:59:28 +02:00
wmayer
4807fd3b33 PVS: V730 Not all members of a class are initialized inside the constructor 2020-07-18 10:59:27 +02:00
Abdullah Tahiri
5119513488 Sketcher: ViewProviderSketch inhibit update if internal transaction is ongoing
==============================================================================

Inhibit ViewProviderSketch updateData with invalid data (internal transaction).

Trigger update internally for internal transactions in SketchObject via touched()
so as to trigger updateData.

This leads to a reduction of updateData calls.
2020-07-01 14:04:25 +02:00
wmayer
d6169d6478 boost: fix for boost < 1.60 2020-06-15 19:38:39 +02:00
wmayer
b9e79be0a7 Sketcher: [skip ci] add security checks before accessing pointer 2020-06-14 16:23:16 +02:00
Abdullah Tahiri
ee9eb741b4 Sketcher: ViewProviderSketch delay updateData on undo/redo transactions
=======================================================================

On App:Document::undo, applchn is called on every transactional object (e.g. properties) affected, which
calls Paste on the property.

Each of the properties of SketchObject cause a call to SketchObject::OnChanged, and App::DocumentObject::OnChanged, the latter
calling onChangeProperty, which signals the viewprovider from Gui::Document::slotChangedObject via ViewProviderSketch::updateData.

This causes that the ViewProvider is updated when Constraints and Geometry indexes are not matching.

The solution proposed has three parts:
1. First, at ViewProvider::updateData update is prevented while undo/redo transaction is performed by checking isPerformingTransaction()
2. Second, the onUndoRedoFinished() mechanism of SketchObject causes the call of updateData when it solves the sketch (and sets the solved geometry)
3. Third, Gui::Document::signalUndoDocument and Gui::Document::signalRedoDocument (via the slots in ViewProviderSketch) are
used to perform the recompute of the ViewProvider when the undo/redo transaction is finished if needed.
2020-06-14 14:44:28 +02:00
wmayer
8dbe26a95f Qt5: 'int QFontMetrics::width' is deprecated since Qt 5.11: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] 2020-06-12 17:51:33 +02:00
wmayer
730154a684 boost 1.73.0: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated 2020-06-12 17:51:33 +02:00
Abdullah Tahiri
ef51a169e3 Sketcher: Make setposition text unpickable
==========================================

fixes #4272

The setposition text string was being picked interfering with preselection of autoconstraints.

Merit for the solution goes to Werner:
https://forum.freecadweb.org/viewtopic.php?f=10&t=47092&p=404519#p404519
2020-06-01 19:56:01 +02:00
Abdullah Tahiri
b32821d2f2 Sketcher: ViewProvider Grid control
===================================

Encapsulation of grid internals in ViewProviderObject2D, while allowing control via property changes and protected functions.
2020-05-27 19:25:47 +02:00
0penBrain
bcf451bac8 [Sketcher] Grid is displayed in 3D view only if sketch is visible 2020-05-27 19:25:47 +02:00
0penBrain
fe04d47b4c [Sketcher] Local settings are correctly restored ; fixes #3952,#4058 2020-05-27 19:25:47 +02:00
0penBrain
b094ca2ed4 [Sketcher] Grid snapping is enabled only if grid is shown 2020-05-27 19:25:47 +02:00
0penBrain
fece0f2dfc [Sketcher] Move general settings widget enable/disable logic in TaskSketcherGeneral so ...
... all options are freely accessible in the preferences editor ...
 ... eg. no need to check 'Show Grid' to customize grid size or snap
 Also remove the sparse automatical saving to preferences from sketcher Task pane ...
 ... (some settings were saved, some not)
2020-05-27 19:25:47 +02:00
Abdullah Tahiri
b8e41e99e3 Sketcher: Root point selected when endpoint in external geometry point
======================================================================

fixes #3831

Solver Interface getPointId method is only intended for normal geometry, and returns -1 if geoid is out of range, which was misinterpreted as root point selection.
2020-05-26 14:14:00 +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
Zheng, Lei
e4978be7a4 App: add new convenient class SubObjectT
Derived from App::DocumentObjectT to add support of sub object

Also some minor changes to App::DocumentObjectT

Changed Gui::SelectionChanges to make use of SubObjectT
2020-02-11 15:40:27 -05:00
wmayer
e1b3ec41b6 Sketcher: add option to disable leaving sketch with Esc button 2020-02-09 13:52:09 +01:00
wmayer
7064ebc581 Sketcher: [skip ci] explicit command to stop current operation
Fore more details: https://forum.freecadweb.org/viewtopic.php?f=3&t=42207
2020-02-06 15:55:00 +01:00
triplus
5eb1ca4308 Sketcher - improve text readability on dark themes
https://forum.freecadweb.org/viewtopic.php?f=34&t=40493
2020-01-27 10:08:07 +01:00
wmayer
13b6961943 Sketcher: [skip ci] force redraw after using rubberband selection 2019-12-27 21:18:27 +01:00
wmayer
c16c7eda27 Base: [skip ci] make UnitSystem an enum class 2019-12-21 10:10:19 +01:00
asapelkin
ced8100ab9 use emplace_back instead of push_back where justified 2019-11-21 14:48:09 +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
169eacf1ab fix crash when switching to fullscreen, back to normal and closing the sketcher 2019-09-30 23:55:11 +02:00
wmayer
b1dd1e61a7 force strict ISO C++ (-Wpedantic)
for Fem, Import, PartDesign, Robot, Sketcher, TechDraw
2019-09-18 14:18:07 +02:00
DeepSOIC
b5ff5ca388 fix Show-related imports 2019-09-14 12:17:01 +02:00
DeepSOIC
4dad9f32ab Sketcher: try fix crash when returning to PartDesign 2019-09-09 12:34:55 +02:00
wmayer
b14cf8a00d extend convertTo function to also support SbRotation/Base::Rotation 2019-09-06 21:29:51 +02:00
DeepSOIC
2b4182e281 Sketcher: fix unnecessary filtering objects for TempoVis
TempoVis now should take care of it.

This was originally done to stop Drawing and TechDraw views pop up when closing a sketch the drawing depends on.
Now, TempoVis show_xxx and hide_xxx methods should auto filter out objects that are not in 3d view.
2019-09-04 11:37:48 -03:00
DeepSOIC
ec7c18bef3 Gui: add tags for TempoVis
Tags can be used to identify TV instances in the stack.  This is mostly for add-ons, for Part-o-magic in particular, who may want to insert some visibility automation in specific places in the stack.
2019-09-04 11:37:48 -03:00
DeepSOIC
d33c7b724c Sketcher: add property to allow another workbench for sketch editing
+ use TempoVis for changing the workbench
2019-09-04 11:37:48 -03:00
luz.paz
7af7c10cf1 Fix misc. typos, whitespace, and http:// to https:// issues 2019-09-03 11:11:43 -03:00
Zheng, Lei
7128cf7989 Sketcher: fix lost of constraint in undo/redo 2019-08-30 14:57:41 +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