Commit Graph

940 Commits

Author SHA1 Message Date
wmayer
997d1d7d51 fixes 0003846: unexpected result in building RuledSurface 2019-02-19 15:53:39 +01:00
wmayer
90c80f83fd PVS: V522 There might be dereferencing of a potential null pointer 'Py::Vector2d().getCxxObject()' 2019-02-18 00:00:10 +01:00
wmayer
1e343d339f PVS: V779 Unreachable code detected. It is possible that an error is present. 2019-02-17 20:12:56 +01:00
wmayer
f581d5c8cb PVS: V560 A part of conditional expression is always true 2019-02-17 13:56:48 +01:00
wmayer
0c3bfc4ff3 fix minor issues 2019-02-12 11:16:52 +01:00
Abdullah Tahiri
4e2ae6f408 Part: Rearrange inheritance not to use ArcPy
============================================

Inheritance:

Geometry
- GeomPoint
- GeomCurve (GeometryCurvePy)
- - GeomBoundedCurve (BoundedCurvePy)
- - - GeomBezierCurve (BezierCurvePy)
- - - GeomBSplineCurve (BSplineCurvePy)
- - - GeomTrimmedCurve (TrimmedCurvePy)
- - - - GeomArcOfConic (ArcOfConicPy)
- - - - - GeomArcOfCircle (ArcOfCirclePy)
- - - - - GeomArcOfEllipse (ArcOfEllipsePy)
- - - - - GeomArcOfHyperbola (ArcOfHyperbolaPy)
- - - - - GeomArcOfParabola (ArcOfParabolaPy)
- - - - GeomLineSegment (LineSegmentPy)
- - GeomConic
- - - GeomCircle
- - - GeomEllipse
- - - GeomHyperbola
- - - GeomParabola
- - GeomLine
- - GeomOffsetCurve

* Note: ArcPy is also a twinclass of c++ GeomTrimmedCurve, Python ArcPy derives from Python TrimmedCurvePy.

Same functionality as before:

>>> geometries = ActiveSketch.Geometry
>>> line = geometries[1]
>>> arc = geometries[2]
>>> line
<Line segment (-97.4389,42.4463,0) (-80.7887,44.5569,0) >
>>> arc
ArcOfCircle (Radius : 19.3111, Position : (-74.6914, -23.2165, 0), Direction : (0, 0, 1), Parameter : (1.82335, 2.71597))
>>> line.FirstParameter
0.0
>>> line.LastParameter
16.783437032695776
>>> line.setParameterRange(0,20)
>>> line.LastParameter
20.0
>>> arc.StartPoint
Vector (-79.51683708894876, -4.517938119394778, 0.0)
>>> arc.EndPoint
Vector (-92.27963885411512, -15.243140671641918, 0.0)
>>> arc.setParameterRange(1.5,3)
>>> arc
ArcOfCircle (Radius : 19.3111, Position : (-74.6914, -23.2165, 0), Direction : (0, 0, 1), Parameter : (1.5, 3))
>>> geometries[1] = line
>>> geometries[2] = arc
>>> ActiveSketch.Geometry = geometries
>>> ActiveSketch.solve()
0
>>>
2019-02-11 19:13:55 +01:00
Abdullah Tahiri
a3b93ee0eb Part: expose geometry clone support to python
=============================================

>>> geometries = ActiveSketch.Geometry
>>> geo0 = geometries[0]
>>> geo0.Tag
'a2b6883e-64d6-4348-b567-8b5e0a4896a0'
>>> geo1 = geo0.clone()
>>> geo1.Tag
'a2b6883e-64d6-4348-b567-8b5e0a4896a0'
>>> geo1.Radius = 3
>>> geo0.Tag
'a2b6883e-64d6-4348-b567-8b5e0a4896a0'
>>> geo0.Radius
30.157883192724587
>>> geo1.Tag
'a2b6883e-64d6-4348-b567-8b5e0a4896a0'
>>> geo1.Radius
3.0
2019-02-11 19:13:35 +01: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
Abdullah Tahiri
6dd192eb1e Part: Python Bounded Curve (bring in accordance with c++)
Inheritance correspondence:

