Free function api (#1469)

* Initial free functions

* Mypy fixes

* Add a mypy plugin that handles _get*

* More helpers and fixes

* black

* More hooks

* More ops and primitives

* Fill with constraints and cap

* Minimal docstrings and mypy fix

* Bool op operators for Shape

* Extra docstring

* Added spline primitive

* Added alternative constructors

* Update solid

* Add shape normalization

* Add text

* Added moved overload

* Another moved overload

* Convert location constructor to multimethod

* Additional Loc constructor

* Extra vertex constructor

* Additional cone overload

* Start with tests

* Fix compouund normalization

* Bool op tests

* Additional Location overload

* test moved and fix bool ops

* Different cap params

* More tests

* Test revolve and offset

* Test sweep and loft

* Add bool ops

* More tests

* Test text

* Improve coverage for utils

* More move[d] and Location overloads

* Start working on some docs

* Update index

* Doc fix

* Typo fix

* More move/moved overloads

* Small doc update

* Better Location coverage

* Fix angle units in Location

* More docs and a usability fix

* Cosmetics

* Mypy fix

* Remove dead code

* Coverage tweaks

* More docs'

* Box centering and box/plane arg order

* Docs cosmetics - nicer sweep

* Apply suggestions

Co-authored-by: Jeremy Wright <wrightjmf@gmail.com>

* Add docstrings

* Doc tweaks

* Bump multimethod version

* Add occ_impl.shapes

* Mention free funcs in the primer

* Typos

* Typo

* Punctuation

---------

Co-authored-by: Jeremy Wright <wrightjmf@gmail.com>
This commit is contained in:
AU
2024-05-05 11:25:45 +02:00
committed by GitHub
parent 552203713b
commit 995d1393bd
13 changed files with 1952 additions and 74 deletions

View File

@ -616,6 +616,12 @@ class TestCadObjects(BaseTest):
def testLocation(self):
# empty
loc = Location()
T = loc.wrapped.Transformation().TranslationPart()
self.assertTupleAlmostEquals((T.X(), T.Y(), T.Z()), (0, 0, 0), 6)
# Tuple
loc0 = Location((0, 0, 1))
@ -680,6 +686,14 @@ class TestCadObjects(BaseTest):
with self.assertRaises(TypeError):
Location("xy_plane")
# test to tuple
loc8 = Location(z=2, ry=15)
trans, rot = loc8.toTuple()
self.assertTupleAlmostEquals(trans, (0, 0, 2), 6)
self.assertTupleAlmostEquals(rot, (0, 15, 0), 6)
def testEdgeWrapperRadius(self):
# get a radius from a simple circle