EllipseArc
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Runtime;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
public class EllipseArc : Curve
{
internal IEllipseArcEntity EllipseArcEntity => HostImpl as IEllipseArcEntity;
public Point CenterPoint => Point.Wrap(EllipseArcEntity.get_CenterPoint(), true);
public Vector MajorAxis => Vector.Wrap(EllipseArcEntity.get_MajorAxis(), true);
public Vector MinorAxis => Vector.Wrap(EllipseArcEntity.get_MinorAxis(), true);
public double StartAngle => EllipseArcEntity.get_StartAngle();
public double SweepAngle => EllipseArcEntity.get_SweepAngle();
public Plane Plane => Plane.Wrap(EllipseArcEntity.get_Plane(), true);
internal EllipseArc(IEllipseArcEntity host, bool persist)
: base(host, persist)
{
}
public override string ToString()
{
string[] obj = new string[13] {
"EllipseArc(Normal = ",
base.Normal?.ToString(),
", CenterPoint = ",
CenterPoint?.ToString(),
", MajorAxis = ",
MajorAxis?.ToString(),
", MinorAxis = ",
MinorAxis?.ToString(),
", StartAngle = ",
null,
null,
null,
null
};
double num = StartAngle;
obj[9] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[10] = ", SweepAngle = ";
num = SweepAngle;
obj[11] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[12] = ")";
return string.Concat(obj);
}
internal new static void InitType()
{
Geometry.RegisterHostType(typeof(IEllipseArcEntity), (IGeometryEntity host, bool persist) => new EllipseArc(host as IEllipseArcEntity, persist));
}
internal static EllipseArc Wrap(IEllipseArcEntity host, bool persist = true)
{
if (host == null)
return null;
return new EllipseArc(host, persist);
}
internal static EllipseArc[] Wrap(IEllipseArcEntity[] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static EllipseArc[][] Wrap(IEllipseArcEntity[][] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static IEllipseArcEntity[][] Unwrap(EllipseArc[][] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IEllipseArcEntity[] Unwrap(EllipseArc[] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IEllipseArcEntity[] Unwrap(IEnumerable<EllipseArc> o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IEllipseArcEntity Unwrap(EllipseArc o)
{
return o.EllipseArcEntity;
}
public static EllipseArc ByPlaneRadiiAngles([DefaultArgument("Plane.XY()")] Plane plane, [Scaling()] double xRadius = 1, [Scaling()] double yRadius = 1, double startAngle = 0, double sweepAngle = 180)
{
DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
xRadius,
yRadius
});
xRadius /= DesignScriptEntity.scaleFactor;
yRadius /= DesignScriptEntity.scaleFactor;
return Wrap(HostFactory.Factory.EllipseArcByPlaneRadiiAngles(Plane.Unwrap(plane), xRadius, yRadius, startAngle, sweepAngle), true);
}
[SupressImportIntoVM]
[Obsolete("This method is deprecated and will be removed in a future version of Dynamo. Use EllipseArc.ByPlaneRadiiAngles instead")]
public static EllipseArc ByPlaneRadiiStartAngleSweepAngle([DefaultArgument("Plane.XY()")] Plane plane, [Scaling()] double xRadius = 1, [Scaling()] double yRadius = 1, double startAngle = 0, double sweepAngle = 180)
{
DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
xRadius,
yRadius
});
xRadius /= DesignScriptEntity.scaleFactor;
yRadius /= DesignScriptEntity.scaleFactor;
return Wrap(HostFactory.Factory.EllipseArcByPlaneRadiiStartAngleSweepAngle(Plane.Unwrap(plane), xRadius, yRadius, startAngle, sweepAngle), true);
}
}
}