Geometry
- GeomPoint
- GeomCurve (GeometryCurvePy)
- - GeomBoundedCurve (BoundedCurvePy)
- - - GeomBezierCurve (BezierCurvePy)
- - - GeomBSplineCurve (BSplineCurvePy)
- - - GeomTrimmedCurve (ArcPy)
- - - - GeomArcOfConic (ArcOfConicPy)
- - - - - GeomArcOfCircle (ArcOfCirclePy)
- - - - - GeomArcOfEllipse (ArcOfEllipsePy)
- - - - - GeomArcOfHyperbola (ArcOfHyperbolaPy)
- - - - - GeomArcOfParabola (ArcOfParabolaPy)
- - - - GeomLineSegment (LineSegmentPy)
- - GeomConic
- - - GeomCircle
- - - GeomEllipse
- - - GeomHyperbola
- - - GeomParabola
- - GeomLine
- - GeomOffsetCurve
2019-02-11 19:12:50 +01:00
luz.paz
26750deb07 Documentation: uniformity 2019-01-30 11:08:03 -02:00
wmayer
f2dc59c3ab add missing header file 2019-01-27 00:05:23 +01:00
wmayer
d2ddce6a2e remove Standard_OVERRIDE which is unknown for older OCCT versions 2019-01-26 23:09:14 +01:00
wmayer
dbc09e3a23 fixes 0003020: 2D offset of circle are not in the right place 2019-01-26 22:52:40 +01:00
wmayer
9f96254e7e improve whitespaces 2019-01-26 22:52:40 +01:00
wmayer
4079c9603f fixes #0003788: Part-workbench extrude with taper angle delivers a wrong shape 2019-01-25 02:49:09 +01:00
wmayer
dedaa80762 fixes 0003771: Memory leak in Part.Face.Surface 2019-01-23 22:38:51 +01:00
wmayer
041a550815 handle also B-spline and Bezier curves in GeomCurve::closestParameter 2019-01-21 13:47:41 +01:00
wmayer
b357d530ef set non-modifying functions of Python wrappers as const 2019-01-13 15:45:32 +01:00
wmayer
033fce2685 support face colors when writing in OpenInventor format 2019-01-12 15:06:25 +01:00
wmayer
7ba92f96a5 reduce code duplication 2019-01-03 17:33:39 +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
tomate44
9ea523a9e0 fix intersectCC method missing some intersection points for Geom2d curves 2019-01-03 12:33:58 +01:00
wmayer
fd9516e071 fixes 0003755: Crash when using Part - Refine Shape on certain files 2018-12-31 15:06:21 +01:00
wmayer
60581cff90 prepare for OCCT 7.3.1 2018-12-13 23:10:10 +01:00
wmayer
729b9e7afa add missing headers, prepare for OCCT 7.3.1 2018-12-13 23:08:48 +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
8db80c5c99 Property: dropping isorderrelevant boolean member in favour of bit in the status of the properties 2018-11-19 11:31:09 +01:00
Abdullah Tahiri
1b152ee689 Example code of propagating the result of the partial restore 2018-11-19 11:31:08 +01:00
Abdullah Tahiri
d62e886407 PropertyGeometryList: enable a partial recover on certain errors 2018-11-19 11:31:07 +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
e02695b91f Replace Base::Exception with appropriate subclass 2018-11-14 19:45:20 +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
luz.paz
4c2f2cd210 Misc. typos and whitespace
Found via `codespell -q 3 --skip="*.po,*.ts,./.git,./src/3rdParty,./src/CXX,./src/zipios++,./src/Mod/Assembly/App/opendcm,./ChangeLog.txt" -I ../fc-word-whitelist.txt` and `grep`. Excess whitespace auto-removed by Atom editor.
2018-11-03 16:13:06 -03:00
wmayer
f898eafd64 move from deprecated boost.signals to boost.signals2 library 2018-10-30 19:09:03 +01:00
wmayer
3858b179c3 improve whitespaces 2018-10-30 13:48:00 +01:00
Abdullah Tahiri
e10068a648 Sketcher: Trimming support bug
==============================

OCCT Geom2dAPI_InterCurveCurve based intersector does not detect intersection with the endpoint of a tangent line:
https://tracker.dev.opencascade.org/view.php?id=30217

This is a work-around that introduces endpoints of secondary curves as intersections, and uses projection to reject
projections further away than precision::confusion().

fixes #2463
2018-10-30 13:41:40 +01: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
Abdullah Tahiri
b1858f2cf4 Part: Geometry Arcs inheriting from GeomTrimmedCurve 2018-10-28 18:32:15 +01:00
Abdullah Tahiri
8b97a31372 Part: Geometry refactoring
==========================

python c+ wrapper to use twin class c++ function instead of duplicating the code
2018-10-28 18:31:35 +01:00
Abdullah Tahiri
9e349c33a8 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
f301feec31 Part: New routines for curve intersection 2018-10-28 18:31:06 +01:00
wmayer
a53027342e rework error handling mechanism 2018-10-24 19:38:43 +02:00