Commit Graph

1861 Commits

Author SHA1 Message Date
Zheng, Lei
0a35cb5b01 Part: improve TopoShape::findPlane()
Make the returned plane normal consistent with the underlying face
geometry.
2020-12-14 16:04:40 +01:00
wmayer
ddbd7696ce Py: [skip ci] replace PyList_Append with Py::List::append 2020-12-13 16:45:06 +01:00
wmayer
aec9d5f07a Py: fix memory leaks by incorrect use of PyList_Append 2020-12-13 16:30:04 +01:00
wmayer
1bc39542d3 Part: [skip ci] support of keywords in Part.GeometrySurface.toBSpline() 2020-12-11 14:40:09 +01:00
tomate44
f5f349fac8 Part:Surface.toBSpline use OCC MaxDegree instead of fixed value. 2020-12-11 14:05:08 +01:00
tomate44
75a2f471ea Part: update GeomSurface.toBSpline doc 2020-12-11 14:05:08 +01:00
tomate44
e7c06e8483 Part: add default values to GeomSurface.toBSpline() 2020-12-11 14:05:08 +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
11d4d6c18e Part/Sketcher: GeometryExtension/GeometryPersistentExtension split
==================================================================

GeometryExtension was originally designed to be serializable (save/restore). However,
GeometryMigrationExtension and ViewProviderSketchGeometryExtension have demonstrated the
usefulness of runtime-only GeometryExtensions.

The problem with runtime-only extensions being of a serializable type (GeometryExtension before
this commit) arises when Part::Geometry is to serialize the extensions and serialise the number
of extensions the geometry has. If runtime-only GeometryExtensions do not save a tag, then the
restore mechanism will expect more extensions that are actually in the XML file.

This commit makes GeometryExtension by default not serializable and deriving directly from
Base::BaseClass. A new class GeometryPersistentExtension is created, deriving from GeometryExtension
to provide serialisation. All Extensions requiring serialization derive from GeometryPersistentExtension
and those not requiring it from GeometryExtension directly.

This commit adapts all extensions to the new situation:
Part: GeometryDefaultExtension
Part: GeometryMigrationExtension
Sketcher: ViewProvierSketchGeometryExtension
Sketcher: SketchGeometryExtension and ExternalGeometryExtension
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
4e199bd23e Sketcher: Fix construction migration 2020-12-10 18:34:06 +01:00
Abdullah Tahiri
395a0f19b4 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
ec5976ec28 Part: GeometryMigrationExtension classes
========================================

This is a light-weight c++ only geometry extension to enable migration of information that was stored within
the Part WB and should be migrated to another WB (for example Sketcher WB)

It is designed so that a single extension can migrate different types of data (current and future).

When new data needs to be migrated, first a new enum bit is to be added to the class enum and new data members are to
be added to store the information within GeometryMigrationExtension class.

In the Restore() function restoring the data to be migrated, a GeometryMigrationExtension extension is added to the
geometry to be migrated with the data information and the corresponding enum bit set.

In the object to receive the migration data, onDocumentRestored() it is checked whether an extension of type
GeometryMigrationExtension is present, if yes, it is checked whether a bit used for migration is set and, if yes,
the data is retrieved and the GeometryMigrationExtension extension (preferably) removed from the Geometry object.
2020-12-10 18:34:06 +01:00
Abdullah Tahiri
6a02496860 Part: Geometry - Add non-const getters for extensions 2020-12-10 18:34:06 +01:00
Abdullah Tahiri
90dea635ac Part: Geometry refactor member copy
===================================

Encapsulate Part::Geometry data member copy process in a single function (copyNonTag).

Part::Geometry derived classes need not know the specifics of the data member of Part::Geometry.

