Cuboid
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Runtime;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
    public class Cuboid : Solid
    {
        internal ICuboidEntity CuboidEntity => HostImpl as ICuboidEntity;
        [Scaling()]
        public double Length {
            get {
                return CuboidEntity.get_Length() * DesignScriptEntity.scaleFactor;
            }
        }
        [Scaling()]
        public double Width {
            get {
                return CuboidEntity.get_Width() * DesignScriptEntity.scaleFactor;
            }
        }
        [Scaling()]
        public double Height {
            get {
                return CuboidEntity.get_Height() * DesignScriptEntity.scaleFactor;
            }
        }
        internal Cuboid(ICuboidEntity host, bool persist)
            : base(host, persist)
        {
        }
        public override string ToString()
        {
            string[] obj = new string[7] {
                "Cuboid(Length = ",
                null,
                null,
                null,
                null,
                null,
                null
            };
            double num = Length;
            obj[1] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
            obj[2] = ", Width = ";
            num = Width;
            obj[3] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
            obj[4] = ", Height = ";
            num = Height;
            obj[5] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture);
            obj[6] = ")";
            return string.Concat(obj);
        }
        internal new static void InitType()
        {
            Geometry.RegisterHostType(typeof(ICuboidEntity), (IGeometryEntity host, bool persist) => new Cuboid(host as ICuboidEntity, persist));
        }
        internal static Cuboid Wrap(ICuboidEntity host, bool persist = true)
        {
            if (host == null)
                return null;
            return new Cuboid(host, persist);
        }
        internal static Cuboid[] Wrap(ICuboidEntity[] hosts, bool persist = true)
        {
            return (from x in hosts
            select Wrap(x, persist)).ToArray();
        }
        internal static Cuboid[][] Wrap(ICuboidEntity[][] hosts, bool persist = true)
        {
            return (from x in hosts
            select Wrap(x, persist)).ToArray();
        }
        internal static ICuboidEntity[][] Unwrap(Cuboid[][] o)
        {
            return (from x in o
            select Unwrap(x)).ToArray();
        }
        internal static ICuboidEntity[] Unwrap(Cuboid[] o)
        {
            return (from x in o
            select Unwrap(x)).ToArray();
        }
        internal static ICuboidEntity[] Unwrap(IEnumerable<Cuboid> o)
        {
            return (from x in o
            select Unwrap(x)).ToArray();
        }
        internal static ICuboidEntity Unwrap(Cuboid o)
        {
            return o.CuboidEntity;
        }
        public static Cuboid ByLengths([Scaling()] double width = 1, [Scaling()] double length = 1, [Scaling()] double height = 1)
        {
            DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
                width,
                length,
                height
            });
            width /= DesignScriptEntity.scaleFactor;
            length /= DesignScriptEntity.scaleFactor;
            height /= DesignScriptEntity.scaleFactor;
            return Wrap(HostFactory.Factory.CuboidByLengths(width, length, height), true);
        }
        public static Cuboid ByLengths([DefaultArgument("Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0)")] Point origin, [Scaling()] double width = 1, [Scaling()] double length = 1, [Scaling()] double height = 1)
        {
            DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
                width,
                length,
                height
            });
            width /= DesignScriptEntity.scaleFactor;
            length /= DesignScriptEntity.scaleFactor;
            height /= DesignScriptEntity.scaleFactor;
            return Wrap(HostFactory.Factory.CuboidByLengths(Point.Unwrap(origin), width, length, height), true);
        }
        public static Cuboid ByLengths([DefaultArgument("Autodesk.DesignScript.Geometry.CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem coordinateSystem, [Scaling()] double width = 1, [Scaling()] double length = 1, [Scaling()] double height = 1)
        {
            DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
                width,
                length,
                height
            });
            width /= DesignScriptEntity.scaleFactor;
            length /= DesignScriptEntity.scaleFactor;
            height /= DesignScriptEntity.scaleFactor;
            return Wrap(HostFactory.Factory.CuboidByLengths(CoordinateSystem.Unwrap(coordinateSystem), width, length, height), true);
        }
        public static Cuboid ByCorners([DefaultArgument("Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0)")] Point lowPoint, [DefaultArgument("Autodesk.DesignScript.Geometry.Point.ByCoordinates(1, 1, 1)")] Point highPoint)
        {
            return Wrap(HostFactory.Factory.CuboidByCorners(Point.Unwrap(lowPoint), Point.Unwrap(highPoint)), true);
        }
    }
}
            