本文整理汇总了C#中Autodesk.ToNurbsCurve方法的典型用法代码示例。如果您正苦于以下问题:C# Autodesk.ToNurbsCurve方法的具体用法?C# Autodesk.ToNurbsCurve怎么用?C# Autodesk.ToNurbsCurve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autodesk
的用法示例。
在下文中一共展示了Autodesk.ToNurbsCurve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Convert
/// <summary>
/// Convert a generic Circle to a Revit Curve
/// </summary>
/// <param name="crvCurve"></param>
/// <returns></returns>
private static Autodesk.Revit.DB.Curve Convert(Autodesk.DesignScript.Geometry.Curve crvCurve)
{
Autodesk.DesignScript.Geometry.Curve[] curves = crvCurve.ApproximateWithArcAndLineSegments();
if (curves.Length == 1)
{
//line or arc?
var point0 = crvCurve.PointAtParameter(0.0);
var point1 = crvCurve.PointAtParameter(1.0);
var pointMid = crvCurve.PointAtParameter(0.5);
if (point0.DistanceTo(point1) > 1e-7)
{
var line = Autodesk.DesignScript.Geometry.Line.ByStartPointEndPoint(point0, point1);
if (pointMid.DistanceTo(line) < 1e-7)
return Convert(line);
}
//then arc
if (point0.DistanceTo(point1) < 1e-7)
point1 = crvCurve.PointAtParameter(0.9);
var arc = Autodesk.DesignScript.Geometry.Arc.ByThreePoints(point0, pointMid, point1);
return Convert(arc);
}
return Convert(crvCurve.ToNurbsCurve());
}