Click or drag to resize

BrepCreateFromRevSurface Method

Constructs a brep form of a surface of revolution.

Namespace:  Rhino.Geometry
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.0
Syntax
public static Brep CreateFromRevSurface(
	RevSurface surface,
	bool capStart,
	bool capEnd
)

Parameters

surface
Type: Rhino.GeometryRevSurface
The surface of revolution.
capStart
Type: SystemBoolean
if true, the start of the revolute is not on the axis of revolution, and the surface of revolution is closed, then a circular cap will be added to close of the hole at the start of the revolute.
capEnd
Type: SystemBoolean
if true, the end of the revolute is not on the axis of revolution, and the surface of revolution is closed, then a circular cap will be added to close of the hole at the end of the revolute.

Return Value

Type: Brep
A Brep if successful, null on error.
Examples
using System;
using Rhino.Geometry;

partial class Examples
{
  public static Rhino.Commands.Result AddTruncatedCone(Rhino.RhinoDoc doc)
  {
    Point3d bottom_pt = new Point3d(0,0,0);
    const double bottom_radius = 2;
    Circle bottom_circle = new Circle(bottom_pt, bottom_radius);

    Point3d top_pt = new Point3d(0,0,10);
    const double top_radius = 6;
    Circle top_circle = new Circle(top_pt, top_radius);

    LineCurve shapeCurve = new LineCurve(bottom_circle.PointAt(0), top_circle.PointAt(0));
    Line axis = new Line(bottom_circle.Center, top_circle.Center);
    RevSurface revsrf = RevSurface.Create(shapeCurve, axis);
    Brep tcone_brep = Brep.CreateFromRevSurface(revsrf, true, true);
    if( doc.Objects.AddBrep(tcone_brep) != Guid.Empty )
    {
      doc.Views.Redraw();
      return Rhino.Commands.Result.Success;
    }
    return Rhino.Commands.Result.Failure;
  }
}
Python
import Rhino
import scriptcontext
import System.Guid

def AddTruncatedCone():
    bottom_pt = Rhino.Geometry.Point3d(0,0,0)
    bottom_radius = 2
    bottom_circle = Rhino.Geometry.Circle(bottom_pt, bottom_radius)

    top_pt = Rhino.Geometry.Point3d(0,0,10)
    top_radius = 6
    top_circle = Rhino.Geometry.Circle(top_pt, top_radius)

    shapeCurve = Rhino.Geometry.LineCurve(bottom_circle.PointAt(0), top_circle.PointAt(0))
    axis = Rhino.Geometry.Line(bottom_circle.Center, top_circle.Center)
    revsrf = Rhino.Geometry.RevSurface.Create(shapeCurve, axis)
    tcone_brep = Rhino.Geometry.Brep.CreateFromRevSurface(revsrf, True, True)

    if scriptcontext.doc.Objects.AddBrep(tcone_brep)!=System.Guid.Empty:
        scriptcontext.doc.Views.Redraw()
        return Rhino.Commands.Result.Success
    return Rhino.Commands.Result.Failure


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