Commit Graph

177 Commits

Author SHA1 Message Date
wmayer
df7e783513 Mod: fix several compiler warnings:
* fix -Wsometimes-uninitialized
* fix -Wunused-parameter
* fix -Wunused-variable
* fix -Winconsistent-missing-override
* fix -Wsign-compare
* fix -Wreorder-ctor
* fix -Wtautological-overlap-compare
2024-02-12 11:39:32 -06:00
bgbsww
f3c9b8ee97 Delinting pass 2024-02-03 18:33:07 -05:00
Zheng, Lei
728a880078 Transfer in Geometry.x changes from RT branch 2024-02-01 17:48:32 -05:00
Paddle
e685918ea8 PythonConverter: Extend for Hyperbola/Parabola/BSpline 2023-12-20 06:59:47 +01:00
Paddle
1c8f49ee67 Adds a small convenience function to get arc of circle angle. 2023-09-18 21:33:24 +02:00
wmayer
beb39239f3 Part: fix crash in Geometry::Restore()
If a project contains an unknown geometry extension then the attempt to create it returns a null pointer which isn't checked and causes a segmentation fault.

See also forum: https://forum.freecad.org/viewtopic.php?t=81091
2023-09-17 19:29:28 +02:00
wmayer
a0d86224f3 Part: modernize C++: use equals default 2023-08-22 15:14:03 +02:00
wmayer
0d854a56cd Part: modernize C++: return braced init list 2023-08-19 11:35:41 +02:00
wmayer
0af4990817 modernize C++: make unique 2023-08-07 19:51:30 -06:00
wmayer
2a88c7c7df modernize C++: use bool literals 2023-08-06 01:35:39 +02:00
luzpaz
129d5882a7 Migrate domain name from freecadweb to freecad (#9352)
* Migrate domain name from freecadweb to freecad
* Migrate src/Mod/Material files
* Migrate Stylesheet related files
* Migrate *.svg files
* Migrate miscellaneous files
* Migrate some build files
* Migrate recently added TD AR_IRAM template files

Closes #6415
2023-04-24 15:19:20 -05:00
wmayer
3f72e247ff Part: creating a NURBS of a circle or ellipse doesn't respect any transformation
Example:

mat = App.Matrix()
mat.rotateX(1)
mat.rotateY(1)
mat.rotateZ(1)

circle = Part.Circle()
circle.Radius = 5
circle.transform(mat)

circle.transform(mat)
Part.show(circle.toShape())

nurbs = circle.toNurbs()
Part.show(nurbs.toShape())

arc = circle.trim(0, 2)
nurbs = arc.toNurbs()
Part.show(nurbs.toShape())

spline = circle.toBSpline()
Part.show(spline.toShape())

#-------------------------

ellipse = Part.Ellipse()
ellipse.MajorRadius = 5
ellipse.MinorRadius = 3
ellipse.transform(mat)

ellipse.transform(mat)
Part.show(ellipse.toShape())

nurbs = ellipse.toNurbs()
Part.show(nurbs.toShape())

arc = ellipse.trim(0, 2)
nurbs = arc.toNurbs()
Part.show(nurbs.toShape())

spline = ellipse.toBSpline()
Part.show(spline.toShape())
2023-02-14 22:56:42 +01:00
wmayer
91048d7900 Part: fixes to create a NURBS for the arc of a conic
See forum: https://forum.freecad.org/viewtopic.php?t=75846
2023-02-12 19:45:00 +01:00
Abdullah Tahiri
7fcee31c07 Part/Sketcher: Geometry/Geometry facade pass by const-reference instead of by value 2023-01-09 17:13:26 +01:00
Abdullah Tahiri
c6a1644c1c Part: Geometry
==============

End parameter must be strictly higher to require a wrap.

Settling discussion:
https://github.com/FreeCAD/FreeCAD/pull/6971#discussion_r917295684
2022-12-21 16:01:23 +01:00
Ajinkya Dahale
b937ca35d4 [Part] Fix periodic b-spline trim
When `v == u` we want to "break" the b-spline at `u` (also OCC will raise an
exception if same parameter is provided).

The range of parameter can in general be different than 1.0, so use a general term.
2022-12-21 16:01:23 +01:00
Ajinkya Dahale
4d2837a6c2 [Part] Add/change some methods in GeomBSplineCurve
Add `setPeriodic` to turn a b-spline periodic.
Allow `join` to join any bounded curve not just b-spline.
2022-12-04 08:17:20 +01:00
marioalexis
34f070cf9b Part: Replace C cast 2022-09-18 11:06:51 -05:00
tomate44
c86490eb15 [Part] Change BSplineCurve/Surface setBounds() method name to scaleKnotsToBounds() 2022-08-23 12:41:55 +02:00
tomate44
e3dd67ad9f [Part] Add setBounds method to BSplineCurve
and change BSplineSurface.setBounds() to use dedicated OCCT function
2022-08-23 12:41:55 +02:00
berniev
da9ebc572f Mod: redundant void 2 2022-08-08 10:27:50 +02:00
wmayer
f2cbd9ebb4 Mod: [skip ci] minor improvements 2022-08-06 20:32:37 +02:00
berniev
b796a0d376 Mod: use empty 2022-08-06 19:30:13 +02:00
tomate44
7328f2f302 [Part] BSplineSurface: add setBounds method 2022-07-27 14:27:08 +02:00
wmayer
8444484677 Part: Fix several clazy issues:
* Maybe you meant to call Primitive::onChanged() instead [-Wclazy-skipped-base-method]
* Maybe you meant to call Primitive::mustExecute() instead [-Wclazy-skipped-base-method]
* Missing reference in range-for with non trivial type [-Wclazy-range-loop-reference]
* Use multi-arg instead [-Wclazy-qstring-arg]
* Use midRef() instead [-Wclazy-qstring-ref]
2022-07-25 08:31:18 +02:00
wmayer
8ae3185e3b Part: replace PyObject_IsTrue with Base::asBoolean 2022-07-16 13:31:10 +02:00
Uwe
fd68d0d947 [Part] Geometry*: remove unneeded includes
- also sort includes
2022-07-04 10:25:05 +02:00
wmayer
9a3258c9da Part: move BiArcs algorithm to its own class 2022-06-28 12:42:15 +02:00
Abdullah Tahiri
cd208c5477 Part: Geometry - Add Ellipse minor radio convenience function 2022-06-25 19:03:11 +02:00
Abdullah Tahiri
6a06f60ee3 Part: Geometry - function to get the conic axis direction 2022-06-25 19:03:11 +02:00
andrea
93525ff7eb removed references to OCC<7 2022-06-25 14:29:24 +02:00
Benjamin Alterauge
ad8bb4dc69 GeomBSplineCurve: Add interpolate without tangents
Now with description

Periodic selectable
2022-06-24 02:25:55 +02:00
wmayer
b02705d79f Part: apply OCC's fix for ElSLib::ConeDN and write a unit test 2022-05-27 14:44:35 +02:00
wmayer
8c984359dd Part: LGTM: Multiplication result may overflow 'int' before it is converted to 'unsigned int'. 2022-05-11 10:03:53 +02:00
wmayer
049d8ae06c Part: implement persistence methods of all geometry classes and raise exception if needed (but no assert(0)) 2022-04-08 11:48:10 +02:00
0penBrain
fbea5fdca5 [CrashFix] Core: fix crash when dumping content of a Surface 2022-04-08 10:55:31 +02:00
wmayer
068c0e5a98 Part: modernize C++11
* use nullptr
2022-03-23 19:26:14 +01:00
wmayer
9252f5f9ec Part: issue #6488: Cone surface returns wrong dv derivative
This is a workaround to fix a bug in ElSLib::ConeDN
2022-03-01 14:59:26 +01:00
marioalexis
7b23f6793c Part: Use Tools::getNormal to compute normal to surface 2022-01-20 13:01:27 +01:00
Ajinkya Dahale
978f579870 [Part] Support insertion of knots in b-splines 2022-01-09 11:33:53 +01:00
Abdullah Tahiri
f7dec6b601 Part: Geometry and Sketcher: GeometryFacade and ExternalGeometryFacade
======================================================================

Change pass-by-value to const reference.

Thanks Kunda!

https://lgtm.com/projects/g/FreeCAD/FreeCAD/alerts/?mode=tree&ruleFocus=2163210742
https://forum.freecadweb.org/viewtopic.php?p=555658#p555658
2021-12-27 21:03:51 +01:00
Abdullah Tahiri
e16b9f47af Part: Geometry - Curve member to calculate the normal at Point
==============================================================

Convenience member function combining closestParameter and normalAt using parameter.
2021-12-07 16:30:53 +01:00
Abdullah Tahiri
8b4276c2cc Part: Geometry - Extend Geometry Curve to query the value at parameter point directly from D0
=============================================================================================

Use the geometry specific D0 to calculate value at parameter point.
2021-12-07 16:30:53 +01:00
wmayer
74639da997 OCCT: port FreeCAD sources to version 7.6
SMESH is not yet ported
Although FreeCAD code compiles with OCCT 7.6 it doesn't work at the moment
2021-10-09 13:49:02 +02:00
Tomas Pavlicek
4d6b1f3eb8 Sketcher - Add new Split Edge action 2021-04-24 14:30:35 +02:00
Abdullah Tahiri
2afcbff0d6 Part: Geometry - Add function to trim a B-Spline
================================================

Supports both non-periodic and periodic case
2021-03-21 06:56:23 +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
Abdullah Tahiri
c0d810a370 Part: Geometry trigger notifyAttach on extension addition 2021-01-09 20:08:05 +01:00
Abdullah Tahiri
117c63ad21 Part: Geometry - BSplineCurve - add IsRational member function 2020-12-19 11:58:54 +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