Cylinder
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Runtime;
using ProtoGeometryGenerator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Autodesk.DesignScript.Geometry
{
[GenerateFromInterface(typeof(ICylinderEntity), typeof(IGeometryFactory), new Type[] {
})]
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());
internal Cylinder(ICylinderEntity host)
: base(host)
{
}
internal new static void InitType()
{
Geometry.RegisterHostType(typeof(ICylinderEntity), (IGeometryEntity host) => new Cylinder(host as ICylinderEntity));
}
public static Cylinder ByRadiusHeight([DefaultArgument("Autodesk.DesignScript.Geometry.CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem coordinateSystem, [Scaling()] double radius = 1, [Scaling()] double height = 1)
{
DesignScriptEntity.CheckArgsForAsmExtents(radius, height);
return Wrap(HostFactory.Factory.CylinderByRadiusHeight(CoordinateSystem.Unwrap(coordinateSystem), radius / DesignScriptEntity.scaleFactor, height / DesignScriptEntity.scaleFactor));
}
public new static Cylinder ByPointsRadius([DefaultArgument("Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0)")] Point startPoint, [DefaultArgument("Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 1)")] Point endPoint, [Scaling()] double radius = 1)
{
DesignScriptEntity.CheckArgsForAsmExtents(radius);
return Wrap(HostFactory.Factory.CylinderByPointsRadius(Point.Unwrap(startPoint), Point.Unwrap(endPoint), radius / DesignScriptEntity.scaleFactor));
}
internal static Cylinder Wrap(ICylinderEntity host)
{
if (host != null)
return new Cylinder(host);
return null;
}
internal static Cylinder[] Wrap(ICylinderEntity[] hosts)
{
return hosts.Select(Wrap).ToArray();
}
internal static Cylinder[][] Wrap(ICylinderEntity[][] hosts)
{
return hosts.Select(Wrap).ToArray();
}
internal static ICylinderEntity Unwrap(Cylinder o)
{
return o.CylinderEntity;
}
internal static ICylinderEntity[] Unwrap(IEnumerable<Cylinder> o)
{
return o.Select(Unwrap).ToArray();
}
internal static ICylinderEntity[] Unwrap(Cylinder[] o)
{
return o.Select(Unwrap).ToArray();
}
internal static ICylinderEntity[][] Unwrap(Cylinder[][] o)
{
return o.Select(Unwrap).ToArray();
}
public override string ToString()
{
StringBuilder builder = DesignScriptEntity.GetBuilder();
AppendTo(builder);
return builder.ToString();
}
internal override void AppendTo(StringBuilder builder)
{
builder.Add("Cylinder(Radius = ", Radius).Add(", Height = ", Height).Add(", Axis = ", Axis)
.Append(")");
}
}
}