Click or drag to resize

Sphere Constructor (Point3d, Double)

Initializes a new sphere given center point and radius.

Namespace:  Rhino.Geometry
Assembly:  RhinoCommon (in RhinoCommon.dll)
Syntax
public Sphere(
	Point3d center,
	double radius
)

Parameters

center
Type: Rhino.GeometryPoint3d
A center point.
radius
Type: SystemDouble
A radius value.
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;
  }
}
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()
Version Information

Rhino for Mac

Supported in: 5.4

Rhino for Windows

Supported in: 6.5
See Also