M_Rhino_Geometry_Brep_CreateFromLoft - mcneel/rhinocommon-api-docs GitHub Wiki

Brep.CreateFromLoft Method

Constructs one or more Breps by lofting through a set of curves.

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

Syntax

C#

public static Brep[] CreateFromLoft(
	IEnumerable<Curve> curves,
	Point3d start,
	Point3d end,
	LoftType loftType,
	bool closed
)

VB

Public Shared Function CreateFromLoft ( 
	curves As IEnumerable(Of Curve),
	start As Point3d,
	end As Point3d,
	loftType As LoftType,
	closed As Boolean
) As Brep()

Parameters

 

curves
Type: System.Collections.Generic.IEnumerable(Curve)
The curves to loft through. This function will not perform any curve sorting. You must pass in curves in the order you want them lofted. This function will not adjust the directions of open curves. Use Curve.DoDirectionsMatch and Curve.Reverse to adjust the directions of open curves. This function will not adjust the seams of closed curves. Use Curve.ChangeClosedCurveSeam to adjust the seam of closed curves.
start
Type: Rhino.Geometry.Point3d
Optional starting point of loft. Use Point3d.Unset if you do not want to include a start point.
end
Type: Rhino.Geometry.Point3d
Optional ending point of loft. Use Point3d.Unset if you do not want to include an end point.
loftType
Type: Rhino.Geometry.LoftType
type of loft to perform.
closed
Type: System.Boolean
true if the last curve in this loft should be connected back to the first one.

Return Value

Type: Brep[]
Constructs a closed surface, continuing the surface past the last curve around to the first curve. Available when you have selected three shape curves.

Examples

VB

Imports Rhino
Imports Rhino.Input.Custom
Imports Rhino.DocObjects
Imports Rhino.Commands
Imports System.Collections.Generic
Imports Rhino.Geometry

Namespace examples_vb
  Public Class LoftCommand
    Inherits Command
    Public Overrides ReadOnly Property EnglishName() As String
      Get
        Return "vbLoft"
      End Get
    End Property

    Protected Overrides Function RunCommand(doc As RhinoDoc, mode As Rhino.Commands.RunMode) As Result
      ' select curves to loft
      Dim gs = New GetObject()
      gs.SetCommandPrompt("select curves to loft")
      gs.GeometryFilter = ObjectType.Curve
      gs.DisablePreSelect()
      gs.SubObjectSelect = False
      gs.GetMultiple(2, 0)
      If gs.CommandResult() <> Result.Success Then
        Return gs.CommandResult()
      End If

      Dim curves = New List(Of Curve)()
      For Each obj As ObjRef In gs.Objects()
        curves.Add(obj.Curve())
      Next

      Dim breps = Rhino.Geometry.Brep.CreateFromLoft(curves, Point3d.Unset, Point3d.Unset, LoftType.Tight, False)
      For Each brep As Brep In breps
        doc.Objects.AddBrep(brep)
      Next

      doc.Views.Redraw()
      Return Result.Success
    End Function
  End Class
End Namespace

C#

using System.Linq;
using Rhino;
using Rhino.Input.Custom;
using Rhino.DocObjects;
using Rhino.Commands;
using Rhino.Geometry;

namespace examples_cs
{
  public class LoftCommand : Command
  {
    public override string EnglishName { get { return "csLoft"; } }

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      // select curves to loft
      var gs = new GetObject();
      gs.SetCommandPrompt("select curves to loft");
      gs.GeometryFilter = ObjectType.Curve;
      gs.DisablePreSelect();
      gs.SubObjectSelect = false;
      gs.GetMultiple(2, 0);
      if (gs.CommandResult() != Result.Success)
        return gs.CommandResult();

      var curves = gs.Objects().Select(obj => obj.Curve()).ToList();

      var breps = Brep.CreateFromLoft(curves, Point3d.Unset, Point3d.Unset, LoftType.Tight, false);
      foreach (var brep in breps)
        doc.Objects.AddBrep(brep);

      doc.Views.Redraw();
      return Result.Success;
    }
  }
}

Python

import rhinoscriptsyntax as rs

def RunCommand():
  crvids = rs.GetObjects(message="select curves to loft", filter=rs.filter.curve, minimum_count=2)
  if not crvids: return

  rs.AddLoftSrf(object_ids=crvids, loft_type = 3) #3 = tight

if __name__ == "__main__":
  RunCommand()

Version Information

Supported in: 6.0.16224.21491, 5D58w

See Also

Reference

Brep Class
Rhino.Geometry Namespace

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