DynamoVisualProgramming.ZeroTouchLibrary by Autodesk

<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary" Version="3.3.0-beta5725" />

 Rectangle

public class Rectangle : Polygon
using Autodesk.DesignScript.Interfaces; using Autodesk.DesignScript.Runtime; using System.Collections.Generic; using System.Globalization; using System.Linq; namespace Autodesk.DesignScript.Geometry { public class Rectangle : Polygon { internal IRectangleEntity RectangleEntity => HostImpl as IRectangleEntity; [Scaling()] public double Width { get { return RectangleEntity.get_Width() * DesignScriptEntity.scaleFactor; } } [Scaling()] public double Height { get { return RectangleEntity.get_Height() * DesignScriptEntity.scaleFactor; } } internal Rectangle(IRectangleEntity host, bool persist) : base(host, persist) { } public override string ToString() { string[] obj = new string[5] { "Rectangle(Width = ", null, null, null, null }; double num = Width; obj[1] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture); obj[2] = ", Height = "; num = Height; obj[3] = num.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture); obj[4] = ")"; return string.Concat(obj); } internal new static void InitType() { Geometry.RegisterHostType(typeof(IRectangleEntity), (IGeometryEntity host, bool persist) => new Rectangle(host as IRectangleEntity, persist)); } internal static Rectangle Wrap(IRectangleEntity host, bool persist = true) { if (host == null) return null; return new Rectangle(host, persist); } internal static Rectangle[] Wrap(IRectangleEntity[] hosts, bool persist = true) { return (from x in hosts select Wrap(x, persist)).ToArray(); } internal static Rectangle[][] Wrap(IRectangleEntity[][] hosts, bool persist = true) { return (from x in hosts select Wrap(x, persist)).ToArray(); } internal static IRectangleEntity[][] Unwrap(Rectangle[][] o) { return (from x in o select Unwrap(x)).ToArray(); } internal static IRectangleEntity[] Unwrap(Rectangle[] o) { return (from x in o select Unwrap(x)).ToArray(); } internal static IRectangleEntity[] Unwrap(IEnumerable<Rectangle> o) { return (from x in o select Unwrap(x)).ToArray(); } internal static IRectangleEntity Unwrap(Rectangle o) { return o.RectangleEntity; } public static Rectangle ByCornerPoints(IEnumerable<Point> points) { return Wrap(HostFactory.Factory.RectangleByCornerPoints(Point.Unwrap(points)), true); } public static Rectangle ByCornerPoints(Point p1, Point p2, Point p3, Point p4) { return Wrap(HostFactory.Factory.RectangleByCornerPoints(Point.Unwrap(p1), Point.Unwrap(p2), Point.Unwrap(p3), Point.Unwrap(p4)), true); } public static Rectangle ByWidthLength([Scaling()] double width = 1, [Scaling()] double length = 1) { DesignScriptEntity.CheckArgsForAsmExtents(new List<double> { width, length }); width /= DesignScriptEntity.scaleFactor; length /= DesignScriptEntity.scaleFactor; return Wrap(HostFactory.Factory.RectangleByWidthLength(width, length), true); } public static Rectangle ByWidthLength(Plane plane, [Scaling()] double width = 1, [Scaling()] double length = 1) { DesignScriptEntity.CheckArgsForAsmExtents(new List<double> { width, length }); width /= DesignScriptEntity.scaleFactor; length /= DesignScriptEntity.scaleFactor; return Wrap(HostFactory.Factory.RectangleByWidthLength(Plane.Unwrap(plane), width, length), true); } public static Rectangle ByWidthLength([DefaultArgument("Autodesk.DesignScript.Geometry.CoordinateSystem.ByOrigin(0, 0, 0)")] CoordinateSystem coordinateSystem, [Scaling()] double width = 1, [Scaling()] double length = 1) { DesignScriptEntity.CheckArgsForAsmExtents(new List<double> { width, length }); width /= DesignScriptEntity.scaleFactor; length /= DesignScriptEntity.scaleFactor; return Wrap(HostFactory.Factory.RectangleByWidthLength(CoordinateSystem.Unwrap(coordinateSystem), width, length), true); } } }