Double check RCommon

import Rhino
import scriptcontext
 
def CircleCenter():
    go = Rhino.Input.Custom.GetObject()
    go.SetCommandPrompt("Select objects")
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve
    go.GeometryAttributeFilter = Rhino.Input.Custom.GeometryAttributeFilter.ClosedCurve
    go.GetMultiple(1, 0)
    if go.CommandResult()!=Rhino.Commands.Result.Success:
        return go.CommandResult()
 
    objrefs = go.Objects()
    if not objrefs: return Rhino.Commands.Result.Nothing

I was wondering why the double check to see if a command was successful?

if in the first if the result is Success, it means that the method has taken a closed curve, then the second if it would not be necessary. . . :thinking:

Old C++ habits die hard…

2 Likes