5 posts
Djordje (djordje) wrote:
Been looking at the RhinoCommon code below the rhinoscriptsyntax.AddCircle() function, and it seems it supports guids as input too:
def AddCircle(plane_or_center, radius):
"""Adds a circle curve to the document
Parameters:
plane_or_center = plane on which the circle will lie. If a point is
passed, this will be the center of the circle on the active
construction plane
radius = the radius of the circle
Returns:
id of the new curve object
"""
rc = None
plane = rhutil.coerceplane(plane_or_center, False)
if plane:
circle = Rhino.Geometry.Circle(plane, radius)
rc = scriptcontext.doc.Objects.AddCircle(circle)
else:
center = rhutil.coerce3dpoint(plane_or_center, True)
view = scriptcontext.doc.Views.ActiveView
plane = view.ActiveViewport.ConstructionPlane()
plane.Origin = center
circle = Rhino.Geometry.Circle(plane, radius)
rc = scriptcontext.doc.Objects.AddCircle(circle)
if rc==System.Guid.Empty: raise Exception("Unable to add circle to document")
scriptcontext.doc.Views.Redraw()
return rc
That's the purpose of utility.coerce3dpoint(), right? Converting guid into Point3d object.
If that is so, than AddCircle's function help file, needs an addition:
--
*Parameters:
plane_or_center
Required. Plane, Point3d, list of 3 numbers or center point's identifier. The plane on which the circle will lie. The origin of the plane will be the center point of the circle. If a list of three numbers or a Point3d is supplied, the active view plane is used*
--
?