Rs.AddCircle() supports guids as an agrument too?


#1

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*

?


(Steve Baer) #2

You are correct, thanks. I changed the documentation for plane_or_center to read

Required. Plane, Point3d, list of 3 numbers, or identifier of a point object.  The
plane on which the circle will lie. The origin of the plane will be the center point
of the circle. If the input is a “point” and not a plane, the active view plane is
used.

Does this work for you?


#3

Thank you Steve.
Perfect.

If by chance I went onto some typo or similar, do I need to post that topic here, or at github?
I believe github might be a more convenient place, but in here reply arrives faster, more people can see it, and in the end - it might not be a typo after all - but some code mistake caused by me?


(Steve Baer) #4

Whatever is more convenient for you. I check both places and usually end up creating a github issue if it isn’t something that I will be able to get to within a reasonable amount of time.


#5

Got it. Thanks.