M_Rhino_Geometry_Brep_CreateFromRevSurface - mcneel/rhinocommon-api-docs GitHub Wiki

Brep.CreateFromRevSurface Method

Constructs a brep form of a surface of revolution.

Namespace: Rhino.Geometry
Assembly: RhinoCommon (in RhinoCommon.dll) Version: Rhino 6.0

Syntax

C#

public static Brep CreateFromRevSurface(
	RevSurface surface,
	bool capStart,
	bool capEnd
)

VB

Public Shared Function CreateFromRevSurface ( 
	surface As RevSurface,
	capStart As Boolean,
	capEnd As Boolean
) As Brep

Parameters

 

surface
Type: Rhino.Geometry.RevSurface
The surface of revolution.
capStart
Type: System.Boolean
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: System.Boolean
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 new brep, on null on error.

Examples

VB

Imports Rhino.Geometry

Partial Class Examples
  Public Shared Function AddTruncatedCone(ByVal doc As Rhino.RhinoDoc) As Rhino.Commands.Result
    Dim bottom_pt As New Point3d(0, 0, 0)
    Const bottom_radius As Double = 2
    Dim bottom_circle As New Circle(bottom_pt, bottom_radius)

    Dim top_pt As New Point3d(0, 0, 10)
    Const top_radius As Double = 6
    Dim top_circle As New Circle(top_pt, top_radius)

    Dim shapeCurve As New LineCurve(bottom_circle.PointAt(0), top_circle.PointAt(0))
    Dim axis As New Line(bottom_circle.Center, top_circle.Center)
    Dim revsrf As RevSurface = RevSurface.Create(shapeCurve, axis)
    Dim tcone_brep As Brep = Brep.CreateFromRevSurface(revsrf, True, True)
    If doc.Objects.AddBrep(tcone_brep) <> Guid.Empty Then
      doc.Views.Redraw()
      Return Rhino.Commands.Result.Success
    End If
    Return Rhino.Commands.Result.Failure
  End Function
End Class

C#

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()

Version Information

Supported in: 6.0.16224.21491, 5D58w

See Also

Reference

Brep Class
Rhino.Geometry Namespace

⚠️ **GitHub.com Fallback** ⚠️