Click or drag to resize

ObjectTableAddSphere Method (Sphere)

[Missing <summary> documentation for "M:Rhino.DocObjects.Tables.ObjectTable.AddSphere(Rhino.Geometry.Sphere)"]

Namespace:  Rhino.DocObjects.Tables
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.0
Syntax
public Guid AddSphere(
	Sphere sphere
)

Parameters

sphere
Type: Rhino.GeometrySphere

[Missing <param name="sphere"/> documentation for "M:Rhino.DocObjects.Tables.ObjectTable.AddSphere(Rhino.Geometry.Sphere)"]

Return Value

Type: Guid

[Missing <returns> documentation for "M:Rhino.DocObjects.Tables.ObjectTable.AddSphere(Rhino.Geometry.Sphere)"]

Examples
using System;

partial class Examples
{
  public static Rhino.Commands.Result AddSphere(Rhino.RhinoDoc doc)
  {
    Rhino.Geometry.Point3d center = new Rhino.Geometry.Point3d(0, 0, 0);
    const double radius = 5.0;
    Rhino.Geometry.Sphere sphere = new Rhino.Geometry.Sphere(center, radius);
    if( doc.Objects.AddSphere(sphere) != Guid.Empty )
    {
      doc.Views.Redraw();
      return Rhino.Commands.Result.Success;
    }
    return Rhino.Commands.Result.Failure;
  }
}
Python
import Rhino
import scriptcontext
import System.Guid

def AddSphere():
    center = Rhino.Geometry.Point3d(0, 0, 0)
    radius = 5.0
    sphere = Rhino.Geometry.Sphere(center, radius)
    if scriptcontext.doc.Objects.AddSphere(sphere)!=System.Guid.Empty:
        scriptcontext.doc.Views.Redraw()
        return Rhino.Commands.Result.Success
    return Rhino.Commands.Result.Failure


if __name__ == "__main__":
    AddSphere()
See Also