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;
[Scaling()]
public double Radius {
get {
return CylinderEntity.get_Radius() * DesignScriptEntity.scaleFactor;
}
}
[Scaling()]
public new double Height {
get {
return CylinderEntity.get_Height() * DesignScriptEntity.scaleFactor;
}
}
public Vector Axis => Vector.Wrap(CylinderEntity.get_Axis(), true);
internal Cylinder(ICylinderEntity host, bool persist)
: base(host, persist)
{
}
public override string ToString()
{
object[] obj = new object[7] {
"Cylinder(Radius = ",
null,
null,
null,
null,
null,
null
};
double num = Radius;
obj[1] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[2] = ", Height = ";
num = Height;
obj[3] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[4] = ", Axis = ";
obj[5] = Axis;
obj[6] = ")";
return string.Concat(obj);
}
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, [Scaling()] double radius = 1, [Scaling()] double height = 1)
{
DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
radius,
height
});
radius /= DesignScriptEntity.scaleFactor;
height /= DesignScriptEntity.scaleFactor;
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, [Scaling()] double radius = 1)
{
DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
radius
});
radius /= DesignScriptEntity.scaleFactor;
return Wrap(HostFactory.Factory.CylinderByPointsRadius(Point.Unwrap(startPoint), Point.Unwrap(endPoint), radius), true);
}
}
}