DynamoVisualProgramming.ZeroTouchLibrary by Autodesk

<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary" Version="2.0.0-beta2536" />

 Sphere

public class Sphere : Solid
using Autodesk.DesignScript.Interfaces; using Autodesk.DesignScript.Runtime; using System.Collections.Generic; using System.Globalization; using System.Linq; namespace Autodesk.DesignScript.Geometry { public class Sphere : Solid { internal ISphereEntity SphereEntity => HostImpl as ISphereEntity; public Point CenterPoint => Point.Wrap(SphereEntity.get_CenterPoint(), true); [Scaling()] public double Radius { get { return SphereEntity.get_Radius() * DesignScriptEntity.scaleFactor; } } internal Sphere(ISphereEntity host, bool persist) : base(host, persist) { } public override string ToString() { return "Sphere(CenterPoint = " + CenterPoint + ", Radius = " + Radius.ToString(GeometryExtension.DoublePrintFormat, CultureInfo.InvariantCulture) + ")"; } internal new static void InitType() { Geometry.RegisterHostType(typeof(ISphereEntity), (IGeometryEntity host, bool persist) => new Sphere(host as ISphereEntity, persist)); } internal static Sphere Wrap(ISphereEntity host, bool persist = true) { return Geometry.Wrap(host, false, null) as Sphere; } internal static Sphere[] Wrap(ISphereEntity[] hosts, bool persist = true) { return (from x in hosts select Wrap(x, persist)).ToArray(); } internal static Sphere[][] Wrap(ISphereEntity[][] hosts, bool persist = true) { return (from x in hosts select Wrap(x, persist)).ToArray(); } internal static ISphereEntity[][] Unwrap(Sphere[][] o) { return (from x in o select Unwrap(x)).ToArray(); } internal static ISphereEntity[] Unwrap(Sphere[] o) { return (from x in o select Unwrap(x)).ToArray(); } internal static ISphereEntity[] Unwrap(IEnumerable<Sphere> o) { return (from x in o select Unwrap(x)).ToArray(); } internal static ISphereEntity Unwrap(Sphere o) { return o.SphereEntity; } public static Sphere ByCenterPointRadius([DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point centerPoint, [Scaling()] double radius = 1) { radius /= DesignScriptEntity.scaleFactor; return Wrap(HostFactory.Factory.SphereByCenterPointRadius(Point.Unwrap(centerPoint), radius), true); } public static Sphere ByFourPoints(IEnumerable<Point> points) { return Wrap(HostFactory.Factory.SphereByFourPoints(Point.Unwrap(points)), true); } public static Sphere ByBestFit(IEnumerable<Point> points) { return Wrap(HostFactory.Factory.SphereByBestFit(Point.Unwrap(points)), true); } } }