Cone
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Runtime;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
public class Cone : Solid
{
internal IConeEntity ConeEntity => HostImpl as IConeEntity;
public Point StartPoint => Point.Wrap(ConeEntity.get_StartPoint(), true);
public Point EndPoint => Point.Wrap(ConeEntity.get_EndPoint(), true);
public double RadiusRatio => ConeEntity.get_RadiusRatio();
[Scaling()]
public double StartRadius {
get {
return ConeEntity.get_StartRadius() * DesignScriptEntity.scaleFactor;
}
}
[Scaling()]
public double EndRadius {
get {
return ConeEntity.get_EndRadius() * DesignScriptEntity.scaleFactor;
}
}
[Scaling()]
public double Height {
get {
return ConeEntity.get_Height() * DesignScriptEntity.scaleFactor;
}
}
internal Cone(IConeEntity host, bool persist)
: base(host, persist)
{
}
public override string ToString()
{
string[] obj = new string[13] {
"Cone(StartPoint = ",
StartPoint?.ToString(),
", EndPoint = ",
EndPoint?.ToString(),
", RadiusRatio = ",
null,
null,
null,
null,
null,
null,
null,
null
};
double num = RadiusRatio;
obj[5] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[6] = ", StartRadius = ";
num = StartRadius;
obj[7] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[8] = ", EndRadius = ";
num = EndRadius;
obj[9] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[10] = ", Height = ";
num = Height;
obj[11] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
obj[12] = ")";
return string.Concat(obj);
}
internal new static void InitType()
{
Geometry.RegisterHostType(typeof(IConeEntity), (IGeometryEntity host, bool persist) => new Cone(host as IConeEntity, persist));
}
internal static Cone Wrap(IConeEntity host, bool persist = true)
{
return Geometry.Wrap(host, false, null) as Cone;
}
internal static Cone[] Wrap(IConeEntity[] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static Cone[][] Wrap(IConeEntity[][] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static IConeEntity[][] Unwrap(Cone[][] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IConeEntity[] Unwrap(Cone[] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IConeEntity[] Unwrap(IEnumerable<Cone> o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IConeEntity Unwrap(Cone o)
{
return o.ConeEntity;
}
public static Cone ByPointsRadius([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point startPoint, [DefaultArgument("Point.ByCoordinates(0, 0, 1)")] Point endPoint, [Scaling()] double startRadius = 1)
{
DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
startRadius
});
startRadius /= DesignScriptEntity.scaleFactor;
return Wrap(HostFactory.Factory.ConeByPointsRadius(Point.Unwrap(startPoint), Point.Unwrap(endPoint), startRadius), true);
}
public static Cone ByPointsRadii([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point startPoint, [DefaultArgument("Point.ByCoordinates(0, 0, 1)")] Point endPoint, [Scaling()] double startRadius = 1, [Scaling()] double endRadius = 1)
{
DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
startRadius,
endRadius
});
startRadius /= DesignScriptEntity.scaleFactor;
endRadius /= DesignScriptEntity.scaleFactor;
return Wrap(HostFactory.Factory.ConeByPointsRadii(Point.Unwrap(startPoint), Point.Unwrap(endPoint), startRadius, endRadius), true);
}
public static Cone ByCoordinateSystemHeightRadius([DefaultArgument("CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem cs, [Scaling()] double height = 1, [Scaling()] double startRadius = 1)
{
DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
height,
startRadius
});
height /= DesignScriptEntity.scaleFactor;
startRadius /= DesignScriptEntity.scaleFactor;
return Wrap(HostFactory.Factory.ConeByCoordinateSystemHeightRadius(CoordinateSystem.Unwrap(cs), height, startRadius), true);
}
public static Cone ByCoordinateSystemHeightRadii([DefaultArgument("CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem cs, [Scaling()] double height = 1, [Scaling()] double startRadius = 1, [Scaling()] double endRadius = 1)
{
DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
height,
startRadius,
endRadius
});
height /= DesignScriptEntity.scaleFactor;
startRadius /= DesignScriptEntity.scaleFactor;
endRadius /= DesignScriptEntity.scaleFactor;
return Wrap(HostFactory.Factory.ConeByCoordinateSystemHeightRadii(CoordinateSystem.Unwrap(cs), height, startRadius, endRadius), true);
}
}
}