DynamoVisualProgramming.ZeroTouchLibrary by Autodesk

<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary" Version="4.2.0-beta4830" />

 Rectangle

public class Rectangle : Polygon
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(IRectangleEntity), typeof(IGeometryFactory), new Type[] { })] 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) : base(host) { } internal new static void InitType() { Geometry.RegisterHostType(typeof(IRectangleEntity), (IGeometryEntity host) => new Rectangle(host as IRectangleEntity)); } public static Rectangle ByCornerPoints(IEnumerable<Point> points) { return Wrap(HostFactory.Factory.RectangleByCornerPoints(Point.Unwrap(points))); } 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))); } public static Rectangle ByWidthLength([Scaling()] double width = 1, [Scaling()] double length = 1) { DesignScriptEntity.CheckArgsForAsmExtents(width, length); return Wrap(HostFactory.Factory.RectangleByWidthLength(width / DesignScriptEntity.scaleFactor, length / DesignScriptEntity.scaleFactor)); } public static Rectangle ByWidthLength(Plane plane, [Scaling()] double width = 1, [Scaling()] double length = 1) { DesignScriptEntity.CheckArgsForAsmExtents(width, length); return Wrap(HostFactory.Factory.RectangleByWidthLength(Plane.Unwrap(plane), width / DesignScriptEntity.scaleFactor, length / DesignScriptEntity.scaleFactor)); } 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(width, length); return Wrap(HostFactory.Factory.RectangleByWidthLength(CoordinateSystem.Unwrap(coordinateSystem), width / DesignScriptEntity.scaleFactor, length / DesignScriptEntity.scaleFactor)); } internal static Rectangle Wrap(IRectangleEntity host) { if (host != null) return new Rectangle(host); return null; } internal static Rectangle[] Wrap(IRectangleEntity[] hosts) { return hosts.Select(Wrap).ToArray(); } internal static Rectangle[][] Wrap(IRectangleEntity[][] hosts) { return hosts.Select(Wrap).ToArray(); } internal static IRectangleEntity Unwrap(Rectangle o) { return o.RectangleEntity; } internal static IRectangleEntity[] Unwrap(IEnumerable<Rectangle> o) { return o.Select(Unwrap).ToArray(); } internal static IRectangleEntity[] Unwrap(Rectangle[] o) { return o.Select(Unwrap).ToArray(); } internal static IRectangleEntity[][] Unwrap(Rectangle[][] 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("Rectangle(Width = ", Width).Add(", Height = ", Height).Append(")"); } } }