Commit graph

172 commits

Author SHA1 Message Date
gumyr
04cf1efd89 Fixed param_at_point Issues #570 & #708 2024-10-02 15:44:10 -04:00
Roger Maitland
720bee9fa0
Merge pull request #707 from alexer/fix-eq
Fix __eq__ and __ne__ for classes implementing them
2024-09-22 10:10:13 -04:00
Aleksi Torhamo
acbebfb017 Fix __eq__ and __ne__ for classes implementing them
Main issue, which concerns Vector, Location, and ShapeList:

Comparison with an object of a different type should not cause an
exception - they are simply not equal. Raising an exception in __eq__
can (and will*) break unrelated code that expects __eq__ to be well-behaved.

(* I noticed this bug when cq-editor choked on it while trying to find
   a name for an object in a dictionary of local variables)

There's a second more minor issue, which concerns the rest of the classes:

When the other type in __eq__ is not supported, one should technically
return NotImplemented instead of False, to allow the other type to take
part in the comparison, in case they know about our type.

(__ne__ should also not generally be implemented as just the negation of
__eq__ because of this, but that's also a moot point because the __ne__
can just be removed - Python will automatically do the right thing based
on __eq__ here)

Technically, the __eq__ for Vector and Plane is also broken in another way:
It's not transitive.

>>> a, b, c = Vector(0), Vector(9e-6), Vector(18e-6)
>>> a == b == c
True
>>> a == c
False

They should really eg. have a separate is_close() for approximate comparison,
but this isn't fixed here, since I have no idea how many places it'd break,
for one.
2024-09-22 08:07:00 +03:00
gumyr
99b378f27a Added Compound.unwrap & Compound.len as part of fix of Issue#694 2024-09-19 14:13:50 -04:00
gumyr
88a40574a8 Added Shell.sweep Issue #622 2024-09-07 11:31:10 -04:00
Daniele D'Orazio
dfb1cee937 more position_at tests 2024-08-30 17:43:29 +02:00
Daniele D'Orazio
8527fe8664 fix location_at, position_at and tangent_at with PositionMode.LENGTH for Wire 2024-08-30 17:16:35 +02:00
jdegenstein
7f8223b50d
test_direct_api.py -> reenable test that fail(ed) on MacOS arm64 2024-08-29 13:29:06 -05:00
gumyr
347de4277d Disabling test that fails only on Arm Macs 2024-08-29 11:57:33 -04:00
gumyr
722165dc25 Fixed Wire.trim Issue #676 2024-08-29 11:47:21 -04:00
gumyr
410007d304 Fixed Face.is_coplanar for flipped Faces - Issue #661 2024-07-20 10:36:55 -04:00
gumyr
55c22311e6 Improved Vector.__str__/__repr__ 2024-07-14 11:57:08 -04:00
gumyr
e29c9fb255 Added Face.location_at & _ocp_section 2024-07-02 07:49:51 -04:00
gumyr
ce20991745 Replaced Axis.as_infinite_edge with Edge __init__ method Issue #648 2024-06-24 13:47:52 -04:00
jdegenstein
d0f4fbfa62
test_direct_api.py -> add test for Plane.isometric 2024-06-24 09:10:06 -05:00
jdegenstein
bab54c7984
test_direct_api.py -> rename vec_dir to is_direction 2024-06-23 13:39:16 -05:00
jdegenstein
f2d4ddaeea
Merge branch 'dev' into jernArcFix1 2024-06-23 13:11:12 -05:00
gumyr
ce72ee2435 Added geometry intersections Issue #327 #328 2024-06-23 13:48:30 -04:00
jdegenstein
644edc99a3
test_direct_api.py -> add vector transform tests 2024-06-21 14:11:47 -05:00
gumyr
35a33f8d3e Added Plane.find_intersection(Plane) Issue #327 2024-06-19 18:43:14 -04:00
gumyr
2c40e19141 Fixed intersections of Axis Issue #615 2024-06-19 11:42:36 -04:00
gumyr
4561105666 Added new Edge.trim_to_length feature 2024-06-14 12:06:36 -04:00
gumyr
56d24c08c0 Fixed Issue #423 2024-06-11 11:40:02 -04:00
gumyr
7a1cfc1f8b import_step supports colors and labels 2024-05-22 10:12:57 -04:00
gumyr
78a30a7676 Face.normal_at takes point or u,v Issue #410 2024-03-23 15:17:40 -04:00
gumyr
34620704ac Color improvements: inheritance & iterable 2024-03-23 13:50:05 -04:00
gumyr
8d46faef41 Fixed Face.center_location Issue #599 2024-03-22 14:22:55 -04:00
gumyr
7bbd9ea2b7 Moved exporters to functions 2024-03-22 11:49:11 -04:00
gumyr
6eb00f1ef9 Improving Color str/repr Issue#596 2024-03-21 10:07:45 -04:00
gumyr
8632e40d18 Fixed hex color values Issue #583 2024-03-04 14:27:01 -05:00
gumyr
d1877e0deb Fixed flipped width/height Issue #565 2024-03-01 09:44:19 -05:00
gumyr
659ce3a0f4 Fixing PR-552 & adding coverage 2024-02-28 10:41:21 -05:00
Roger Maitland
cc26304b4c
Merge pull request #552 from fanf2/dev
Add Face.make_bezier_surface()
2024-02-28 09:56:07 -05:00
Roger Maitland
014c670d2e
Relaxed bbox.max comparison 2024-02-28 09:49:41 -05:00
gumyr
9edf411fbf Added pnt to tangent_at, fixed PositionMode 2024-02-27 11:56:13 -05:00
gumyr
7dbdc88cf4 Added tolerance to intersections Issue #519 2024-02-22 14:20:24 -05:00
gumyr
2e81b9d5df Reformatted with black 24.2.0 2024-02-22 11:27:01 -05:00
Roger Maitland
82d5f7a8c1
Merge pull request #559 from BogdanTheGeek/dev
Return `GeomType` enum, from `Shape.geom_type()`
2024-02-22 11:24:17 -05:00
jdegenstein
1c61a13518
test_direct_api.py -> improve coverage for _repr_pretty with cycles=True 2024-02-21 12:37:06 -06:00
Bogdan Ionescu
99b68f2a05 topology: make geom_type a propperty 2024-02-21 18:12:39 +00:00
jdegenstein
9ed588409c
test_direct_api.py -> remove comma in regex splitter str 2024-02-21 10:53:47 -06:00
jdegenstein
88829baff4
test_direct_api.py -> add missing str() call for tests 2024-02-21 10:22:16 -06:00
jdegenstein
88586e43ba
test_direct_api.py -> add missing self and list commas 2024-02-21 10:18:47 -06:00
jdegenstein
e568d297d8
test_direct_api.py -> add tests/test-methods for str/repr of GroupBy 2024-02-21 10:14:20 -06:00
BogdanTheGeek
355a53f52e topology: operations_generic: tests: geom_type() now returns GeomType enum 2024-02-21 15:14:16 +00:00
jdegenstein
c8d9906bea
test_direct_api.py -> test_groupby_str_repr 2024-02-20 14:19:24 -06:00
Tony Finch
2a401941c7 Add Face.make_bezier_surface() 2024-02-16 13:21:37 +00:00
gumyr
594e5f8a7c Add Plane.reverse() Issue #546 2024-02-10 09:25:09 -05:00
gumyr
f06f4fa805 Allowing Shell to take a single Face Issue #531 2024-02-06 10:33:20 -05:00
gumyr
a8ee1b492d Adding Curve as an input to Wire constructor 2024-02-03 19:03:37 -05:00