Commit Graph

1795 Commits

Author SHA1 Message Date
Abdullah Tahiri
ba5bc449cd Sketcher: Remove unnecesary header 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
82a4f676fa GCS: clean up old interface 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
3d361b1caa Sketcher: Sketch.cpp clean up old interface 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
d5e7f0ad81 Sketcher: Bring new colors to preferences 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
b1db237270 Sketcher: ViewProviderSketch - Show constrained elements in new color
=====================================================================

Provide different colors for full constrained edge, construction edge, internal alignment element and construction vertex.

This should enable users to select what they want in their specific situation.
2020-12-19 11:58:54 +01:00
Abdullah Tahiri
994101e086 Sketcher: ViewProviderSketch - fix BSpline pole dragging based on SolverGeometryExtension 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
fdc4df0202 Sketcher: rewrite Cmd to select DoFs using SolverGeometryExtensions framework 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
cb68fa4fb8 Sketcher: rewrite SketchObject getGeometryWithDependentParameters to use SolverGeometryExtension 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
87699ea18d 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
603a232349 Sketcher: new SolverGeometryExtension to store solver information within the geometry 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
1cc9533392 Sketcher: Add ability to update a GeometryExtension of the solver 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
621a9a0e98 GCS: Set SparseQR conditional compilation guards 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
e0a814bfc7 GCS: Change asynchronous launch policy to default to avoid having to take care of exceptions on oversubscription
================================================================================================================

std:async can take two policies one that forces the task to be run in parallel another (deferred) that runs the task
when wait is called on the future (kind of lazy evaluation).

Default policy is let the system decide (an or of both policies). Nobody is a better position than the system to know
its load and whether it is possible to run the task in parallel or not.

If the system cannot allocate a thread and parallel processing is enforced (as before this commit), then it will throw an
exception. In the present case we would catch it and run the task sequencially. Thus, it makes sense to let the system
decide from the beginning and save the exception and the handling.

In tests I have only managed to see it run in parallel with the default policy.
2020-12-19 11:58:54 +01:00
Abdullah Tahiri
28415f53d4 GCS: renaming parameters to make them more descriptive 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
7f006e2c75 GCS: Augment information provided by GCS with groups of dependent parameters 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
270b0cbc33 GCS: Interface to query whether the used diagnose matrix is empty
=================================================================

Diagnose constraints do not include among others driven constraints. This
function allows to know whether the solver is considering an empty matrix.
2020-12-19 11:58:54 +01:00
Abdullah Tahiri
996f006de3 GCS: Deactivate Debug code and fix warnings in non-Debug mode 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
b2fd91c333 GCS: Asynchronous full geometry parameter identification for Dense QR 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
5e2a2cbbbb GCS: Make QR decompositions for constraints and parameters run asynchronously 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
9f2d34ac4b GCS: QR profiling debug code 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
ac7f6b8ceb GCS: Rewrite diagnose() so that it has a single return point 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
474d5550cf GCS: Diagnose() - Separate DenseQR and SparseQR 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
c635b4b954 GCS: Refactor new SparseQR Dependent Parameter detection code and const correctness 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
2d37d7194a GCS: Detect dependent parameters (geometry) during diagnosis using two SparseQR factorisations 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
982591b0d4 GCS: makeSparseQRDecomposition generalise for transposed and non-transposed matrices 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
820b02b295 GCS: SparseQR compilation guards 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
0f9af72f25 GCS: reduce input parameters in makeDenseQRDecomposition 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
dd4b29333a GCS: Refactor Non-Zero elimination over pivot 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
ed5af06d14 GCS: Refactor diagnose identification of conflicting and redundant constraints 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
a5927e1a61 GCS: Refactor dependent parameters identification which is only available for DenseQR 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
25d94d00cb GCS: Refactor QR decomposition into separate functions for Sparse and Dense 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
d9bca3e8c1 GCS: Increase documentation of diagnose() routine 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
ad549d49e1 Sketcher: ViewProviderSketch update of geometry extensions
==========================================================

The order of any operation, including setedit is first solve() and then draw().

This is consistent with geometry addition.

If ViewProviderSketch must insert its own extensions, for example for scaling
weights, then it is its responsibility to set this information wherever needed.
This includes the temporal geometry vector used in draw(true), the solver to
enable dragging operations, and SketchObject Geometry property.
2020-12-19 11:58:54 +01:00
Abdullah Tahiri
985f3510f5 Sketcher: Fix crash when creating an angle constrain on a line segment
======================================================================

