Edit Code Site Developer

https://developer.rhino3d.com/api/rhinocommon/examples/addcircle

import Rhino
import scriptcontext
import System.Guid

def AddCircle():
    center = Rhino.Geometry.Point3d(0, 0, 0)
    radius = 10.0
    c = Rhino.Geometry.Circle(center, radius)
    if scriptcontext.doc.Objects.AddCircle(c)!=System.Guid.Empty:
        scriptcontext.doc.Views.Redraw()
        return Rhino.Commands.Result.Success
    return Rhino.Commands.Result.Failure

if __name__=="__main__":
    AddCircle()

immagine

It has happened several times that some parts of the code don’t work. . .

Wouldn’t it be advisable to be able to log in like in the forum and directly modify the code?
(and the change is confirmed after team checking)

Yes, there will probably be a fair amount of samples that worked in Py2 that don’t in Py3…

instead of
import System.Guid

use
from System import Guid

It is not a question of form, and generally, at the end of various other checks, I come to the conclusion that the copied code may contain minimal inconsistencies. Personally, several of these situations have happened to me which I have not reported due to their minimal importance, the suggestion was to make the changes without clogging up the forum.

I think I can get that fixed in the sample. Thanks for reporting it. I have gone thru a lot of the documentation. But there are many Samples out there that still probably have a problem.

1 Like

yes, over time I found several, I didn’t know if you would appreciate the report,
but if you’re interested I’ll let you know what I find. . .

1 Like

If you don’t want to post them on the forum, you can create a list and send it directly to tech support.

2 Likes