Commit Graph

1716 Commits

Author SHA1 Message Date
Abdullah Tahiri
858abd99ca Sketcher: GeometryTypedFacade and GeometryFacade convenience functions
======================================================================

GeometryFacade is added the ability to get the construction status via static function, for
convenience in situations where only the construction status is necessary and a geometry facade
would not be otherwise necessary.

A new type GeometryTypedFacade is added, for situations in which the specific Part::Geometry derived
type is known (or is to be created). This Typed version enables to directly access the Geometry derived
class without the need for casting, as well as the SketchGeometryExtension information.

For example, this is possible:

auto HLineF = GeometryTypedFacade<Part::GeomLineSegment>::getTypedFacade(HLine);
HLine->getTypedGeometry()->setPoints(Base::Vector3d(0,0,0),Base::Vector3d(1,0,0));

If a facade is requested without passing an Part::Geometry derived object, the constructor
of the indicated geometry type is called with any parameter passed as argument (emplace style):

auto HLine = GeometryTypedFacade<Part::GeomLineSegment>::getTypedFacade();
HLine->getTypedGeometry()->setPoints(Base::Vector3d(0,0,0),Base::Vector3d(1,0,0));
HLine->setConstruction(true);
ExternalGeo.push_back(HLine->getGeometry());

Using either GeometryFacade or GeometryTypedFacade is probably a matter of style and of the specific situation.
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
6b05767a0c Sketcher: ExternalGeometryExtension - refactor flag string to type in static function 2020-12-10 18:34:06 +01:00
luz paz
5effcc1983 Sketcher: Issue #0004473: Expose openCommand() to translation
Continuing the work to expose the undo/redo functionality to translation. This commit does so for the Sketcher Wb.  
Ticket: https://tracker.freecadweb.org/view.php?id=4473
2020-12-01 14:53:35 +01:00
Abdullah Tahiri
11c3de1bb1 Revert "Sketcher: Solver Interface - Treat length equality parameter as a driven parameter to enable redundant constraint reporting"
This reverts commit 056030b1d2.
2020-11-27 18:30:39 +01:00
Abdullah Tahiri
056030b1d2 Sketcher: Solver Interface - Treat length equality parameter as a driven parameter to enable redundant constraint reporting 2020-11-27 14:31:54 +01:00
wmayer
a50ae33557 Part/Sketcher: [skip ci] fix build failures with gcc 10 on Fedora
When using gcc 10 and PyCXX 7.1.4 on Fedora there is an error because the conversion from size_t to Py_ssize_t is ambiguous
See https://forum.freecadweb.org/viewtopic.php?f=4&t=52502

The class Py::Tuple is also incorrectly used here and causes a memory leak
2020-11-25 16:56:03 +01:00
wmayer
ed175c9f66 Sketcher: [skip ci] revert minimum size hint from widgets in datum dialog
because this leads to a squashed appearance on some systems.

