rs.AddEllipse

grasshopper

(Petozatko89) #1

Hi there,

I´m trying my scripts from rhino 5 in rhino 6, and came across one problem.


This is obviously a part of a much longer code, but just the Addellipse is not willing for me to work in Rhino 6 GH
any hints anybody ?

thanks,
Peter


(Giulio Piacentino) #4

Sorry, @petozatko89

in an attempt to improve the rs.AddEllipse functionality, it appears that I broke it.
I added the RH-44622 bug report.

For now, you can use this function that will work around the issue:

def AddEllipse(plane, radiusX, radiusY):
    import Rhino, scriptcontext, System #only required if used freely
    plane = rs.coerceplane(plane, True)
    ellipse = Rhino.Geometry.Ellipse(plane, radiusX, radiusY)
    rc = scriptcontext.doc.Objects.AddCurve(ellipse.ToNurbsCurve())
    if rc==System.Guid.Empty: raise Exception("Unable to add curve to document")
    scriptcontext.doc.Views.Redraw()
    return rc


Or, you can change the line:

rc = scriptcontext.doc.Objects.AddEllipse(ellipse)
to
rc = scriptcontext.doc.Objects.AddCurve(ellipse.ToNurbsCurve())

in the file

%appdata%\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\curve.py

I hope this is helpful,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


(Petozatko89) #7

Hi @piac,

No problem, that´s why we´re here :slight_smile:
I changed the curve.py, and now it works.

thank you