Skip to content

Commit

Permalink
Add VolumetricMaterialTakeOff for new IElementM types
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjamesnugent authored and Fraser Greenroyd committed Sep 11, 2023
1 parent 5259d00 commit c65b01f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Structure_Engine/Convert/PanelToFEMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static FEMesh PanelToFEMesh(this Panel panel)
}
foreach (Edge edge in edges)
{
ICurve curve = Analytical.Query.Geometry(edge);
ICurve curve = edge.Curve;
points.AddRange(Geometry.Convert.IToPolyline(curve).ControlPoints);
}
int count = points.Distinct().Count();
Expand Down
2 changes: 1 addition & 1 deletion Structure_Engine/Query/Area.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static partial class Query
[Output("area", "The area of the FEMesh.", typeof(Area))]
public static double Area(this FEMesh mesh)
{
return mesh.IsNull() ? 0 : Analytical.Query.Geometry(mesh).Area();
return mesh.IsNull() ? 0 : mesh.Area();
}

/***************************************************/
Expand Down
59 changes: 51 additions & 8 deletions Structure_Engine/Query/VolumetricMaterialTakeoff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using BH.oM.Dimensional;
using BH.Engine.Geometry;
using BH.Engine.Spatial;
using BH.oM.Base.Attributes;
using BH.oM.Geometry;
using BH.oM.Physical.Materials;
using BH.oM.Structure.Elements;
using BH.oM.Structure.MaterialFragments;

namespace BH.Engine.Structure
{
Expand All @@ -55,19 +56,61 @@ public static VolumetricMaterialTakeoff VolumetricMaterialTakeoff(this PileFound

List<VolumetricMaterialTakeoff> takeoffs = new List<VolumetricMaterialTakeoff>();

foreach (Pile pile in pileFoundation.Piles)
takeoffs.Add(Matter.Query.IVolumetricMaterialTakeoff(pileFoundation.PileCap));
foreach(IElementM pile in pileFoundation.Piles)
{
Bar bar = new Bar() { StartNode = pile.TopNode, EndNode = pile.BottomNode, SectionProperty = pile.Section };

// Can just use VolumetricMaterialTakeOff for a Pile here
takeoffs.Add(Matter.Query.IVolumetricMaterialTakeoff(bar));
takeoffs.Add(Matter.Query.IVolumetricMaterialTakeoff(pile));
}

takeoffs.Add(Matter.Query.IVolumetricMaterialTakeoff(pileFoundation.PileCap));
takeoffs.Add(Matter.Query.IVolumetricMaterialTakeoff((IElementM)pileFoundation.Piles));

return Matter.Compute.AggregateVolumetricMaterialTakeoff(takeoffs);
}

/***************************************************/

[Description("Gets the volumetric material takeoff from the Pile object.")]
[Input("pile", "The PileFoundation object to extract the volumetric material takeoff from.")]
[Output("volTakeoff", "The volumetric material takeoff based on buildup of the Pile object.")]
public static VolumetricMaterialTakeoff VolumetricMaterialTakeoff(this Pile pile)
{
if (pile.IsNull())
return null;

if (pile.Section.IsNull() || pile.Section.Material.IsNull())
return null;

IMaterialFragment structMaterial = pile.Section.Material;

Material physMaterial = new Material() { Density = structMaterial.Density, Name = structMaterial.Name };

VolumetricMaterialTakeoff takeOff = Matter.Create.VolumetricMaterialTakeoff(new List<Material>() { physMaterial }, new List<double>() { pile.Section.Area*pile.Length() });

return takeOff;
}

/***************************************************/

[Description("Gets the volumetric material takeoff from the PadFoundation object.")]
[Input("padfoundation", "The PadFoundation object to extract the volumetric material takeoff from.")]
[Output("volTakeoff", "The volumetric material takeoff based on buildup of the PadFoundation object.")]
public static VolumetricMaterialTakeoff VolumetricMaterialTakeoff(this PadFoundation padFoundation)
{
if (padFoundation.IsNull())
return null;

if (padFoundation.Property.IsNull() || padFoundation.Property.Material.IsNull())
return null;

IMaterialFragment structMaterial = padFoundation.Property.Material;

Material physMaterial = new Material() { Density = structMaterial.Density, Name = structMaterial.Name};

VolumetricMaterialTakeoff takeOff = Matter.Create.VolumetricMaterialTakeoff(new List<Material>() { physMaterial}, new List<double>() { padFoundation.SolidVolume() });

return takeOff;
}

/***************************************************/

}
}

0 comments on commit c65b01f

Please sign in to comment.