Skip to content

Commit fd4290c

Browse files
committed
added some error handling
1 parent 9b1116d commit fd4290c

File tree

1 file changed

+9
-1
lines changed
  • src/compas_rhino/geometry/surfaces

1 file changed

+9
-1
lines changed

src/compas_rhino/geometry/surfaces/nurbs.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ def rhino_surface_from_parameters(
6767
v_point_count = len(points[0])
6868
is_rational = True # TODO: check if all weights are equal? https://developer.rhino3d.com/guides/opennurbs/nurbs-geometry-overview/
6969
dimensions = 3
70-
rhino_surface = Rhino.Geometry.NurbsSurface.Create(dimensions, is_rational, u_order, v_order, u_point_count, v_point_count)
70+
rhino_surface = Rhino.Geometry.NurbsSurface.Create(
71+
dimensions, is_rational, u_order, v_order, u_point_count, v_point_count
72+
)
73+
74+
if not rhino_surface:
75+
message = "dimensions: {} is_rational: {} u_order: {} v_order: {} u_points: {} v_points: {}".format(
76+
dimensions, is_rational, u_order, v_order, u_point_count, v_point_count
77+
)
78+
raise ValueError("Failed to create NurbsSurface with params:\n{}".format(message))
7179

7280
u_knotvector = [knot for knot, mult in zip(u_knots, u_mults) for _ in range(mult)]
7381
v_knotvector = [knot for knot, mult in zip(v_knots, v_mults) for _ in range(mult)]

0 commit comments

Comments
 (0)