示例#1
0
        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());
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
        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>());
        }
示例#6
0
        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);
        }
示例#7
0
        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));
        }
示例#8
0
        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);
        }
示例#9
0
        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);
        }
示例#10
0
 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);
 }
示例#12
0
 public static List<IElement2D> InternalElements2D(this oM.Physical.Elements.ISurface surface)
 {
     return new List<IElement2D>(surface.Openings);
 }
示例#13
0
 public static IElement1D NewElement1D(this oM.Physical.Elements.ISurface surface, ICurve curve)
 {
     return(curve.IClone());
 }