Commit Graph

110 Commits

Author SHA1 Message Date
Abdullah Tahiri
71b54b7e46 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
ced8100ab9 use emplace_back instead of push_back where justified 2019-11-21 14:48:09 +01:00
wmayer
bbea71ce5f add missing std:: namespace to build on Debian 10 2019-08-21 19:22:01 +02:00
wmayer
7f4378a87e 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
331817d1b7 Part: Geometry extension set with unique id (type+name) and list based getExtensions python 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
8618dfd3c6 Part Geometry: get an extension from type or name, also from python 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
d8e99c1923 Part:: Geometry container extend hasExtension to type and name 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
4d9d3b0c83 Part: Geometry - methods to remove extensions by name and type 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
665fcda4dc Part: Fix assignment after reserve of weak_ptr causes segfault 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
7488faa99f 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
e4aead2365 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
d082a42351 Part: Excise GeometryExtension from Geometry 2019-07-14 12:37:30 +02:00
Abdullah Tahiri
a96ca31dda Part:: Bug fix in geometry set extension 2019-07-14 12:37:29 +02:00
Abdullah Tahiri
55be6fdb7f Geometry Extension based on smart pointers 2019-07-14 12:37:28 +02:00
Abdullah Tahiri
41bf3fbf75 Geometry: Extensions - release any allocated dynamic memory 2019-07-14 12:37:28 +02:00
Abdullah Tahiri
622f249dcd Part: Geometry Extensions 2019-07-14 12:37:28 +02:00
Abdullah Tahiri
026254b8ff Partial Restore: ensure line segment length when x coordinate is exactly zero
fixes #4012
2019-06-08 16:52:49 +02:00
Abdullah Tahiri
216926233f Part: Make 3rd party libraries into PCH 2019-05-02 07:09:22 +02:00
Abdullah Tahiri
f4e4f3441f 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
23fe2041d9 handle also B-spline and Bezier curves in GeomCurve::closestParameter 2019-01-21 13:47:41 +01:00
wmayer
43e5729f54 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
a41a130704 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
36d748c29e Example implementation 2018-11-19 11:31:10 +01:00
Abdullah Tahiri
012e35253a fix exception catching by reference 2018-11-19 11:31:09 +01:00
Abdullah Tahiri
856dbf377f App:Geometry make LineSegments do a best effort for recovering erroneus data 2018-11-19 11:31:07 +01:00
wmayer
135c67155d remove trailing spaces 2018-11-05 11:55:14 +01:00
Abdullah Tahiri
3e85954f6d Part: Geometry tangent with Vector3d overload 2018-11-04 14:43:24 -03:00
Abdullah Tahiri
578ea97647 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
0554944923 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
e5521fe0e1 Part: Geometry - refactoring of intersection code 2018-10-28 18:33:45 +01:00
Abdullah Tahiri
ae3ad1f84c 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
e189ee78c9 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
22f8c12235 Part: Geometry intersect routines throw when OCCT throws 2018-10-28 18:32:42 +01:00
Abdullah Tahiri
c3592c8ff4 Part: Geometry Arcs inheriting from GeomTrimmedCurve 2018-10-28 18:32:15 +01:00
Abdullah Tahiri
90ae032d6d Part: Geometry - improvements/bug fixes
=======================================

routine for closest parameter to point was failing on endpoints. The former version
used the parameter of the basis curve, which sometimes was giving parameter values
incoherent. This version uses distance to endpoints when a projection on the trimmed
curve can not be found.
2018-10-28 18:31:22 +01:00
Abdullah Tahiri
8a134466ed Part: New routines for curve intersection 2018-10-28 18:31:06 +01:00
wmayer
348ed301de avoid re-throwing an exception in case normal is not defined 2018-10-04 23:31:55 +02:00
wmayer
05089339cd fix -Wabsolute-value 2018-08-17 09:47:38 +02:00
wmayer
a7f261dc13 fix warnings 2018-08-08 18:02:59 +02:00
Markus Lampert
e13c09235f Changed all catch types to references for polymorphic exceptions. 2018-08-08 15:45:30 +02:00
Abdullah Tahiri
f809d67685 Part: Improvement to closest parameter determination when the projection does not exist in the trimmer curve 2018-07-29 13:44:06 +02:00
wmayer
61729b7256 fixes #0003027: if type(App.Vector) in originSketch.Geometry: newSketch.Geometry = originSketch.Geometry Raises types in list must be 2017-11-26 22:55:26 +01:00
luzpaz
cc87c20afe Make uniform the use of B-spline visible to users
Forum thread: https://forum.freecadweb.org/viewtopic.php?f=8&t=25411
This commit does not include fixes to source  comments unless they were 'doxygenated'.
No .xml files were altered either.
2017-11-17 19:30:37 -05:00
wmayer
bf5960ce7e for circle and arc of circle also store angle to local x-axis 2017-09-29 12:52:10 +02:00
wmayer
0d617f97d6 Port to occ7.2:
+ Standard_Failure::Caught() is now marked as deprecated and should be replaced with standard C++ exception handling
2017-09-01 16:27:46 +02:00
wmayer
3fee9bad3e add methods to get normal and curvature information from surfaces 2017-08-14 12:24:42 +02:00
tomate44
ad2aedbfc2 Part GeomBezierCurve implement Save() and Restore() 2017-06-26 22:08:38 +02:00
Peter Lama
fa4bebf2e0 Use OCCT Handle macro for Handle_ classes
This is the result of running OCCT's upgrade script provided
with OCCT 7.0. See
https://www.opencascade.com/content/freecad-occt710-and-windows-rtti-data-missing#comment-form
and
https://www.forum.freecadweb.org/viewtopic.php?f=4&t=21405&start=120#p169019
for why this is necessary for OCCT >= 7.1
2017-04-20 12:27:34 +02:00
Abdullah Tahiri
621c1d74f1 Part: Geometry refactoring copy/clone 2017-04-10 08:57:25 +02:00
Abdullah Tahiri
52a0ad6e04 Part: Geometry assignTag function 2017-04-10 08:57:25 +02:00