For more details see: https://forum.freecadweb.org/viewtopic.php?f=34&t=52139
2020-11-15 11:07:19 +01:00
wmayer
b7f9e351c5 Win: [skip ci] check if NOMINMAX is already defined before setting it 2020-11-11 13:34:42 +01:00
Yorik van Havre
e76c857036 Merged crowdin translations 2020-11-10 14:58:06 +01:00
Yorik van Havre
f76eeddfcb Updated ts files 2020-11-10 14:47:48 +01:00
Abdullah Tahiri
485b0b58a0 Sketcher: GeometryFacade inheritance correctness
- Make explicit private inheritance of the interface
- Correct inheritance of ExternalGeometryFacade
- Correct inheritance of ExternalGeometryExtension
- Better document the inheritance choice
2020-11-10 13:35:11 +01:00
donovaly
08efd286df [Sketch] add missing menu entry for new feature 2020-11-09 16:12:27 +01:00
donovaly
9b5eb77480 [Sketch] remove now unused variable
also add comment for better understanding
2020-11-08 18:59:28 +01:00
Abdullah Tahiri
975c03a206 Sketcher: Some fixes to bspline weight information layer
- fix sign/unsign comparison warning
- show intent in for loop comparison, values inside the loop over size() are not intended and are undesirable
- do not use itw for an index, as it evokes an interator - it -
- BSpline Weight on information layer positioned one line under Knot multiplicity
2020-11-08 15:56:58 +01:00
donovaly
65c96a3b21 [Sketch] add option to display spline weights
When working with weights, it is a huge improvement to see the weights immediately when changing the pole circle radius.
This PR adds an option to display the weights.
2020-11-08 15:56:21 +01:00
Abdullah Tahiri
b8376e1529 Sketcher: Fix select associated constraints when drawhandler active 2020-11-07 20:18:14 +01:00
Chris Hennes
c23e1dd7ba 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
wmayer
db537b8f90 Sketcher: [skip ci] use delGeometries to delete all superfluous geometry in one go after changing multiplicity 2020-11-05 15:19:39 +01:00
wmayer
9801b36e73 Sketcher: [skip ci] add method SketchObject::delGeometries 2020-11-05 12:37:07 +01:00
wmayer
a5b338630f Sketcher: [skip ci] minor optimization in SketchObject::delGeometry 2020-11-05 10:04:42 +01:00
luz paz
ff5f3799d8 Fix various typos [skip-ci]
Found via `codespell v2.0.dev`  
```
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,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-11-04 10:18:30 +01:00
luz paz
396695240f 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
709c0b546f Sketcher: Documentation editorial change 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
b0bc4b5dc6 Sketcher: Improve documentation of SketchGeometryFacade and ExternalGeometryFacade 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
79b192978e Sketcher: Restrict ability to create empty GeometryFacade and ExternalGeometryFacade objects to Python 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
7dcac46229 Sketcher: Facade for geometry and external geometry extension 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
4a166e0a50 Sketcher: Change GeometryFacadePy representation 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
93dee6ccd7 Sketcher: Separate ExternalGeometryExtension interface from class 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
10102f45f7 Sketcher: Utility functions to simplify common operations with GeometryFacade 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
284c4d93f7 Sketcher: Extend SketchObject Python Interface to get/set SketchGeometryExtension GeometryId (convenience interface) 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
0fd808dfc1 Sketcher: Geometry Facade interface for Geometry and SketchGeometryExtension 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
7bfec92bdf Sketcher: SketchGeometryExtension separation to interface 2020-11-03 12:01:22 +01:00
wmayer
6ebee86867 Sketcher: [skip ci] avoid possible memory leak 2020-10-30 13:21:51 +01:00
Yorik van Havre
7c9e0f3a99 Merged crowdin translations 2020-10-28 12:04:37 +01:00
Yorik van Havre
5eafaa37fd Updated ts files 2020-10-28 10:46:51 +01:00
Abdullah Tahiri
1f46b72491 Part: Geometry - encapsulate construction access 2020-10-25 03:52:51 +01:00
Neinei0k
bc2d3e9d2b 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
wmayer
690cc3e180 Gui: [skip ci] let view provider to decide to whether open a transaction on double-click
The sketcher view provider doesn't need a transaction on double-click or otherwise shows a useless entry in the undo dialog which when undoing leads to weird behaviour
2020-10-24 15:37:04 +02:00
luz paz
f16f974048 Sketcher: Capitalize opeCommand() text [skip-ci] 2020-10-24 12:26:35 +02:00
luz paz
e73ea7d244 Sketcher: Fix typos [skip-ci] 2020-10-24 12:26:35 +02:00
wmayer
3415401916 Sketcher: [skip ci] fix changing multiplicity of a spline for Windows builds if PCH is enabled 2020-10-23 13:43:42 +02:00
wmayer
aeb0c17e6e Sketcher: [skip ci] fix crash when deleting a selected geometry directly with delGeometry() 2020-10-23 11:56:17 +02:00
wmayer
4a8201a237 Sketch: [skip ci] handle possible crashes when decreasing degree of a spline 2020-10-23 11:26:15 +02:00
wmayer
fc89f4eb0c Sketcher: implement command to decrease degree of a B-spline 2020-10-23 00:36:41 +02:00
wmayer
0001cb0fb4 Sketcher: [skip ci] remove AutoTransaction from ViewProviderSketch::mouseButtonPressed because it breaks the open/commit transaction logic 2020-10-22 19:35:31 +02:00
wmayer
a2a1f04f23 Sketcher: [skip ci] remove superfluous transaction when start/finish editing a sketch 2020-10-22 19:35:20 +02:00
wmayer
cd4901bf51 Sketcher: [skip ci] do not create dialog on heap if not needed to improve exception-safety and reduce possible memory leaks 2020-10-22 16:01:22 +02:00
vocx-fc
a1e89da8fd Sketcher: add BSplineDecreaseDegree although with an empty implementation
Currently there is a command to increase the degree of a B-spline
but the corresponding command to reduce the degree does not exist.
So this command is a placeholder for when the full implementation
is added in the future by somebody.
2020-10-22 14:53:52 +02:00
vocx-fc
7f52d8bcb8 Sketcher: clean up line spacing for VirtualSpace command 2020-10-22 14:53:52 +02:00
vocx-fc
a2913050e9 Sketcher: clean up the sketcher B-spline tooltips
Also clean up linespacing and whitespaces to make the code more
readable. Extremely long lines are broken to be 80 to 100 characters
long when possible.
2020-10-22 14:53:52 +02:00