Cylinder
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Runtime;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
public class Cylinder : Cone
{
internal ICylinderEntity CylinderEntity => HostImpl as ICylinderEntity;
public double Radius => CylinderEntity.get_Radius();
internal Cylinder(ICylinderEntity host, bool persist)
: base(host, persist)
{
}
public override string ToString()
{
return "Cylinder(Radius = " + Radius.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture) + ")";
}
internal new static void InitType()
{
Geometry.RegisterHostType(typeof(ICylinderEntity), (IGeometryEntity host, bool persist) => new Cylinder(host as ICylinderEntity, persist));
}
internal static Cylinder Wrap(ICylinderEntity host, bool persist = true)
{
return Geometry.Wrap(host, false, null) as Cylinder;
}
internal static Cylinder[] Wrap(ICylinderEntity[] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static Cylinder[][] Wrap(ICylinderEntity[][] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static ICylinderEntity[][] Unwrap(Cylinder[][] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static ICylinderEntity[] Unwrap(Cylinder[] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static ICylinderEntity[] Unwrap(IEnumerable<Cylinder> o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static ICylinderEntity Unwrap(Cylinder o)
{
return o.CylinderEntity;
}
public static Cylinder ByRadiusHeight([DefaultArgument("CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem cs, double radius = 1, double height = 1)
{
return Wrap(HostFactory.Factory.CylinderByRadiusHeight(CoordinateSystem.Unwrap(cs), radius, height), true);
}
public new static Cylinder ByPointsRadius([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point startPoint, [DefaultArgument("Point.ByCoordinates(0, 0, 1)")] Point endPoint, double radius = 1)
{
return Wrap(HostFactory.Factory.CylinderByPointsRadius(Point.Unwrap(startPoint), Point.Unwrap(endPoint), radius), true);
}
}
}