Commit Graph

127 Commits

Author SHA1 Message Date
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
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
wmayer
c54deee146 Py2/Qt4: fix build failures and warnings 2020-11-30 19:05:37 +01:00
wmayer
f4aceec54b Part: [skip ci] make arguments const references 2020-11-03 13:12:23 +01:00
Abdullah Tahiri
5b415f6d74 Part: Geometry extensions constness correction 2020-11-03 12:01:22 +01:00
Abdullah Tahiri
33b4d00872 Part: Geometry - refactor py functions into class for code reuse 2020-11-03 12:01:22 +01:00
wmayer
462efdab37 Part: [skip ci] After removing a knot check if the B-spline is still valid 2020-10-30 13:55:31 +01:00
wmayer
53441613cc Part: [skip ci] handle OCCT exception in GeomBSplineCurve::copy() 2020-10-30 10:54:25 +01:00
wmayer
c5d5d69c91 Part: [skip ci] add method to approximate a B-spline curve with a given max. degree 2020-10-23 00:06:31 +02:00
wmayer
ce87f586ee fixes #0004456: Regression : Part.Plane.Intersect do not accept plane as argument [skip ci] 2020-10-17 10:12:01 +02:00
wmayer
9881fff3ad Part: [skip ci] replace some old C-style casts with static_cast 2020-10-17 10:10:44 +02:00
wmayer
00e0e7745c Part: expose GeomPlate algorithm to Python 2020-09-28 18:46:35 +02:00
wmayer
218d61768a Part: converter from Adaptor3d_Curve to GeomCurve 2020-09-28 14:53:42 +02:00
wmayer
af8ff5c491 Part: [skip ci] add missing methods to RectangularTrimmedSurface 2020-09-28 13:18:47 +02:00
wmayer
a6c55acdb1 Part: improve Python interface
+ rename getCurve2dFromGeom2d to makeFromCurve2d
+ add function makeFromCurve and makeFromTrimmedCurve like makeFromSurface
+ implement OffsetCurve.BasisCurve
+ fix memory leak in BRepOffsetAPI_MakePipeShellPy
2020-09-27 23:34:45 +02:00
wmayer
a5899f3892 Part: [skip ci] return std::unique_ptr from Part::makeFromSurface() to avoid memory leaks 2020-08-29 23:56:12 +02:00
Abdullah Tahiri
b748cc6884 Part: GeometryExtensions
========================

fixes #4087

Missing "break" in loop after finding the extension was causing segfault because of null pointer access, as the unique pointer had been std:move-d when found and was thus no longer valid.
2020-03-06 16:58:21 +01:00
asapelkin
e951094af9 use emplace_back instead of push_back where justified 2019-11-21 14:48:09 +01:00
wmayer
2a92051192 add missing std:: namespace to build on Debian 10 2019-08-21 19:22:01 +02:00
wmayer
67b06d7a36 Fix clang compiler warnings:
+ fix -Winconsistent-missing-override
+ fix -Wpessimizing-move (Geometry::clone: moving a temporary object prevents copy elision -> remove std::move call here)
2019-08-17 19:52:32 +02:00
Abdullah Tahiri
33620d212e Part: Geometry extension set with unique id (type+name) and list based getExtensions python 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
11793ba0b2 Part Geometry: get an extension from type or name, also from python 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
afbe1df322 Part:: Geometry container extend hasExtension to type and name 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
854452e2e1 Part: Geometry - methods to remove extensions by name and type 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
234d542c1a Part: Fix assignment after reserve of weak_ptr causes segfault 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
9bb2210c92 Part: Geometry extensions set interface
=======================================

unique_ptr is a move only type. Therefore it may only take an rvalue.

It does not make sense a pass by value for move only types (Item 41).
2019-07-14 12:37:31 +02:00
Abdullah Tahiri
460bb59320 Geometry extensions: remove unnecessary smart pointer deletion
==============================================================

When the geometry object is destroyed, std::vector's destructor is called, which in turn calls the destructor of the smart pointers.

