DynamoVisualProgramming.ZeroTouchLibrary by Autodesk

<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary" Version="3.5.0-beta6766" />

 Surface

public class Surface : Topology
using Autodesk.DesignScript.Geometry.Properties; using Autodesk.DesignScript.Interfaces; using Autodesk.DesignScript.Runtime; using System; using System.Collections.Generic; using System.Linq; namespace Autodesk.DesignScript.Geometry { public class Surface : Topology { internal ISurfaceEntity SurfaceEntity => HostImpl as ISurfaceEntity; [Scaling()] public double Area { get { return SurfaceEntity.get_Area() * Math.Pow(DesignScriptEntity.scaleFactor, 2); } } [Scaling()] public double Perimeter { get { return SurfaceEntity.get_Perimeter() * DesignScriptEntity.scaleFactor; } } public bool ClosedInU => SurfaceEntity.get_ClosedInU(); public bool ClosedInV => SurfaceEntity.get_ClosedInV(); public bool Closed => SurfaceEntity.get_Closed(); internal Surface(ISurfaceEntity host, bool persist) : base(host, persist) { } public override string ToString() { return "Surface"; } internal new static void InitType() { Geometry.RegisterHostType(typeof(ISurfaceEntity), (IGeometryEntity host, bool persist) => new Surface(host as ISurfaceEntity, persist)); } internal static Surface Wrap(ISurfaceEntity host, bool persist = true) { return Geometry.Wrap(host, false, null) as Surface; } internal static Surface[] Wrap(ISurfaceEntity[] hosts, bool persist = true) { return (from x in hosts select Wrap(x, persist)).ToArray(); } internal static Surface[][] Wrap(ISurfaceEntity[][] hosts, bool persist = true) { return (from x in hosts select Wrap(x, persist)).ToArray(); } internal static ISurfaceEntity[][] Unwrap(Surface[][] o) { return (from x in o select Unwrap(x)).ToArray(); } internal static ISurfaceEntity[] Unwrap(Surface[] o) { return (from x in o select Unwrap(x)).ToArray(); } internal static ISurfaceEntity[] Unwrap(IEnumerable<Surface> o) { return (from x in o select Unwrap(x)).ToArray(); } internal static ISurfaceEntity Unwrap(Surface o) { return o.SurfaceEntity; } public static Surface ByUnion(IEnumerable<Surface> surfaces) { return Wrap(HostFactory.Factory.SurfaceByUnion(Unwrap(surfaces)), true); } public static Surface ByLoft(IEnumerable<Curve> crossSections) { return Wrap(HostFactory.Factory.SurfaceByLoft(Curve.Unwrap(crossSections)), true); } public static Surface ByRuledLoft(IEnumerable<Line> crossSections) { return Wrap(HostFactory.Factory.SurfaceByRuledLoft(Line.Unwrap(crossSections)), true); } [SupressImportIntoVM] [Obsolete("This method is deprecated and will be removed in a future version of Dynamo. Use Surface.ByLoft(ICurveEntity[] crossSections, ICurveEntity[] guideCurves) instead")] public static Surface ByLoft(IEnumerable<Curve> crossSections, Curve guideCurve) { return Wrap(HostFactory.Factory.SurfaceByLoft(Curve.Unwrap(crossSections), Curve.Unwrap(guideCurve)), true); } public static Surface ByLoft(IEnumerable<Curve> crossSections, IEnumerable<Curve> guideCurves) { return Wrap(HostFactory.Factory.SurfaceByLoft(Curve.Unwrap(crossSections), Curve.Unwrap(guideCurves)), true); } [IsVisibleInDynamoLibrary(false)] [IsObsolete("surface_bysweep_deprecated", typeof(Resources))] [Obsolete("This method is deprecated and will be removed in a future version of Dynamo. Use SurfaceBySweep(ICurveEntity profile, ICurveEntity path, bool cutEndOff) instead")] public static Surface BySweep(Curve profile, Curve path) { return Wrap(HostFactory.Factory.SurfaceBySweep(Curve.Unwrap(profile), Curve.Unwrap(path)), true); } public static Surface BySweep(Curve profile, Curve path, bool cutEndOff = false) { return Wrap(HostFactory.Factory.SurfaceBySweep(Curve.Unwrap(profile), Curve.Unwrap(path), cutEndOff), true); } public static Surface ByPerimeterPoints(IEnumerable<Point> points) { return Wrap(HostFactory.Factory.SurfaceByPerimeterPoints(Point.Unwrap(points)), true); } public static Surface BySweep2Rails(Curve path, Curve guideRail, Curve profile) { return Wrap(HostFactory.Factory.SurfaceBySweep2Rails(Curve.Unwrap(path), Curve.Unwrap(guideRail), Curve.Unwrap(profile)), true); } public static Surface ByRevolve(Curve profile, [DefaultArgument("Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0)")] Point axisOrigin, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 1)")] Vector axisDirection, double startAngle = 0, double sweepAngle = 180) { return Wrap(HostFactory.Factory.SurfaceByRevolve(Curve.Unwrap(profile), Point.Unwrap(axisOrigin), Vector.Unwrap(axisDirection), startAngle, sweepAngle), true); } public static Surface ByPatch(Curve closedCurve) { return Wrap(HostFactory.Factory.SurfaceByPatch(Curve.Unwrap(closedCurve)), true); } public Geometry[] SubtractFrom(Solid trimmingEntity) { return Geometry.Wrap(SurfaceEntity.SubtractFrom(Solid.Unwrap(trimmingEntity))); } public Surface Difference(IEnumerable<Surface> others) { return Wrap(SurfaceEntity.Difference(Unwrap(others)), true); } public UV UVParameterAtPoint(Point point) { return UV.Wrap(SurfaceEntity.UVParameterAtPoint(Point.Unwrap(point)), true); } [IsObsolete("surface_trimwithedgeloops_deprecated", typeof(Resources))] [Obsolete("This method is deprecated and will be removed in a future Dynamo release. Use Surface.TrimWithEdgeLoops(PolyCurve[] loops, double tolerance) instead.")] [IsVisibleInDynamoLibrary(false)] public Surface TrimWithEdgeLoops(IEnumerable<PolyCurve> loops) { return Wrap(SurfaceEntity.TrimWithEdgeLoops(PolyCurve.Unwrap(loops)), true); } public Surface TrimWithEdgeLoops(IEnumerable<PolyCurve> loops, [Scaling()] double tolerance = 0) { DesignScriptEntity.CheckArgsForAsmExtents(new List<double> { tolerance }); tolerance /= DesignScriptEntity.scaleFactor; return Wrap(SurfaceEntity.TrimWithEdgeLoops(PolyCurve.Unwrap(loops), tolerance), true); } [Scaling()] public Vector NormalAtPoint(Point point) { return Vector.Wrap(SurfaceEntity.NormalAtPoint(Point.Unwrap(point)).Scale(1 / DesignScriptEntity.scaleFactor), true); } [IsVisibleInDynamoLibrary(false)] [IsObsolete("surface_tonurbs_deprecated", typeof(Resources))] [Obsolete("This method is deprecated and will be removed in a future version of Dynamo. Use ToNurbsSurface(bool limitSurface) instead.")] public NurbsSurface ToNurbsSurface() { return NurbsSurface.Wrap(SurfaceEntity.ToNurbsSurface(), true); } public NurbsSurface ToNurbsSurface(bool limitSurface = true) { return NurbsSurface.Wrap(SurfaceEntity.ToNurbsSurface(limitSurface), true); } public NurbsSurface ApproximateWithTolerance([Scaling()] double tolerance = 0.001) { DesignScriptEntity.CheckArgsForAsmExtents(new List<double> { tolerance }); tolerance /= DesignScriptEntity.scaleFactor; return NurbsSurface.Wrap(SurfaceEntity.ApproximateWithTolerance(tolerance), true); } public Solid Thicken([Scaling()] double thickness = 1) { DesignScriptEntity.CheckArgsForAsmExtents(new List<double> { thickness }); thickness /= DesignScriptEntity.scaleFactor; return Solid.Wrap(SurfaceEntity.Thicken(thickness), true); } public Solid Thicken([Scaling()] double thickness = 1, bool both_sides = true) { DesignScriptEntity.CheckArgsForAsmExtents(new List<double> { thickness }); thickness /= DesignScriptEntity.scaleFactor; return Solid.Wrap(SurfaceEntity.Thicken(thickness, both_sides), true); } public Surface Offset([Scaling()] double distance = 1) { DesignScriptEntity.CheckArgsForAsmExtents(new List<double> { distance }); distance /= DesignScriptEntity.scaleFactor; return Wrap(SurfaceEntity.Offset(distance), true); } public CoordinateSystem CurvatureAtParameter(double u = 0, double v = 0) { return CoordinateSystem.Wrap(SurfaceEntity.CurvatureAtParameter(u, v), true); } public CoordinateSystem CoordinateSystemAtParameter(double u = 0, double v = 0) { return CoordinateSystem.Wrap(SurfaceEntity.CoordinateSystemAtParameter(u, v), true); } [Scaling()] public Vector TangentAtUParameter(double u = 0, double v = 0) { return Vector.Wrap(SurfaceEntity.TangentAtUParameter(u, v).Scale(1 / DesignScriptEntity.scaleFactor), true); } [Scaling()] public Vector TangentAtVParameter(double u = 0, double v = 0) { return Vector.Wrap(SurfaceEntity.TangentAtVParameter(u, v).Scale(1 / DesignScriptEntity.scaleFactor), true); } [Scaling()] public Vector NormalAtParameter(double u = 0, double v = 0) { return Vector.Wrap(SurfaceEntity.NormalAtParameter(u, v).Scale(1 / DesignScriptEntity.scaleFactor), true); } public Vector[] DerivativesAtParameter(double u = 0, double v = 0) { return Vector.Wrap(SurfaceEntity.DerivativesAtParameter(u, v), true); } public double GaussianCurvatureAtParameter(double u = 0, double v = 0) { return SurfaceEntity.GaussianCurvatureAtParameter(u, v); } public double[] PrincipalCurvaturesAtParameter(double u = 0, double v = 0) { return SurfaceEntity.PrincipalCurvaturesAtParameter(u, v); } [Scaling()] public Vector[] PrincipalDirectionsAtParameter(double u = 0, double v = 0) { return Vector.Wrap((from x in (IEnumerable<IVectorEntity>)SurfaceEntity.PrincipalDirectionsAtParameter(u, v) select x.Scale(1 / DesignScriptEntity.scaleFactor)).ToArray(), true); } public Point PointAtParameter(double u = 0, double v = 0) { return Point.Wrap(SurfaceEntity.PointAtParameter(u, v), true); } public Curve[] PerimeterCurves() { return Curve.Wrap(SurfaceEntity.PerimeterCurves(), true); } public Curve GetIsoline(int isoDirection = 0, double parameter = 0) { return Curve.Wrap(SurfaceEntity.GetIsoline(isoDirection, parameter), true); } public Surface FlipNormalDirection() { return Wrap(SurfaceEntity.FlipNormalDirection(), true); } [SupressImportIntoVM] [Obsolete("This method is deprecated and will be removed in a future version of Dynamo. Use PolySurface.ByJoinedSurfaces node instead.")] public PolySurface Join(Surface otherSurface) { return PolySurface.Wrap(SurfaceEntity.Join(Unwrap(otherSurface)), true); } [IsVisibleInDynamoLibrary(false)] [IsObsolete("surface_joinarr_deprecated", typeof(Resources))] [Obsolete("This method is deprecated and will be removed in a future version of Dynamo. Use PolySurface.ByJoinedSurfaces node instead.")] public PolySurface Join(IEnumerable<Surface> otherSurfaces) { return PolySurface.Wrap(SurfaceEntity.Join(Unwrap(otherSurfaces)), true); } public Geometry[] ProjectInputOnto(Geometry geometryToProject, Vector projectionDirection) { return Geometry.Wrap(SurfaceEntity.ProjectInputOnto(Geometry.Unwrap(geometryToProject), Vector.Unwrap(projectionDirection))); } public Geometry Repair() { return Geometry.Wrap(SurfaceEntity.Repair(), false, null); } } }