Skip to content

Commit b48b9f1

Browse files
committed
simplified call to RhinoNurbsSurface.from_frame
1 parent 1798393 commit b48b9f1

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/compas_rhino/geometry/brep/face.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,10 @@ def _get_surface_geometry(surface):
139139

140140
@staticmethod
141141
def _make_surface_from_data(surface_type, surface_data, uv_domain):
142+
u_domain, v_domain = uv_domain
142143
if surface_type == "plane":
143144
frame = Frame.from_data(surface_data)
144-
surface = RhinoNurbsSurface.from_frame(frame, uv_domain[0], uv_domain[1], (1, 1), (2, 2))
145+
surface = RhinoNurbsSurface.from_frame(frame, u_domain, v_domain)
145146
elif surface_type == "sphere":
146147
surface = RhinoNurbsSurface.from_sphere(Sphere.from_data(surface_data))
147148
elif surface_type == "cylinder":
@@ -150,6 +151,6 @@ def _make_surface_from_data(surface_type, surface_data, uv_domain):
150151
surface = RhinoNurbsSurface.from_data(surface_data)
151152
elif surface_type == "torus":
152153
raise NotImplementedError("Support for torus surface is not yet implemented!")
153-
surface.rhino_surface.SetDomain(0, Interval(*uv_domain[0]))
154-
surface.rhino_surface.SetDomain(1, Interval(*uv_domain[1]))
154+
surface.rhino_surface.SetDomain(0, Interval(*u_domain))
155+
surface.rhino_surface.SetDomain(1, Interval(*v_domain))
155156
return surface

src/compas_rhino/geometry/surfaces/surface.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def from_plane(cls, plane, box):
189189
return cls.from_rhino(rhino_surface)
190190

191191
@classmethod
192-
def from_frame(cls, frame, u_interval, v_interval, uv_degrees, uv_point_counts):
192+
def from_frame(cls, frame, u_interval, v_interval, uv_degrees=(1, 1), uv_point_counts=(2, 2)):
193193
"""Creates a NURBS surface from a frame and parametric domain information.
194194
195195
Parameters
@@ -202,9 +202,9 @@ def from_frame(cls, frame, u_interval, v_interval, uv_degrees, uv_point_counts):
202202
v_interval : tuple(float, float)
203203
The parametric domain of the V parameter. v_interval[0] => v_interval[1].
204204
uv_degrees : tuple(int, int)
205-
Degree of U and V parameters. uv_degree[0] => degree_u, uv_degree[1] => degree_v
205+
Degree of U and V parameters. Default is 1 in both directions for a simple planar surface.
206206
uv_point_counts :
207-
Number of control points in each parameter. [0] => cp_count_u, [1] => cp_count_v
207+
Number of control points in each parameter. Default is 2 in both directions for a simple planar surface.
208208
209209
Returns
210210
-------

0 commit comments

Comments
 (0)