Commit Graph

1192 Commits

Author SHA1 Message Date
Abdullah Tahiri
595fc118e3 Part: Part2DObject::seekTrimPoints rename parameters
====================================================

This function takes parameters named GeoId, which evoke the Sketcher GeoId and which
indeed are used by the sketcher. However, these indices are just indices of the provided
geometry list. Therefore:
1. The are never negative (no matter if a corresponding Sketcher GeoId is external or not).
2. They do not have reserved indices for axes.
3. Most importantly, not found GeoId1 and GeoId2 are coded as -1, which for the Sketcher has
a well defined meaning (axis), whereas the Sketcher uses Constraint::GeoUndef as undefined or
not present/ not found index, which currently is -2000.

For these reasons, it was judged appropriate to rename the parameters and documentation to
emphasise that this function is unrelated and dettached from any Sketcher knowledge, and that
indices are just normal indices of a vector.
2021-03-21 06:56:23 +01:00
wmayer
4561deb4fa Part: [skip ci] implement makeShellFromWires 2021-03-16 16:01:43 +01:00
tomate44
839b96385c Part: fixes and check input values for spiral and helix primitives 2021-03-10 14:24:01 +01:00
tomate44
97543396c5 Part primitives: add SegmentLength property to helix and spiral 2021-03-10 14:23:16 +01:00
tomate44
6f9856bd46 Part primitives: use makeSpiralHelix in spiral and helix primitives 2021-03-10 14:22:04 +01:00
tomate44
18f36c10da TopoShape: add a common function to build spirals and helixes 2021-03-10 14:18:12 +01:00
Benjamin Nauck
f6c9cc90ee [Base] Remove includes to StdStlTools.h as that's not needed anymore
std::make_unique was introduced in c++14, so no need to use the back
ported version
2021-03-06 21:20:32 +01:00
Benjamin Nauck
afb1d0fbc9 [Path] Switch from boost::tuple to std::tuple
It's better to use the standard lib when possible
2021-03-06 19:31:06 +01:00
wmayer
f85478155b Revert "[PartDesign] Add Material property to Body"
This reverts commit 4fcf8f199c.

There is no need to make this a static property because it can be added at runtime via Python or the GUI
2021-03-04 18:50:57 +01:00
howetuft
4fcf8f199c [PartDesign] Add Material property to Body 2021-03-04 12:19:50 +01:00
Abdullah Tahiri
324f6d3e26 Part: Geometry - BSpline - fix weight assignment
================================================

If during assignment of weights (during the for loop iteratively setting the poles) all weights
become (temporarily) equal even though weights does not have equal values
OCCT will convert all the weights (the already assigned and those not yet assigned)
to 1.0 (nonrational b-splines have 1.0 weights). This may lead to the assignment of wrong
of weight values.

The work-around is to temporarily set the last weight to be assigned to a value different from
the current value and the to-be-assigned value for the weight at position last-to-be-assign but one.

Fixes:
https://forum.freecadweb.org/viewtopic.php?p=478701#p478702
2021-02-18 17:28:38 +01:00
David Osterberg
dac937ae35 Part: Allow helix primitive with negative Angle 2021-02-14 11:53:34 +01:00
Chris Hennes
15d4cac123 LGTM: Remove superfluous conditional 2021-02-08 16:39:40 +01:00
David Osterberg
59ec3cb141 PartDesign: New features AdditiveHelix and SubtractiveHelix
These features, based on the code for the Pipe class, allow the user
to simply create a helical sweep within PartDesign workbench.

Sample application is threads, springs, coils, augers, etc.

Also, remove needless requirement for positive cone angle on helixes.

Thanks to @bitacovir for helping with the icons
Thanks to @chennes for review
Thanks to @vosk for review
Thanks to @wwmayer for review

Enforce that links stay within scope for ProfileBased features
This also ensures that the Body itself is not used for creating features within
the body, causing a "Graph not a DAG" error.
2021-02-04 13:01:12 +01:00
wmayer
3ebd7d119b Part: [skip ci] rename methods in TopoShape that override non-virtual functions of base class 2021-02-03 16:10:38 +01:00
wmayer
7a83853535 Part: offer all supported STEP schemes by OCC in a combo box 2021-02-02 21:51:11 +01:00
vosk
4bd5c2669d [Part] - Fix memory leaks 2021-01-28 15:45:00 +01:00
marioalexis
4c323a6325 Part: Crash when calling SubShapes of empty shape from Python 2021-01-18 19:47:35 +01:00
Abdullah Tahiri
c0d810a370 Part: Geometry trigger notifyAttach on extension addition 2021-01-09 20:08:05 +01:00
Abdullah Tahiri
e6af511f39 Part/Sketcher: Refactor Geometry Extensions copy/save/restore AND attachment notification
=========================================================================================

- Long overdue refactor to avoid repetition during save/restore and copy.
- New interface to notify an extension when it is attached. It also enables the extension to gain
a pointer to the geometry container. This is intended to extend the functionality already existing
in Part::Geometry.
2021-01-09 20:08:05 +01:00
Zheng, Lei
12defb11b6 Part/Sketcher: improve list property update efficiency 2021-01-07 10:27:21 +01:00
wmayer
5d9db07ddd Part: [skip ci] in TopoShape::getMemSize() handle edges or faces with no attached geometry 2021-01-06 15:39:25 +01:00
wmayer
0f31c87cc9 Boost: [skip ci] Fix build warnings from deprecated Boost headers (v1.75) 2020-12-29 15:34:25 +01:00
Mateusz Skowroński
2559f2d29c Fix build warnings from deprecated Boost headers (they are used internally by Boost). Thanks @wwmayer for the hint. 2020-12-29 10:20:53 +01:00
Mateusz Skowroński
5dca59d824 Fix GCC warnings: type qualifiers ignored on cast result type [-Wignored-qualifiers] 2020-12-28 23:17:26 +01:00
Mateusz Skowroński
6075ba3085 Fix GCC warnings: catching polymorphic type by value [-Wcatch-value=] 2020-12-28 23:17:26 +01:00
luz paz
472168fc15 Fix typos [skip ci]
Typos ffound via `codespell v2.1.dev0`  
Also includes fixes in deprecated code of `src/Mod/Assembly`
2020-12-28 23:14:04 +01:00
wmayer
23073c14da Py2: fix Py2 build failure 2020-12-23 14:04:14 +01:00
Aapo
b66c895bb8 [Part] AppPartPy.cpp Python 3.9 Unicode warning fixes. 2020-12-23 13:51:52 +01:00
wmayer
6c956bb80f Sketcher: support vertexes in sketch used e.g. for hole features 2020-12-22 07:10:48 +01:00
wmayer
c276139f19 Part: [skip ci] add TopoShape::isInfinite 2020-12-19 16:07:00 +01:00
Abdullah Tahiri
117c63ad21 Part: Geometry - BSplineCurve - add IsRational member function 2020-12-19 11:58:54 +01:00
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
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