 # Diff of /trunk/pycad/py_src/primitives.py

revision 2626 by jfenwick, Fri Aug 21 06:30:25 2009 UTC revision 2627 by gross, Mon Aug 24 01:57:34 2009 UTC
# Line 567  class Curve(CurveBase, Primitive): Line 567  class Curve(CurveBase, Primitive):
567         """         """
568         Defines a curve from control points given by ``points``.         Defines a curve from control points given by ``points``.
569         """         """
570         if len(points)==1: points=tuple(points)         if len(points)==1:
571               points=points
572               if not hasattr(points,'__iter__'): raise ValueError("Curve needs at least two points")
573         if len(points)<2:         if len(points)<2:
574             raise ValueError("Curve needs at least two points")             raise ValueError("Curve needs at least two points")
575         i=0         i=0
# Line 973  class CurveLoop(Primitive, PrimitiveBase Line 975  class CurveLoop(Primitive, PrimitiveBase
975         Creates a polygon from a list of line curves. The curves must form a         Creates a polygon from a list of line curves. The curves must form a
976         closed loop.         closed loop.
977         """         """
978         if len(curves)==1: curves=curves         if len(curves)==1:
979               curves=curves
980               if not hasattr(curves,'__iter__'): raise ValueError("CurveLoop needs at least two points")
981         if len(curves)<2:         if len(curves)<2:
982              raise ValueError("at least two curves have to be given.")              raise ValueError("At least two curves have to be given.")
983         for i in range(len(curves)):         for i in range(len(curves)):
984             if not isinstance(curves[i],Manifold1D):             if not isinstance(curves[i],Manifold1D):
985                raise TypeError("%s-th argument is not a Manifold1D object."%i)                raise TypeError("%s-th argument is not a Manifold1D object."%i)
# Line 1467  class SurfaceLoop(Primitive, PrimitiveBa Line 1471  class SurfaceLoop(Primitive, PrimitiveBa
1471         """         """
1472         Creates a surface loop.         Creates a surface loop.
1473         """         """
1474         if len(surfaces)==1: surfaces=surfaces         if len(surfaces)==1:
1475               surfaces=surfaces
1476               if not hasattr(surfaces,'__iter__'): raise ValueError("SurfaceLoop needs at least two points")
1477         if len(surfaces)<2:         if len(surfaces)<2:
1478              raise ValueError("at least two surfaces have to be given.")              raise ValueError("at least two surfaces have to be given.")
1479         for i in range(len(surfaces)):         for i in range(len(surfaces)):

Legend:
 Removed from v.2626 changed lines Added in v.2627