Most of these crashes come from previous code not checking for Constraint::GeoUndef.

Most of these crashes come from isBSpline(), any of the two overloads.

isBSpline is made to throw exception when null, which should prevent the crash while
creating a reportable error.
2020-12-19 11:58:54 +01:00
Abdullah Tahiri
70f85505d0 Sketcher: delete internal alignment geometry using new delGeometries function 2020-12-19 11:58:54 +01:00
Abdullah Tahiri
6c6f5e7fbf Sketch: Fix exception on redraw
===============================

Fixes:
https://forum.freecadweb.org/viewtopic.php?p=458293#p458293

Rationale:
In order to fix B-Spline pole dragging, the order was inverted.
This fixed the B-Spline pole dragging issue, but introduced a
draw before solve approach that is not consistent with the rest
of the Sketcher.

In my parallel development I had already identified this inconsistency,
switched the order, and provided a new mechanism to fix the issue with
the B-Spline pole dragging. This will be merged as part of another PR.

In the meantime, this PR restores the intended behaviour, and let us
identify if the particular reported exception also happens in other
situations.
2020-12-16 19:35:42 +01:00
Abdullah Tahiri
51189caba4 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
e8674fc13d 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
wmayer
a152cd2d96 Py: [skip ci] replace PyList_Append with Py::List::append 2020-12-13 16:44:14 +01:00
Abdullah Tahiri
512d5c6141 Sketcher: Ensure that ViewProvider Geometry extensions is correctly initialised 2020-12-12 16:18:57 +01:00
Abdullah Tahiri
3f6fed377b Sketcher: refactor unnecessary dir/angle conversion 2020-12-12 16:18:57 +01:00
Abdullah Tahiri
c2108911d6 Sketcher: ViewProvider fix Weight length when dragging
https://forum.freecadweb.org/viewtopic.php?f=10&t=51716&sid=d469aaf654946813912b9419f4fc529f&start=60#p456814
2020-12-12 16:18:57 +01:00
luz paz
cb58706e80 Fix various typos [skip ci]
Found via `codespell v2.1.dev0`  
```
codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,apoints,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,connexion,currenty,dof,doubleclick,dum,eiter,elemente,ende,feld,finde,findf,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
```
2020-12-12 08:07:47 +01:00
wmayer
4a8fac9147 Part: [skip ci] fix memory leaks
+ add convenience function GeometryExtension::copyPyObject()
+ make sure to destroy the clone when leaving getGeometry()
2020-12-11 12:05:28 +01:00
Chris Hennes
ea3ecf4054 Silence Qt/Windows setGeometry Warning
Add the optional Qt::MSWindowsFixedSizeDialogHint parameter to all uses of the QInputDialog::getX static functions to silence a Qt/Windows debug mode warning about QWindowsWindow::setGeometry: Unable to set geometry. Increase the size of the unit calculator to eliminate the same warning. Finally, call adjustSize() on the "Unsaved Changes" dialog to silence the warning.
2020-12-11 09:58:09 +01:00
Abdullah Tahiri
9add3ba199 Sketcher/Part: Python handling of GeometryExtensions without a Python counterpart
=================================================================================

Some geometry extensions do not provide a PyObject as they do not have a Python counterpart
as it would serve no purpose to have it.

This commit handles this situation making sure to provide the right error to Python
or to ignore the extension where appropriate.
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
40c0f0aa01 Sketcher: refactor onDocumentRestored() 2020-12-10 18:34:06 +01:00
Abdullah Tahiri
f33aab5f5e Sketcher: Reduce ViewProviderUpdates when deleting Internal Alignment Geometry
==============================================================================

Deletion of a geometry having internal alignment geometry (B-Spline, Ellipse, ...)
involves calling a geometry deletion operation for each internal aligment constraint
in addition to the one of the geometry.

Before this commit, an update call was performed for each of these operations. Now,
there is a single update trigger operation after all the geometries are deleted.
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
4aa91f0f26 Sketcher: SketchGeometryExtension - Do not store ID
===================================================

Currently the ID is a unique number without an specific use and it is
conceived to be taken over by future RT's Sketcher PRs.

Because of this, and not to interfere with RT's implementation, it is
not stored, but will be restored if attribute available.

Unrelated:
Similarly, ExternalGeometryExtension is also there conceived for RT's
future sketcher PRs, but it is not used.
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
2c0faabb6f Sketcher: GeometryFacade - Remove Debuging code 2020-12-10 18:34:06 +01:00