@@ -316,87 +316,93 @@ def to_polyline(self):
316316 @property
317317 def points (self ):
318318 """list of :class:`compas.geometry.Point`: The control points."""
319- return [point_to_compas (point ) for point in self .rhino_curve .Points ]
319+ if self .rhino_curve :
320+ return [point_to_compas (point ) for point in self .rhino_curve .Points ]
320321
321322 @property
322323 def weights (self ):
323324 """list of float: The weights of the control points."""
324- return [point .Weight for point in self .rhino_curve .Points ]
325+ if self .rhino_curve :
326+ return [point .Weight for point in self .rhino_curve .Points ]
325327
326328 @property
327329 def knots (self ):
328330 """list of float: Knots without repeating elements."""
329- return [key for key , _ in groupby (self .rhino_curve .Knots )]
331+ if self .rhino_curve :
332+ return [key for key , _ in groupby (self .rhino_curve .Knots )]
330333
331334 @property
332335 def knotsequence (self ):
333336 """list of float: Knots with multiplicities."""
334- return list (self .rhino_curve .Knots )
337+ if self .rhino_curve :
338+ return list (self .rhino_curve .Knots )
335339
336340 @property
337341 def multiplicities (self ):
338342 """list of int: Multiplicities of the knots."""
339- return [len (list (group )) for _ , group in groupby (self .rhino_curve .Knots )]
343+ if self .rhino_curve :
344+ return [len (list (group )) for _ , group in groupby (self .rhino_curve .Knots )]
340345
341346 @property
342347 def degree (self ):
343348 """int: The degree of the curve (degree = order - 1)."""
344- return self .rhino_curve .Degree
349+ if self .rhino_curve :
350+ return self .rhino_curve .Degree
345351
346352 @property
347353 def dimension (self ):
348354 """int: The dimension of the curve."""
349- return self .rhino_curve .Dimension
355+ if self .rhino_curve :
356+ return self .rhino_curve .Dimension
350357
351358 @property
352359 def domain (self ):
353360 """tuple of float: The parameter domain of the curve."""
354- return self .rhino_curve .Domain .T0 , self .rhino_curve .Domain .T1
361+ if self .rhino_curve :
362+ return self .rhino_curve .Domain .T0 , self .rhino_curve .Domain .T1
355363
356364 @property
357365 def order (self ):
358366 """int: The order of the curve (order = degree + 1)."""
359- return self .rhino_curve .Order
367+ if self .rhino_curve :
368+ return self .rhino_curve .Order
360369
361370 @property
362371 def start (self ):
363372 """:class:`compas.geometry.Point`: The point at the start of the curve."""
364- return point_to_compas (self .rhino_curve .PointAtStart )
373+ if self .rhino_curve :
374+ return point_to_compas (self .rhino_curve .PointAtStart )
365375
366376 @property
367377 def end (self ):
368378 """:class:`compas.geometry.Point`: The point at the end of the curve."""
369- return point_to_compas (self .rhino_curve .PointAtEnd )
379+ if self .rhino_curve :
380+ return point_to_compas (self .rhino_curve .PointAtEnd )
370381
371382 @property
372383 def is_closed (self ):
373384 """bool"""
374- return self .rhino_curve .IsClosed
385+ if self .rhino_curve :
386+ return self .rhino_curve .IsClosed
375387
376388 @property
377389 def is_periodic (self ):
378390 """bool"""
379- return self .rhino_curve .IsPeriodic
391+ if self .rhino_curve :
392+ return self .rhino_curve .IsPeriodic
380393
381394 @property
382395 def is_rational (self ):
383396 """bool"""
384- return self .rhino_curve .IsRational
397+ if self .rhino_curve :
398+ return self .rhino_curve .IsRational
385399
386400 # ==============================================================================
387401 # Methods
388402 # ==============================================================================
389403
390404 def copy (self ):
391405 """Make an independent copy of the current curve."""
392- # return RhinoNurbsCurve.from_parameters(
393- # self.points,
394- # self.weights,
395- # self.knots,
396- # self.multiplicities,
397- # self.degree,
398- # self.is_periodic
399- # )
400406 cls = type (self )
401407 curve = cls ()
402408 curve .rhino_curve = self .rhino_curve .Duplicate ()
0 commit comments