Helix
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Runtime;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
public class Helix : Curve
{
internal IHelixEntity HelixEntity => HostImpl as IHelixEntity;
public double Angle => HelixEntity.get_Angle();
[Scaling()]
public double Pitch {
get {
return HelixEntity.get_Pitch() * DesignScriptEntity.scaleFactor;
}
}
[Scaling()]
public double Radius {
get {
return HelixEntity.get_Radius() * DesignScriptEntity.scaleFactor;
}
}
[Scaling()]
public Vector AxisDirection {
get {
return Vector.Wrap(HelixEntity.get_AxisDirection().Scale(1 / DesignScriptEntity.scaleFactor), true);
}
}
public Point AxisPoint => Point.Wrap(HelixEntity.get_AxisPoint(), true);
internal Helix(IHelixEntity host, bool persist)
: base(host, persist)
{
}
public override string ToString()
{
string[] obj = new string[11] {
"Helix(Angle = ",
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
};
double num = Angle;
obj[1] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[2] = ", Pitch = ";
num = Pitch;
obj[3] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[4] = ", Radius = ";
num = Radius;
obj[5] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[6] = ", AxisDirection = ";
obj[7] = AxisDirection?.ToString();
obj[8] = ", AxisPoint = ";
obj[9] = AxisPoint?.ToString();
obj[10] = ")";
return string.Concat(obj);
}
internal new static void InitType()
{
Geometry.RegisterHostType(typeof(IHelixEntity), (IGeometryEntity host, bool persist) => new Helix(host as IHelixEntity, persist));
}
internal static Helix Wrap(IHelixEntity host, bool persist = true)
{
if (host == null)
return null;
return new Helix(host, persist);
}
internal static Helix[] Wrap(IHelixEntity[] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static Helix[][] Wrap(IHelixEntity[][] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static IHelixEntity[][] Unwrap(Helix[][] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IHelixEntity[] Unwrap(Helix[] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IHelixEntity[] Unwrap(IEnumerable<Helix> o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IHelixEntity Unwrap(Helix o)
{
return o.HelixEntity;
}
public static Helix ByAxis([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point axisPoint, [DefaultArgument("Vector.ByCoordinates(0, 0, 1)")] Vector axisDirection, [DefaultArgument("Point.ByCoordinates(1, 0, 0)")] Point startPoint, [Scaling()] double pitch = 1, double angleTurns = 360)
{
DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
pitch
});
pitch /= DesignScriptEntity.scaleFactor;
return Wrap(HostFactory.Factory.HelixByAxis(Point.Unwrap(axisPoint), Vector.Unwrap(axisDirection), Point.Unwrap(startPoint), pitch, angleTurns), true);
}
}
}