-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Surface API alternative PR #1375
Conversation
Codecov ReportAttention: Patch coverage is
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 ☔ View full report in Codecov by Sentry. |
Some explanation...
all of this has been tested with OCC as plugin and using the viewer for visualisation. Rhino should still be verified. |
@@ -109,25 +144,46 @@ def __data__(self): | |||
|
|||
@classmethod | |||
def __from_data__(cls, data): | |||
"""Construct a Nurbs surface from its data representation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the domain not part of the representation? can it somehow be inferred from another piece of data?
Co-authored-by: Chen Kasirer <ckasirer@ethz.ch>
|
||
@classmethod | ||
def from_interpolation(cls, points, *args, **kwargs): | ||
"""Construct a surface from a frame. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Construct a surface from a frame. | |
"""Construct a surface from an interpolation. |
|
||
""" | ||
return new_nurbssurface_from_native(cls, surface) | ||
raise NotImplementedError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call plugin here?
@@ -51,7 +45,9 @@ class Surface(Geometry): | |||
""" | |||
|
|||
def __new__(cls, *args, **kwargs): | |||
return new_surface(cls, *args, **kwargs) | |||
if cls is Surface: | |||
raise TypeError("Instantiating the base Surface class directly is not allowed.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe change the wording a bit. the caller doesn't necessarily know an entirely different class is gonna be created, that's abstracted by the plugin system. if I saw something like this I'd go looking for the right child class to instantiate myself. Instead, they should know the default constructor is not allowed but the other ones yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…s-dev/compas into surface-api-alternative-pr
This PR is a refactored version of #1350 ...
What type of change is this?
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.CHANGELOG.md
file in theUnreleased
section under the most fitting heading (e.g.Added
,Changed
,Removed
).invoke test
).invoke lint
).compas.datastructures.Mesh
.