M_Rhino_Geometry_Curve_CreateFilletCurves - mcneel/rhinocommon-api-docs GitHub Wiki
Creates a tangent arc between two curves and trims or extends the curves to the arc.
Namespace: Rhino.Geometry
Assembly: RhinoCommon (in RhinoCommon.dll) Version: Rhino 6.0
C#
public static Curve[] CreateFilletCurves(
Curve curve0,
Point3d point0,
Curve curve1,
Point3d point1,
double radius,
bool join,
bool trim,
bool arcExtension,
double tolerance,
double angleTolerance
)
VB
Public Shared Function CreateFilletCurves (
curve0 As Curve,
point0 As Point3d,
curve1 As Curve,
point1 As Point3d,
radius As Double,
join As Boolean,
trim As Boolean,
arcExtension As Boolean,
tolerance As Double,
angleTolerance As Double
) As Curve()
- curve0
- Type: Rhino.Geometry.Curve
The first curve to fillet. - point0
- Type: Rhino.Geometry.Point3d
A point on the first curve that is near the end where the fillet will be created. - curve1
- Type: Rhino.Geometry.Curve
The second curve to fillet. - point1
- Type: Rhino.Geometry.Point3d
A point on the second curve that is near the end where the fillet will be created. - radius
- Type: System.Double
The radius of the fillet. - join
- Type: System.Boolean
Join the output curves. - trim
- Type: System.Boolean
Trim copies of the input curves to the output fillet curve. - arcExtension
- Type: System.Boolean
Applies when arcs are filleted but need to be extended to meet the fillet curve or chamfer line. If true, then the arc is extended maintaining its validity. If false, then the arc is extended with a line segment, which is joined to the arc converting it to a polycurve. - tolerance
- Type: System.Double
The tolerance, generally the document's absolute tolerance. - angleTolerance
- Type: System.Double
[Missing documentation for "M:Rhino.Geometry.Curve.CreateFilletCurves(Rhino.Geometry.Curve,Rhino.Geometry.Point3d,Rhino.Geometry.Curve,Rhino.Geometry.Point3d,System.Double,System.Boolean,System.Boolean,System.Boolean,System.Double,System.Double)"]
Type: Curve[]
The results of the fillet operation. The number of output curves depends on the input curves and the values of the parameters that were used during the fillet operation. In most cases, the output array will contain either one or three curves, although two curves can be returned if the radius is zero and join = false. For example, if both join and trim = true, then the output curve will be a polycurve containing the fillet curve joined with trimmed copies of the input curves. If join = false and trim = true, then three curves, the fillet curve and trimmed copies of the input curves, will be returned. If both join and trim = false, then just the fillet curve is returned.
VB
Imports Rhino
Imports Rhino.Commands
Imports Rhino.Geometry
Imports Rhino.Input
Imports Rhino.DocObjects
Imports Rhino.Input.Custom
Namespace examples_vb
Public Class FilletCurvesCommand
Inherits Command
Public Overrides ReadOnly Property EnglishName() As String
Get
Return "vbFilletCurves"
End Get
End Property
Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result
Dim gc1 = New GetObject()
gc1.DisablePreSelect()
gc1.SetCommandPrompt("Select first curve to fillet (close to the end you want to fillet)")
gc1.GeometryFilter = ObjectType.Curve
gc1.GeometryAttributeFilter = GeometryAttributeFilter.OpenCurve
gc1.[Get]()
If gc1.CommandResult() <> Result.Success Then
Return gc1.CommandResult()
End If
Dim curve1_obj_ref = gc1.[Object](0)
Dim curve1 = curve1_obj_ref.Curve()
If curve1 Is Nothing Then
Return Result.Failure
End If
Dim curve1_point_near_end = curve1_obj_ref.SelectionPoint()
If curve1_point_near_end = Point3d.Unset Then
Return Result.Failure
End If
Dim gc2 = New GetObject()
gc2.DisablePreSelect()
gc2.SetCommandPrompt("Select second curve to fillet (close to the end you want to fillet)")
gc2.GeometryFilter = ObjectType.Curve
gc2.GeometryAttributeFilter = GeometryAttributeFilter.OpenCurve
gc2.[Get]()
If gc2.CommandResult() <> Result.Success Then
Return gc2.CommandResult()
End If
Dim curve2_obj_ref = gc2.[Object](0)
Dim curve2 = curve2_obj_ref.Curve()
If curve2 Is Nothing Then
Return Result.Failure
End If
Dim curve2_point_near_end = curve2_obj_ref.SelectionPoint()
If curve2_point_near_end = Point3d.Unset Then
Return Result.Failure
End If
Dim radius As Double = 0
Dim rc = RhinoGet.GetNumber("fillet radius", False, radius)
If rc <> Result.Success Then
Return rc
End If
Dim fillet_curve = Curve.CreateFilletCurves(curve1, curve1_point_near_end, curve2, curve2_point_near_end, radius, True, _
True, True, doc.ModelAbsoluteTolerance, doc.ModelAngleToleranceDegrees)
If fillet_curve Is Nothing OrElse fillet_curve.Length <> 1 Then
Return Result.Failure
End If
doc.Objects.AddCurve(fillet_curve(0))
doc.Views.Redraw()
Return rc
End Function
End Class
End Namespace
C#
using Rhino;
using Rhino.Commands;
using Rhino.Geometry;
using Rhino.Input;
using Rhino.DocObjects;
using Rhino.Input.Custom;
namespace examples_cs
{
public class FilletCurvesCommand : Command
{
public override string EnglishName { get { return "csFilletCurves"; } }
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
var gc1 = new GetObject();
gc1.DisablePreSelect();
gc1.SetCommandPrompt("Select first curve to fillet (close to the end you want to fillet)");
gc1.GeometryFilter = ObjectType.Curve;
gc1.GeometryAttributeFilter = GeometryAttributeFilter.OpenCurve;
gc1.Get();
if (gc1.CommandResult() != Result.Success)
return gc1.CommandResult();
var curve1_obj_ref = gc1.Object(0);
var curve1 = curve1_obj_ref.Curve();
if (curve1 == null) return Result.Failure;
var curve1_point_near_end = curve1_obj_ref.SelectionPoint();
if (curve1_point_near_end == Point3d.Unset)
return Result.Failure;
var gc2 = new GetObject();
gc2.DisablePreSelect();
gc2.SetCommandPrompt("Select second curve to fillet (close to the end you want to fillet)");
gc2.GeometryFilter = ObjectType.Curve;
gc2.GeometryAttributeFilter = GeometryAttributeFilter.OpenCurve;
gc2.Get();
if (gc2.CommandResult() != Result.Success)
return gc2.CommandResult();
var curve2_obj_ref = gc2.Object(0);
var curve2 = curve2_obj_ref.Curve();
if (curve2 == null) return Result.Failure;
var curve2_point_near_end = curve2_obj_ref.SelectionPoint();
if (curve2_point_near_end == Point3d.Unset)
return Result.Failure;
double radius = 0;
var rc = RhinoGet.GetNumber("fillet radius", false, ref radius);
if (rc != Result.Success) return rc;
var join = false;
var trim = true;
var arc_extension = true;
var fillet_curves = Curve.CreateFilletCurves(curve1, curve1_point_near_end, curve2, curve2_point_near_end, radius,
join, trim, arc_extension, doc.ModelAbsoluteTolerance, doc.ModelAngleToleranceDegrees);
if (fillet_curves == null /*|| fillet_curves.Length != 3*/)
return Result.Failure;
foreach(var fillet_curve in fillet_curves)
doc.Objects.AddCurve(fillet_curve);
doc.Views.Redraw();
return rc;
}
}
}
Python
from Rhino import *
from Rhino.Commands import *
from Rhino.Geometry import *
from Rhino.Input import *
from Rhino.DocObjects import *
from Rhino.Input.Custom import *
from scriptcontext import doc
def RunCommand():
gc1 = GetObject()
gc1.DisablePreSelect()
gc1.SetCommandPrompt("Select first curve to fillet (close to the end you want to fillet)")
gc1.GeometryFilter = ObjectType.Curve
gc1.GeometryAttributeFilter = GeometryAttributeFilter.OpenCurve
gc1.Get()
if gc1.CommandResult() != Result.Success:
return gc1.CommandResult()
curve1_obj_ref = gc1.Object(0)
curve1 = curve1_obj_ref.Curve()
if curve1 == None: return Result.Failure
curve1_point_near_end = curve1_obj_ref.SelectionPoint()
if curve1_point_near_end == Point3d.Unset:
return Result.Failure
gc2 = GetObject()
gc2.DisablePreSelect()
gc2.SetCommandPrompt("Select second curve to fillet (close to the end you want to fillet)")
gc2.GeometryFilter = ObjectType.Curve
gc2.GeometryAttributeFilter = GeometryAttributeFilter.OpenCurve
gc2.Get()
if gc2.CommandResult() != Result.Success:
return gc2.CommandResult()
curve2_obj_ref = gc2.Object(0)
curve2 = curve2_obj_ref.Curve()
if curve2 == None: return Result.Failure
curve2_point_near_end = curve2_obj_ref.SelectionPoint()
if curve2_point_near_end == Point3d.Unset:
return Result.Failure
radius = 0.0
rc, radius = RhinoGet.GetNumber("fillet radius", False, radius)
if rc != Result.Success: return rc
fillet_curve = Curve.CreateFilletCurves(curve1, curve1_point_near_end, curve2, curve2_point_near_end, radius,
True, True, True, doc.ModelAbsoluteTolerance, doc.ModelAngleToleranceDegrees)
if fillet_curve == None or fillet_curve.Length != 1:
return Result.Failure
doc.Objects.AddCurve(fillet_curve[0])
doc.Views.Redraw()
return rc
if __name__ == "__main__":
RunCommand()
Supported in: 6.0.16224.21491, 5D58w