Arc
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Runtime;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
public class Arc : Curve
{
internal IArcEntity ArcEntity => HostImpl as IArcEntity;
public Point CenterPoint => Point.Wrap(ArcEntity.get_CenterPoint(), true);
[Scaling()]
public double Radius {
get {
return ArcEntity.get_Radius() * DesignScriptEntity.scaleFactor;
}
}
public double StartAngle => ArcEntity.get_StartAngle();
public double SweepAngle => ArcEntity.get_SweepAngle();
internal Arc(IArcEntity host, bool persist)
: base(host, persist)
{
}
public override string ToString()
{
object[] obj = new object[11] {
"Arc(Normal = ",
base.Normal,
", CenterPoint = ",
CenterPoint,
", Radius = ",
null,
null,
null,
null,
null,
null
};
double num = Radius;
obj[5] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[6] = ", StartAngle = ";
num = StartAngle;
obj[7] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[8] = ", SweepAngle = ";
num = SweepAngle;
obj[9] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[10] = ")";
return string.Concat(obj);
}
internal new static void InitType()
{
Geometry.RegisterHostType(typeof(IArcEntity), (IGeometryEntity host, bool persist) => new Arc(host as IArcEntity, persist));
}
internal static Arc Wrap(IArcEntity host, bool persist = true)
{
return Geometry.Wrap(host, false, null) as Arc;
}
internal static Arc[] Wrap(IArcEntity[] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static Arc[][] Wrap(IArcEntity[][] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static IArcEntity[][] Unwrap(Arc[][] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IArcEntity[] Unwrap(Arc[] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IArcEntity[] Unwrap(IEnumerable<Arc> o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IArcEntity Unwrap(Arc o)
{
return o.ArcEntity;
}
public static Arc ByThreePoints(Point firstPoint, Point secondPoint, Point thirdPoint)
{
return Wrap(HostFactory.Factory.ArcByThreePoints(Point.Unwrap(firstPoint), Point.Unwrap(secondPoint), Point.Unwrap(thirdPoint)), true);
}
public static Arc ByCenterPointRadiusAngle([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point center, [DefaultArgument("1")] [Scaling()] double radius, [DefaultArgument("0")] double startAngle, [DefaultArgument("90")] double endAngle, [DefaultArgument("Vector.ByCoordinates(0, 0, 1)")] Vector normal)
{
radius /= DesignScriptEntity.scaleFactor;
return Wrap(HostFactory.Factory.ArcByCenterPointRadiusAngle(Point.Unwrap(center), radius, startAngle, endAngle, Vector.Unwrap(normal)), true);
}
public static Arc ByCenterPointStartPointSweepAngle([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point centerPoint, [DefaultArgument("Point.ByCoordinates(1, 0, 0)")] Point startPoint, [DefaultArgument("90")] double sweepAngle, [DefaultArgument("Vector.ByCoordinates(0, 0, 1)")] Vector normal)
{
return Wrap(HostFactory.Factory.ArcByCenterPointStartPointSweepAngle(Point.Unwrap(centerPoint), Point.Unwrap(startPoint), sweepAngle, Vector.Unwrap(normal)), true);
}
public static Arc ByCenterPointStartPointEndPoint([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point centerPoint, [DefaultArgument("Point.ByCoordinates(1, 0, 0)")] Point startPoint, [DefaultArgument("Point.ByCoordinates(0, 1, 0)")] Point endPoint)
{
return Wrap(HostFactory.Factory.ArcByCenterPointStartPointEndPoint(Point.Unwrap(centerPoint), Point.Unwrap(startPoint), Point.Unwrap(endPoint)), true);
}
public static Arc ByFillet(Curve curve1, Curve curve2, [Scaling()] double radius)
{
radius /= DesignScriptEntity.scaleFactor;
return Wrap(HostFactory.Factory.ArcByFillet(Curve.Unwrap(curve1), Curve.Unwrap(curve2), radius), true);
}
public static Arc ByFilletTangentToCurve(Curve curve1, Curve curveTangentTo, Curve curve2)
{
return Wrap(HostFactory.Factory.ArcByFilletTangentToCurve(Curve.Unwrap(curve1), Curve.Unwrap(curveTangentTo), Curve.Unwrap(curve2)), true);
}
public static Arc ByBestFitThroughPoints(IEnumerable<Point> points)
{
return Wrap(HostFactory.Factory.ArcByBestFitThroughPoints(Point.Unwrap(points)), true);
}
public static Arc[] ByStartEndAndTangencies(Point point1, Vector vector1, Point point2, Vector vector2)
{
return Wrap(HostFactory.Factory.ArcByStartEndAndTangencies(Point.Unwrap(point1), Vector.Unwrap(vector1), Point.Unwrap(point2), Vector.Unwrap(vector2)), true);
}
public static Arc ByStartPointEndPointStartTangent(Point startPoint, Point endPoint, Vector startTangent)
{
return Wrap(HostFactory.Factory.ArcByStartPointEndPointStartTangent(Point.Unwrap(startPoint), Point.Unwrap(endPoint), Vector.Unwrap(startTangent)), true);
}
}
}