Change the delegation of the copy of extensions from clone() to copyNonTag. Because clone() relies on
copy() and now copy() of Part::Geometry data member relies on copyNonTag(), there is no actual change
to the clone() functionality, but the copy() funcionality gains the copy of the extensions via copyNonTag().
2020-12-10 18:34:06 +01:00
luz paz
7c43b059df Part: fix header uniformity + trailing whitespace
[skip ci]
2020-12-10 11:56:55 +01:00
wmayer
78c6cc1362 Import: [skip ci] fixes #0004477: Can't import .STEP files with cyrillic symbols 2020-12-07 17:54:17 +01:00
wmayer
88de941d1b Part: [skip ci] for Part::Torus primitive use TopoShape::makeTorus 2020-12-03 14:52:13 +01:00
wmayer
c578f9747a Part: [skip ci] add method TopoShape::makeTorus 2020-12-03 14:50:20 +01:00
joe-bookwood
998e17748a replace auto with type 2020-12-02 12:23:43 +01:00
joe-bookwood
165b0e96fc add missing include 2020-12-02 12:23:43 +01:00
luz paz
5aff8cdd0b Part: Issue #0004473: Expose openCommand() to translation
Continuing the work to expose the undo/redo functionality to translation. This commit does so for the Part Wb.  
Ticket: https://tracker.freecadweb.org/view.php?id=4473
2020-12-01 14:53:35 +01:00
wmayer
c54deee146 Py2/Qt4: fix build failures and warnings 2020-11-30 19:05:37 +01:00
wmayer
18ef1f71fe Part: [skip ci] add GeomAdaptor.hxx to PCH 2020-11-29 00:12:59 +01:00
wmayer
0e93dd12ed Part: [skip ci] fixes #0004169: DatumPoint at the intersection of a DatumPlane and DatumPoint not working correctly 2020-11-27 19:10:22 +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
5a9da45e08 Gui: [skip ci] add method to Python binding of ViewProviderExtension to ignore overlay icon 2020-11-22 11:20:54 +01:00
wmayer
f9104f5884 Gui: [skip ci] add method to ignore to merge icon of an extension that is e.g. used for Part primitives 2020-11-21 16:49:08 +01:00
wmayer
691f259042 Part: allow to open attachment editor via context-menu 2020-11-15 19:16:22 +01:00
wmayer
8af45a1fe1 Part: move ViewProviderPrimitive to its own source files 2020-11-15 18:44:27 +01:00
wmayer
d3d34fc9d1 Part: [skip ci] include needed headers into PCH file 2020-11-15 13:30:32 +01:00
tomate44
74d5e458cb fixes and typos 2020-11-15 13:20:41 +01:00
tomate44
b21f5d5916 Part: add BezierCurve constrained interpolation 2020-11-15 13:20:41 +01:00
wmayer
bb7e64786a Part: [skip ci] include generated ui files from within source file 2020-11-15 13:17:52 +01:00
donovaly
9f6c14998d [Part] show location dialog when creating a Primitive
- there is no reason to hide it and even a bit tiring to open it manually since most no new primitives should be at the origin
- give the combobox to select the primitive type a reasonable name, this helps to understand the code better
2020-11-15 12:56:16 +01:00
wmayer
a48dd3aa2c Part: [skip ci] rearrange line page to save some vertical space 2020-11-13 15:35:07 +01:00
donovaly
f8ac3ea14a [Part] remove unnecessary vertical whitespace in dialogs
on smaller screens it is very annoying that the Part dialogs have too much vertical whitespace.

This PR gets rid of some unnecessary whitespace.
2020-11-13 13:52:31 +01:00
donovaly
922815df57 [Part] improve tube dialog
- remove vertical whitespace
2020-11-13 12:37:57 +01:00
wmayer
64288425a2 Part: [skip ci] show dialog directly when creating a tube feature 2020-11-13 12:33:59 +01:00
wmayer
812125931e Part: [skip ci] implement editor dialog for tube feature 2020-11-12 16:45:38 +01:00
wmayer
ba3106af06 Part: [skip ci] make sure to open a transaction when starting edit mode of primitives via context-menu 2020-11-12 16:35:58 +01:00
wmayer
cdc8b3c777 Part: [skip ci] split classes of Shapes.py file into files for feature, view provider and command classes 2020-11-12 12:17:47 +01:00
wmayer
b7f9e351c5 Win: [skip ci] check if NOMINMAX is already defined before setting it 2020-11-11 13:34:42 +01:00
wmayer
f9420c9877 Part: [skip ci] simplifications in primitives location dialog
- do not use a QSignalMapper if the slot doesn't take care of the emitting widget
- to set the placement only check for the base class GeoFeature, i.e. no need to step through all primitive types
- fix compiler warning of unused variable
2020-11-10 20:20:33 +01:00
donovaly
f0af88ecae [Part] add preview for changes to primitives location
- unset keyboardTracking for the dialog edits
- don't hide the location dialog on creation
2020-11-10 20:03:08 +01:00
Yorik van Havre
e76c857036 Merged crowdin translations 2020-11-10 14:58:06 +01:00
wmayer
6b9178e0b3 Part: [skip ci] correctly show control points of a B-spline/Bezier curve/surface if a placement is set 2020-11-09 13:14:31 +01:00
wmayer
58be246baf Part: [skip ci] fix type of Rotations property of Spiral primitive 2020-11-09 09:31:16 +01:00
wmayer
7251a90f6a Part: [skip ci] implement live preview for primitives 2020-11-08 15:40:59 +01:00