PolySurface
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
public class PolySurface : Surface
{
internal IPolySurfaceEntity PolySurfaceEntity => HostImpl as IPolySurfaceEntity;
internal PolySurface(IPolySurfaceEntity host, bool persist)
: base(host, persist)
{
}
public override string ToString()
{
return "PolySurface";
}
internal new static void InitType()
{
Geometry.RegisterHostType(typeof(IPolySurfaceEntity), (IGeometryEntity host, bool persist) => new PolySurface(host as IPolySurfaceEntity, persist));
}
internal static PolySurface Wrap(IPolySurfaceEntity host, bool persist = true)
{
if (host == null)
return null;
return new PolySurface(host, persist);
}
internal static PolySurface[] Wrap(IPolySurfaceEntity[] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static PolySurface[][] Wrap(IPolySurfaceEntity[][] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static IPolySurfaceEntity[][] Unwrap(PolySurface[][] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IPolySurfaceEntity[] Unwrap(PolySurface[] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IPolySurfaceEntity[] Unwrap(IEnumerable<PolySurface> o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static IPolySurfaceEntity Unwrap(PolySurface o)
{
return o.PolySurfaceEntity;
}
public new static PolySurface ByLoft(IEnumerable<Curve> crossSections)
{
return Wrap(HostFactory.Factory.PolySurfaceByLoft(Curve.Unwrap(crossSections)), true);
}
public new static PolySurface ByLoft(IEnumerable<Curve> crossSections, Curve guideCurve)
{
return Wrap(HostFactory.Factory.PolySurfaceByLoft(Curve.Unwrap(crossSections), Curve.Unwrap(guideCurve)), true);
}
public static PolySurface ByLoftGuides(IEnumerable<Curve> crossSections, IEnumerable<Curve> guideCurves)
{
return Wrap(HostFactory.Factory.PolySurfaceByLoftGuides(Curve.Unwrap(crossSections), Curve.Unwrap(guideCurves)), true);
}
public static PolySurface ByJoinedSurfaces(IEnumerable<Surface> surfaces)
{
return Wrap(HostFactory.Factory.PolySurfaceByJoinedSurfaces(Surface.Unwrap(surfaces)), true);
}
public static PolySurface BySolid(Solid solid)
{
return Wrap(HostFactory.Factory.PolySurfaceBySolid(Solid.Unwrap(solid)), true);
}
public static PolySurface BySweep(Curve rail, IEnumerable<Curve> crossSection)
{
return Wrap(HostFactory.Factory.PolySurfaceBySweep(Curve.Unwrap(rail), Curve.Unwrap(crossSection)), true);
}
[SupressImportIntoVM]
[Obsolete("This method is deprecated and will be removed in a future version of Dynamo. Use PolySurface.BySweep(ICurveEntity rail, ICurveEntity[] crossSection) instead")]
public new static PolySurface BySweep(Curve rail, Curve profile)
{
return Wrap(HostFactory.Factory.PolySurfaceBySweep(Curve.Unwrap(rail), Curve.Unwrap(profile)), true);
}
public Surface[] Surfaces()
{
return Surface.Wrap(PolySurfaceEntity.Surfaces(), true);
}
public Surface[] LocateSurfacesByPoint(Point point, Vector direction)
{
return Surface.Wrap(PolySurfaceEntity.LocateSurfacesByPoint(Point.Unwrap(point), Vector.Unwrap(direction)), true);
}
public Surface[] LocateSurfacesByLine(Line line)
{
return Surface.Wrap(PolySurfaceEntity.LocateSurfacesByLine(Line.Unwrap(line)), true);
}
public PolyCurve[] UnconnectedBoundaries()
{
return PolyCurve.Wrap(PolySurfaceEntity.UnconnectedBoundaries(), true);
}
public Solid[] ExtractSolids()
{
return Solid.Wrap(PolySurfaceEntity.ExtractSolids(), true);
}
public int SurfaceCount()
{
return PolySurfaceEntity.SurfaceCount();
}
public int EdgeCount()
{
return PolySurfaceEntity.EdgeCount();
}
public int VertexCount()
{
return PolySurfaceEntity.VertexCount();
}
public PolySurface Fillet(IEnumerable<Edge> edges, [Scaling()] double radius)
{
DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
radius
});
radius /= DesignScriptEntity.scaleFactor;
return Wrap(PolySurfaceEntity.Fillet(Edge.Unwrap(edges), radius), true);
}
public PolySurface Chamfer(IEnumerable<Edge> edges, [Scaling()] double offset)
{
DesignScriptEntity.CheckArgsForAsmExtents(new List<double> {
offset
});
offset /= DesignScriptEntity.scaleFactor;
return Wrap(PolySurfaceEntity.Chamfer(Edge.Unwrap(edges), offset), true);
}
}
}