public static double SolidVolume(this oM.Physical.Elements.ISurface surface) { if (surface == null) { BH.Engine.Reflection.Compute.RecordError("Cannot query the solid volume of a null surface."); return(0); } if (surface.Construction == null) { Engine.Reflection.Compute.RecordError("The ISurface Solid Volume could not be calculated as no IConstruction has been assigned. Returning zero volume."); return(0); } if (surface.Offset != Offset.Centre && !surface.Location.IIsPlanar()) { Reflection.Compute.RecordWarning("The SolidVolume for non-Planar ISurfaces with offsets other than Centre is approxamite at best"); } double area = surface.Location.IArea(); area -= surface.Openings.Sum(x => x.Location.IArea()); return(area * surface.Construction.IThickness()); }
public static oM.Geometry.ISurface Geometry(this oM.Physical.Elements.ISurface surface) { ICurve exBound = (surface.Location as PlanarSurface).ExternalBoundary; List <ICurve> inBound = surface.Openings.Select(o => (o.Location as PlanarSurface).ExternalBoundary).ToList(); return(Engine.Geometry.Create.PlanarSurface(exBound, inBound)); }
public static oM.Physical.Elements.ISurface SetOutlineElements1D(this oM.Physical.Elements.ISurface surface, List <IElement1D> outlineElements1D) { oM.Physical.Elements.ISurface clone = (oM.Physical.Elements.ISurface)surface.GetShallowClone(); ICurve outline = Engine.Geometry.Compute.IJoin(outlineElements1D.Select(x => x.IGeometry()).ToList()).Single(); clone.Location = Engine.Geometry.Create.PlanarSurface(outline); return(clone); }
public static List <IElement2D> InternalElements2D(this oM.Physical.Elements.ISurface surface) { if (surface == null) { BH.Engine.Reflection.Compute.RecordError("Cannot query the internal 2D elements of a null surface."); return(new List <IElement2D>()); } return(new List <IElement2D>(surface.Openings)); }
public static List <IElement1D> OutlineElements1D(this oM.Physical.Elements.ISurface surface) { PlanarSurface pSurface = surface.Location as PlanarSurface; if (pSurface == null) { Engine.Reflection.Compute.RecordError("Not implemented for non-PlanarSurfaces"); return(null); } return(pSurface.ExternalBoundary.ISubParts().ToList <IElement1D>()); }
public static oM.Physical.Elements.ISurface Transform(this oM.Physical.Elements.ISurface panel, TransformMatrix transform, double tolerance = Tolerance.Distance) { if (!transform.IsRigidTransformation(tolerance)) { BH.Engine.Reflection.Compute.RecordError("Transformation failed: only rigid body transformations are currently supported."); return(null); } oM.Physical.Elements.ISurface result = panel.ShallowClone(); result.Location = result.Location?.ITransform(transform); result.Openings = result.Openings?.Select(x => x?.Transform(transform, tolerance)).ToList(); return(result); }
public static oM.Geometry.ISurface Geometry(this oM.Physical.Elements.ISurface surface) { ICurve exBound = (surface?.Location as PlanarSurface)?.ExternalBoundary; if (exBound == null) { return(null); } List <ICurve> inBound = surface?.Openings?.Select(o => (o?.Location as PlanarSurface)?.ExternalBoundary).Where(x => x != null).ToList(); return(Engine.Geometry.Create.PlanarSurface(exBound, inBound)); }
public static ISurface SetInternalElements2D(this oM.Physical.Elements.ISurface surface, List <IElement2D> internalElements2D) { if (surface == null) { BH.Engine.Reflection.Compute.RecordError("Cannot set the internal 2D elements of a null surface."); return(null); } ISurface pp = surface.ShallowClone(); pp.Openings = new List <IOpening>(internalElements2D.Cast <IOpening>().ToList()); return(pp); }
public static oM.Physical.Elements.ISurface SetOutlineElements1D(this oM.Physical.Elements.ISurface surface, List <IElement1D> outlineElements1D) { if (surface == null) { BH.Engine.Reflection.Compute.RecordError("Cannot set the outline 1D elements of a null surface."); return(null); } oM.Physical.Elements.ISurface clone = surface.ShallowClone(); ICurve outline = Engine.Geometry.Compute.IJoin(outlineElements1D.Select(x => x.IGeometry()).ToList()).Single(); clone.Location = Engine.Geometry.Create.PlanarSurface(outline); return(clone); }
public static IElement2D NewInternalElement2D(this oM.Physical.Elements.ISurface surface) { Engine.Reflection.Compute.RecordNote("The ISurface's IOpening may have been modified and replaced, if so the new IOpening has been set as a Void"); return(new Void()); }
public static oM.Physical.Elements.ISurface SetInternalElements2D(this oM.Physical.Elements.ISurface surface, List <IElement2D> internalElements2D) { oM.Physical.Elements.ISurface pp = surface.GetShallowClone() as oM.Physical.Elements.ISurface; pp.Openings = new List <IOpening>(internalElements2D.Cast <IOpening>().ToList()); return(pp); }
public static List<IElement2D> InternalElements2D(this oM.Physical.Elements.ISurface surface) { return new List<IElement2D>(surface.Openings); }
public static IElement1D NewElement1D(this oM.Physical.Elements.ISurface surface, ICurve curve) { return(curve.IClone()); }