Skip to content

Structure_Engine: Add Geometry3D method for Pile, PileCap and PileFoundation #3348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions Structure_Engine/Query/Geometry3D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using BH.Engine.Structure;
using BH.Engine.Geometry;
using BH.Engine.Spatial;
using BH.Engine.Base;

namespace BH.Engine.Structure
{
Expand All @@ -42,6 +43,7 @@ public static partial class Query
[Description("Gets the BH.oM.Geometry.Extrusion out of the Bar as its Geometry3D.")]
[Input("bar", "The input Bar to get the Geometry3D out of, i.e.its extrusion with its cross section along its centreline.")]
[Input("onlyOuterExtrusion", "If true, and if the cross-section of the Bar is composed by multiple edges (e.g. a Circular Hollow Section), only return the extrusion of the outermost edge.")]
[Output("3d", "Three-dimensional geometry of the Bar.")]
public static IGeometry Geometry3D(this Bar bar, bool onlyOuterExtrusion = true)
{
if (bar.IsNull())
Expand All @@ -62,6 +64,7 @@ public static IGeometry Geometry3D(this Bar bar, bool onlyOuterExtrusion = true)
[Description("Gets a CompositeGeometry made of the boundary surfaces of the Panel, or only its central Surface.")]
[Input("panel", "The input panel to get the Geometry3D out of.")]
[Input("onlyCentralSurface", "If true, the returned geometry is only the central (middle) surface of the panel. Otherwise, the whole external solid is returned as a CompositeGeometry of many surfaces.")]
[Output("3d", "Three-dimensional geometry of the Panel.")]
public static IGeometry Geometry3D(this Panel panel, bool onlyCentralSurface = false)
{
if (panel.IsNull())
Expand Down Expand Up @@ -99,8 +102,62 @@ public static IGeometry Geometry3D(this Panel panel, bool onlyCentralSurface = f
compositeGeometry.Elements.AddRange(externalEdgesExtrusions);

return compositeGeometry;

}
}

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

[Description("Gets the BH.oM.Geometry.Extrusion out of the Pile as its Geometry3D.")]
[Input("pile", "The input Pile to get the Geometry3D out of, i.e.its extrusion with its cross section along its centreline.")]
[Output("3d", "Three-dimensional geometry of the Pile.")]
public static IGeometry Geometry3D(this Pile pile)
{
return Create.Bar((Line)pile.Geometry(), pile.Section, pile.OrientationAngle).Geometry3D();
}

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

[Description("Gets a CompositeGeometry made of the boundary surfaces of the PadFoundation, or only its central Surface.")]
[Input("pad", "The input Panel to get the Geometry3D out of.")]
[Output("3d", "Three-dimensional geometry of the PadFoundation.")]
public static IGeometry Geometry3D(this PadFoundation pad)
{
if (pad.IsNull() || !pad.IsPlanar())
return null;

PlanarSurface top = Engine.Geometry.Create.PlanarSurface(pad.TopOutline);

CompositeGeometry compositeGeometry = new CompositeGeometry();

double thickness = pad.Property.IVolumePerArea();
Vector translateVect = -top.Normal() * pad.Property.ITotalThickness(); // negative because the pad contains a top outline

PlanarSurface bot = top.ITranslate(translateVect) as PlanarSurface;

IEnumerable<Extrusion> externalEdgesExtrusions = pad.TopOutline.SubParts().Select(c => Engine.Geometry.Create.Extrusion(c, translateVect));

compositeGeometry.Elements.Add(top);
compositeGeometry.Elements.Add(bot);
compositeGeometry.Elements.AddRange(externalEdgesExtrusions);

return compositeGeometry;
}

[Description("Gets a CompositeGeometry made of the PileCap and Piles of a PileFoundation.")]
[Input("pileFoundation", "The input PileFoundation to get the Geometry3D out of.")]
[Output("3d", "Three-dimensional geometry of the PileFoundation.")]
public static IGeometry Geometry3D(this PileFoundation pileFoundation)
{
if (pileFoundation.IsNull())
return null;

CompositeGeometry compositeGeometry = new CompositeGeometry();
compositeGeometry.Elements.Add(pileFoundation.PileCap.Geometry3D());
compositeGeometry.Elements.AddRange(pileFoundation.Piles.Select(x => x.Geometry3D()));

return compositeGeometry;
}
}
}

Expand Down
Loading