Solid
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Runtime;
using System.Collections.Generic;
using System.Linq;
namespace Autodesk.DesignScript.Geometry
{
public class Solid : Topology
{
internal ISolidEntity SolidEntity => HostImpl as ISolidEntity;
public double Area => SolidEntity.Area;
public double Volume => SolidEntity.Volume;
internal Solid(ISolidEntity host, bool persist)
: base(host, persist)
{
}
public override string ToString()
{
return "Solid";
}
internal new static void InitType()
{
Geometry.RegisterHostType(typeof(ISolidEntity), (IGeometryEntity host, bool persist) => new Solid(host as ISolidEntity, persist));
}
internal static Solid Wrap(ISolidEntity host, bool persist = true)
{
return Geometry.Wrap(host, false, null) as Solid;
}
internal static Solid[] Wrap(ISolidEntity[] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static Solid[][] Wrap(ISolidEntity[][] hosts, bool persist = true)
{
return (from x in hosts
select Wrap(x, persist)).ToArray();
}
internal static ISolidEntity[][] Unwrap(Solid[][] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static ISolidEntity[] Unwrap(Solid[] o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static ISolidEntity[] Unwrap(IEnumerable<Solid> o)
{
return (from x in o
select Unwrap(x)).ToArray();
}
internal static ISolidEntity Unwrap(Solid o)
{
return o.SolidEntity;
}
public static Solid ByJoinedSurfaces(IEnumerable<Surface> facesOfSolid)
{
return Wrap(HostFactory.Factory.SolidByJoinedSurfaces(Surface.Unwrap(facesOfSolid)), true);
}
public static Solid ByLoft(IEnumerable<Curve> crossSections)
{
return Wrap(HostFactory.Factory.SolidByLoft(Curve.Unwrap(crossSections)), true);
}
public static Solid ByLoft(IEnumerable<Curve> crossSections, Curve guideCurve)
{
return Wrap(HostFactory.Factory.SolidByLoft(Curve.Unwrap(crossSections), Curve.Unwrap(guideCurve)), true);
}
public static Solid ByLoft(IEnumerable<Curve> crossSections, IEnumerable<Curve> guideCurves)
{
return Wrap(HostFactory.Factory.SolidByLoft(Curve.Unwrap(crossSections), Curve.Unwrap(guideCurves)), true);
}
public static Solid BySweep(Curve profile, Curve path)
{
return Wrap(HostFactory.Factory.SolidBySweep(Curve.Unwrap(profile), Curve.Unwrap(path)), true);
}
public static Solid BySweep2Rails(Curve rail1, Curve rail2, Curve profile)
{
return Wrap(HostFactory.Factory.SolidBySweep2Rails(Curve.Unwrap(rail1), Curve.Unwrap(rail2), Curve.Unwrap(profile)), true);
}
public static Solid ByRevolve(Curve profile, [DefaultArgument("Point.ByCoordinates(0, 0, 0)")] Point axisOrigin, [DefaultArgument("Vector.ByCoordinates(0, 0, 1)")] Vector axisDirection, double startAngle = 0, double sweepAngle = 180)
{
return Wrap(HostFactory.Factory.SolidByRevolve(Curve.Unwrap(profile), Point.Unwrap(axisOrigin), Vector.Unwrap(axisDirection), startAngle, sweepAngle), true);
}
public static Solid ByUnion(IEnumerable<Solid> solids)
{
return Wrap(HostFactory.Factory.SolidByUnion(Unwrap(solids)), true);
}
public Point Centroid()
{
return Point.Wrap(SolidEntity.Centroid(), true);
}
public Solid Union(Solid solid)
{
return Wrap(SolidEntity.Union(Unwrap(solid)), true);
}
public Solid UnionAll(IEnumerable<Solid> solids)
{
return Wrap(SolidEntity.UnionAll(Unwrap(solids)), true);
}
public Solid Difference(Solid tool)
{
return Wrap(SolidEntity.Difference(Unwrap(tool)), true);
}
public Solid DifferenceAll(IEnumerable<Solid> tools)
{
return Wrap(SolidEntity.DifferenceAll(Unwrap(tools)), true);
}
public Solid ThinShell(double internalFaceThickness = 1, double externalFaceThickness = 1)
{
return Wrap(SolidEntity.ThinShell(internalFaceThickness, externalFaceThickness), true);
}
public Geometry[] ProjectInputOnto(Geometry geometryToProject, Vector projectDirection)
{
return Geometry.Wrap(SolidEntity.ProjectInputOnto(Geometry.Unwrap(geometryToProject), Vector.Unwrap(projectDirection)));
}
public Solid Fillet(IEnumerable<Edge> edges, double radius)
{
return Wrap(SolidEntity.Fillet(Edge.Unwrap(edges), radius), true);
}
public Solid Chamfer(IEnumerable<Edge> edges, double offset)
{
return Wrap(SolidEntity.Chamfer(Edge.Unwrap(edges), offset), true);
}
}
}