compas
compas copied to clipboard
Surface API alternative PR
This PR is a refactored version of #1350 ...
What type of change is this?
- [ ] Bug fix in a backwards-compatible manner.
- [ ] New feature in a backwards-compatible manner.
- [ ] Breaking change: bug fix or new feature that involve incompatible API changes.
- [ ] Other (e.g. doc update, configuration, etc)
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
- [ ] I added a line to the
CHANGELOG.mdfile in theUnreleasedsection under the most fitting heading (e.g.Added,Changed,Removed). - [ ] I ran all tests on my computer and it's all green (i.e.
invoke test). - [ ] I ran lint on my computer and there are no errors (i.e.
invoke lint). - [ ] I added new functions/classes and made them available on a second-level import, e.g.
compas.datastructures.Mesh. - [ ] I have added tests that prove my fix is effective or that my feature works.
- [ ] I have added necessary documentation (if appropriate)
Codecov Report
Attention: Patch coverage is 50.54945% with 45 lines in your changes missing coverage. Please review.
Project coverage is 59.92%. Comparing base (
47eb7ee) to head (6df427b).
| Files | Patch % | Lines |
|---|---|---|
| src/compas/geometry/surfaces/nurbs.py | 48.78% | 42 Missing :warning: |
| src/compas/geometry/surfaces/surface.py | 66.66% | 3 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #1375 +/- ##
==========================================
- Coverage 59.99% 59.92% -0.07%
==========================================
Files 206 206
Lines 22115 22151 +36
==========================================
+ Hits 13267 13275 +8
- Misses 8848 8876 +28
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Some explanation...
compas.geometry.surfaces.surface.Surfaceis like an ABC for parametric surfaces.compas.geometry.surfaces.surface.Surface.__new__has been replaced such that only subclasses can be instantiated.__new__re-overwrites of subclasses are therefore no longer necessary.Surfacehas many implementations (Conical, Cylindrical, Planar, Spherical, Toroidal, Nurbs). onlyNurbsSurfacerequires a plugin implementation.from_nativehas been added toSurfacesince CAD engines can provide a "native" surface from which all parametric functionality can be derived, even without knowing what kind of surface it is.- all specific factory methods have been moved to
NurbsSurfacesince they indeed produce a Nurbs surface. - elementary surfaces can be instantiated directly from the specific pure Python classes (
ConicalSurface,CylindricalSurface, ...) - a few small bugs have been fixed along the way.
- similar changes should be made to the Curve API...
all of this has been tested with OCC as plugin and using the viewer for visualisation. Rhino should still be verified.