-
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 from rhino #1350
Surface from rhino #1350
Conversation
…RhinoNurbsSurface.__data__ has pre-processing
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1350 +/- ##
=======================================
Coverage ? 59.90%
=======================================
Files ? 206
Lines ? 22162
Branches ? 0
=======================================
Hits ? 13277
Misses ? 8885
Partials ? 0 ☔ View full report in Codecov by Sentry. |
data["degree_v"], | ||
data["is_periodic_u"], | ||
data["is_periodic_v"], | ||
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.
i am not so sure that any of the methods of the surface class take this frame into account. currently, the frame is not settable and always defaults to world XY...
@property | ||
def __data__(self): | ||
return { | ||
"frame": self._frame.__data__, | ||
"domain_u": list(self.domain_u), | ||
"domain_v": list(self.domain_v), | ||
} | ||
|
||
@classmethod | ||
def __from_data__(cls, data): | ||
frame = Frame.__from_data__(data["frame"]) | ||
domain_u = tuple(data["domain_u"]) | ||
domain_v = tuple(data["domain_v"]) | ||
return cls.from_plane(frame, domain_u, domain_v) |
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.
since the base surface is abstract and since it should not be possible to create instances of it directly, i don't think it should provide the possibility to create one from data...
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.
from_plane
will invoke the plugin, if available. it just seems to be the canonical surface representation (maybe with exception of frame
which it seems I didn't quite get)
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.
but why should we provide functionality for making a "canonical" surface from data, when the surface can't actually by instantiated in the normal way. i though we agreed that only the spacial constructors can be used to create an actual surface and that the base class only provides the shared interface...
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.
for CAD agnostic (de)serialization? maybe what's confusing me is that lack of other kinds of surface types
maybe this should be in a PlanarSurface
like in Rhino..
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.
there are plenty of other surface types (including planar surface). they just don't require a Rhino or OCC plugin...
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.
compas.geometry.surfaces
has CylindricalSurface
, ConicalSurface
, PlanarSurface
, SphericalSurface
, ToroidalSurface
def _get_frame_from_planesurface(self): | ||
u_start = self.domain_u[0] | ||
v_start = self.domain_v[0] | ||
success, frame = self.native_surface.FrameAt(u_start, v_start) | ||
if not success: | ||
raise ValueError("Failed to get frame at u={} v={}".format(u_start, v_start)) | ||
return plane_to_compas_frame(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.
i don't think this is correct. control points are usually in world coordinates, not in local coordinates wrt to a frame positioned at the beginning of the domain.
instance.frame = instance._get_frame_from_planesurface() | ||
instance._domain_u = native_surface.Domain(0)[0], native_surface.Domain(0)[1] | ||
instance._domain_v = native_surface.Domain(1)[0], native_surface.Domain(1)[1] |
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.
this doesn't make sense to me
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.
the domain part also?
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.
afaik the u and v domain are read from the native surface by the corresponding properties. they are never set...
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.
but my comment was mostly about the frame thing indeed
replaced by #1375 |
Surface
pluggablefrom_plane
so that it's possible to create a planar surface in Rhino.from_native
innative_surface
inSurface
andRhinoSurface
to align better with theBrep
system.RhinoSurface.from_rhino
.Box
argument withu_domain
andv_domain
inRhinoSurface.from_plane
.new_surface
pluggin to create aRhinoSurface
object instead ofSurface
.Surface
andNurbsSurface
are protected. Caller must use one of the alternative constructors.https://miro.com/app/board/uXjVK2eWeOk=/
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
.