If a weak_ptr corresponding to one of those shared_ptr is locked (elsewhere, if FC were multithread),
the underlaying resource will not be freed until said locked weak_ptr goes out of scope. It will then.
2019-07-14 12:37:31 +02:00
Abdullah Tahiri
1e2c627f26 Part: Excise GeometryExtension from Geometry 2019-07-14 12:37:30 +02:00
Abdullah Tahiri
2c65c5681f Part:: Bug fix in geometry set extension 2019-07-14 12:37:29 +02:00
Abdullah Tahiri
aedfb6a6a3 Geometry Extension based on smart pointers 2019-07-14 12:37:28 +02:00
Abdullah Tahiri
f977f47de3 Geometry: Extensions - release any allocated dynamic memory 2019-07-14 12:37:28 +02:00
Abdullah Tahiri
2400d63d70 Part: Geometry Extensions 2019-07-14 12:37:28 +02:00
Abdullah Tahiri
aa9cd0d91c Partial Restore: ensure line segment length when x coordinate is exactly zero
fixes #4012
2019-06-08 16:52:49 +02:00
Abdullah Tahiri
a56658489b Part: Make 3rd party libraries into PCH 2019-05-02 07:09:22 +02:00
Abdullah Tahiri
0ceae9ead4 Part: Enable trimmed curves to set their parameter range, from c++ and Python
=============================================================================

>>> geometries = ActiveSketch.Geometry
>>> geo2 = geometries[2]
>>> geo2
ArcOfCircle (Radius : 27.5267, Position : (-70.4702, -31.8933, 0), Direction : (0, 0, 1), Parameter : (1.34187, 2.35619))
>>> geo2.setParameterRange(1,3)
>>> geometries[2]=geo2
>>> ActiveSketch.Geometry=geometries
2019-02-11 19:13:16 +01:00
wmayer
041a550815 handle also B-spline and Bezier curves in GeomCurve::closestParameter 2019-01-21 13:47:41 +01:00
wmayer
b8455531c1 declare private intersect() function as static to make clear it doesn't belong to a GeomCurve instance 2019-01-03 15:40:59 +01:00
wmayer
ddb20468ad some additions to pR 1794:
add a special XMLAttributeError class to indicate an error when accessing a missing attribute
in PropertyContainer::Restore make error handling more flexible
2018-11-19 19:07:56 +01:00
Abdullah Tahiri
b6a37e153f Example implementation 2018-11-19 11:31:10 +01:00
Abdullah Tahiri
10b12ddedb fix exception catching by reference 2018-11-19 11:31:09 +01:00
Abdullah Tahiri
591718f918 App:Geometry make LineSegments do a best effort for recovering erroneus data 2018-11-19 11:31:07 +01:00
wmayer
fbb8e86cbf remove trailing spaces 2018-11-05 11:55:14 +01:00
Abdullah Tahiri
6f42f3dacc Part: Geometry tangent with Vector3d overload 2018-11-04 14:43:24 -03:00
Abdullah Tahiri
7effa68eeb Part: Geometry use CADKernelError exception for OCCT
====================================================

Part of the geometry was using CADKernelError and part was using RunTimeError exceptions, so unify criteria.

Runtime is very generic and does not need to stem from OCCT.

- Also rename of a typo basic to basis, to be coherent with OCCT terminology
2018-10-28 18:34:36 +01:00
Abdullah Tahiri
649d115afb Part: Geometry New Bounded-Trimmed-curve inheritance
====================================================

The new hierarchy is as this:
GeomArcOfConic:GeomTrimmedCurve:GeomBoundedCurve:GeomCurve

A bounded curve is one having a start and endpoint, like an arc, a line segment, or a b-spline

A trimmed curve is one arising from trimming a basis curve, line an arc or a line segment, but NOT a b-spline.

An arc of Conic is one arising from a conic section, line an arc, but neither a line segment, nor a b-spline.

This new hierarchy enables a more consistent handling of geometry and it is closer to the OCCT hierarchy.
2018-10-28 18:33:58 +01:00
Abdullah Tahiri
0ed7b1d691 Part: Geometry - refactoring of intersection code 2018-10-28 18:33:45 +01:00
Abdullah Tahiri
c946de8fb4 Part: Geometry - intersection - checkendpoints
===============================================

Extrema algorithms sometimes fails when coincident endpoints

I am not sure if it is a bug in OCCT or it is just not intended.

This commits adds an extra check to add endpoints if within tolerance.
https://forum.freecadweb.org/viewtopic.php?f=10&t=31700
2018-10-28 18:33:32 +01:00
Abdullah Tahiri
4d1e981138 Part: Geometry GeomTrim Geomline segment type
=============================================

Make line segment inherit from GeomTrim. This allows seamless management of trimmed curves.
2018-10-28 18:33:19 +01:00
Abdullah Tahiri
396998467b Part: Geometry intersect routines throw when OCCT throws 2018-10-28 18:32:42 +01:00