Skip to content
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

Structure_Engine: Add method required for new BuiltUpDoubleRibbed surface property #3351

Merged
13 changes: 13 additions & 0 deletions Structure_Engine/Query/Description.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,19 @@ public static string Description(this BuiltUpRibbed property)

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

[Description("Generates a default description for the SurfaceProperty.")]
[Input("property", "The SurfaceProperty to get a default description for.")]
[Output("desc", "The generated description for the property based on its dimensions, material and type.")]
public static string Description(this BuiltUpDoubleRibbed property)
{
if (property == null)
return "null property";

return $"Ribbed: {property.TopThickness:G3} THK slab {CheckGetMaterialName(property.Material)} on double {property.RibHeight:G3}x{property.RibThickness:G3} ribs {CheckGetMaterialName(property.RibMaterial ?? property.Material)} spaced {property.RibSpacing:G3}";
}

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

[Description("Generates a default description for the SurfaceProperty.")]
[Input("property", "The SurfaceProperty to get a default description for.")]
[Output("desc", "The generated description for the property based on its dimensions, material and type.")]
Expand Down
20 changes: 20 additions & 0 deletions Structure_Engine/Query/MassPerArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,26 @@ public static double MassPerArea(this BuiltUpRibbed property)
volPerAreaRibZone * (property.RibMaterial ?? property.Material).Density;
}

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

[Description("Gets the mass per area for a BuiltUpRibbed.")]
[Input("property", "The BuiltUpRibbed property to calculate the mass per area for.")]
[Output("massPerArea", "The mass per area for the property.", typeof(MassPerUnitArea))]
public static double MassPerArea(this BuiltUpDoubleRibbed property)
{
if (property.IsNull() || property.Material.IsNull())
return double.NaN;

if (property.RibThickness <= 0 || property.RibSpacing < property.RibThickness * 2)
{
Base.Compute.RecordError($"The {nameof(BuiltUpDoubleRibbed.RibThickness)} is 0 or {nameof(BuiltUpDoubleRibbed.RibSpacing)} smaller than twice the {nameof(BuiltUpDoubleRibbed.RibThickness)}. The {nameof(BuiltUpDoubleRibbed)} is invalid and mass per area cannot be computed.");
return double.NaN;
IsakNaslundBh marked this conversation as resolved.
Show resolved Hide resolved
}

double volPerAreaRibZone = property.RibHeight * (property.RibThickness * 2 / property.RibSpacing);
return property.TopThickness * property.Material.Density +
volPerAreaRibZone * (property.RibMaterial ?? property.Material).Density;
}

/***************************************************/
/**** Public Methods - Interfaces ****/
Expand Down
71 changes: 64 additions & 7 deletions Structure_Engine/Query/MaterialComposition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@

[Description("Returns a SurfaceProperty's MaterialComposition.")]
[Input("property", "The SurfaceProperty to query.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the panel.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the Panel.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
public static MaterialComposition MaterialComposition(this Layered property, ReinforcementDensity reinforcementDensity = null)
{
Expand All @@ -172,7 +172,7 @@

[Description("Returns a SurfaceProperty's MaterialComposition.")]
[Input("property", "The SurfaceProperty to query.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the panel.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the Panel.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
public static MaterialComposition MaterialComposition(this CorrugatedDeck property, ReinforcementDensity reinforcementDensity = null)
{
Expand All @@ -189,7 +189,7 @@

[Description("Returns a SurfaceProperty's MaterialComposition.")]
[Input("property", "The SurfaceProperty to query.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the panel.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the Panel.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
public static MaterialComposition MaterialComposition(this ToppedSlab property, ReinforcementDensity reinforcementDensity = null)
{
Expand All @@ -215,7 +215,7 @@

[Description("Returns a SurfaceProperty's MaterialComposition.")]
[Input("property", "The SurfaceProperty to query.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the panel.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the Panel.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
public static MaterialComposition MaterialComposition(this SlabOnDeck property, ReinforcementDensity reinforcementDensity = null)
{
Expand Down Expand Up @@ -257,7 +257,7 @@

[Description("Returns a SurfaceProperty's MaterialComposition.")]
[Input("property", "The SurfaceProperty to query.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the panel.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the Panel.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
public static MaterialComposition MaterialComposition(this Cassette property, ReinforcementDensity reinforcementDensity = null)
{
Expand Down Expand Up @@ -286,7 +286,7 @@

[Description("Returns a SurfaceProperty's MaterialComposition.")]
[Input("property", "The SurfaceProperty to query.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the panel.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the Panel.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
public static MaterialComposition MaterialComposition(this BuiltUpRibbed property, ReinforcementDensity reinforcementDensity = null)
{
Expand All @@ -308,6 +308,63 @@
new List<double> { property.TopThickness, volPerAreaRibZone });
}

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

[Description("Returns a SurfaceProperty's MaterialComposition.")]
[Input("property", "The SurfaceProperty to query.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the Panel.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
public static MaterialComposition MaterialComposition(this BuiltUpDoubleRibbed property, ReinforcementDensity reinforcementDensity = null)
{
if (property.IsNull() || property.Material.IsNull())
return null;

IMaterialFragment topMat = property.Material;
IMaterialFragment ribMat = property.RibMaterial ?? property.Material;

bool reinfToSlab = false;
bool reinfToRib = false;
if (reinforcementDensity != null)
{
bool ribIsConcrete = ribMat is Concrete;
bool topIsConcrete = topMat is Concrete;

if (ribIsConcrete && topIsConcrete) //Both concrete
{
reinfToSlab = true;
reinfToRib = true;
}
else if (ribIsConcrete) //Only rib concrete
{
reinfToRib = true;
Base.Compute.RecordNote($"Only the ribs in the in the {nameof(BuiltUpDoubleRibbed)} is Concrete. Provided {nameof(ReinforcementDensity)} is only applied to the ribs.");
}
else if (topIsConcrete) //Only slab concrete
{
reinfToRib = true;
Base.Compute.RecordNote($"Only the slab in the in the {nameof(BuiltUpDoubleRibbed)} is Concrete. Provided {nameof(ReinforcementDensity)} is only applied to the slab.");
}
else //Neither is concrete. Add to both and record a note
{
reinfToSlab = true;
reinfToRib = true;
Base.Compute.RecordNote($"Neither ribs or slab in the {nameof(BuiltUpDoubleRibbed)} is Concrete. Provided {nameof(ReinforcementDensity)} is applied to both.");

}
}

//If only main material provided, use it for all parts
if (property.RibMaterial == null)
return property.Material.MaterialComposition(reinforcementDensity);

double volPerAreaRibZone = property.RibHeight * (property.RibThickness * 2 / property.RibSpacing);
return Matter.Compute.AggregateMaterialComposition(new List<MaterialComposition>
{
topMat.MaterialComposition(reinfToSlab ? reinforcementDensity : null),
ribMat.MaterialComposition(reinfToRib ? reinforcementDensity : null)
},
new List<double> { property.TopThickness, volPerAreaRibZone });
}

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

Expand Down Expand Up @@ -364,7 +421,7 @@
[Description("Returns a SurfaceProperty's MaterialComposition.")]
[Input("property", "The SurfaceProperty to query.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
public static MaterialComposition IMaterialComposition(this ISurfaceProperty property, ReinforcementDensity reinforcementDensity = null)

Check warning on line 424 in Structure_Engine/Query/MaterialComposition.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Structure_Engine/Query/MaterialComposition.cs#L424

Input parameter requires a matching Input attribute - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/IsInputAttributePresent
{
if (property.IsNull()) //Specific MaterialComposition(SurfaceProp) methods must check for material null- some properties ignore the base material.
return null;
Expand All @@ -388,7 +445,7 @@

[Description("Gets the MaterialComposition for homogenous SurfaceProperties. Multi-material properties will not be reported correctly.")]
[Input("property", "The SurfaceProperty to query.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the panel.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the Panel.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
private static MaterialComposition MaterialComposition(this ISurfaceProperty property, ReinforcementDensity reinforcementDensity = null)
{
Expand Down
40 changes: 26 additions & 14 deletions Structure_Engine/Query/TotalThickness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static partial class Query

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this ConstantThickness property)
{
return property.IsNull() ? 0 : property.Thickness;
Expand All @@ -48,7 +48,7 @@ public static double TotalThickness(this ConstantThickness property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this Ribbed property)
{
return property.IsNull() ? 0 : property.TotalDepth;
Expand All @@ -58,7 +58,7 @@ public static double TotalThickness(this Ribbed property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this Waffle property)
{
return property.IsNull() ? 0 : Math.Max(property.TotalDepthX, property.TotalDepthY);
Expand All @@ -68,7 +68,7 @@ public static double TotalThickness(this Waffle property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this LoadingPanelProperty property)
{
Base.Compute.RecordWarning("LoadingPanelProperties do not have a thickness.");
Expand All @@ -79,7 +79,7 @@ public static double TotalThickness(this LoadingPanelProperty property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this Layered property)
{
if (property.IsNull())
Expand All @@ -95,7 +95,7 @@ public static double TotalThickness(this Layered property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this SlabOnDeck property)
{
if (property.IsNull())
Expand All @@ -111,7 +111,7 @@ public static double TotalThickness(this SlabOnDeck property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this CorrugatedDeck property)
{
if (property.IsNull())
Expand All @@ -124,7 +124,7 @@ public static double TotalThickness(this CorrugatedDeck property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this OneDirectionalVoided property)
{
if (property.IsNull())
Expand All @@ -137,7 +137,7 @@ public static double TotalThickness(this OneDirectionalVoided property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this BiDirectionalVoided property)
{
if (property.IsNull())
Expand All @@ -150,7 +150,7 @@ public static double TotalThickness(this BiDirectionalVoided property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this HollowCore property)
{
if (property.IsNull())
Expand All @@ -163,7 +163,7 @@ public static double TotalThickness(this HollowCore property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this ToppedSlab property)
{
if (property.IsNull())
Expand All @@ -176,7 +176,7 @@ public static double TotalThickness(this ToppedSlab property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this Cassette property)
{
if (property.IsNull())
Expand All @@ -189,7 +189,7 @@ public static double TotalThickness(this Cassette property)

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this BuiltUpRibbed property)
{
if (property.IsNull())
Expand All @@ -198,14 +198,26 @@ public static double TotalThickness(this BuiltUpRibbed property)
return property.TopThickness + property.RibHeight;
}

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

[Description("Gets the total thickness of the SurfaceProperty.")]
[Input("property", "The property to evaluate.")]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this BuiltUpDoubleRibbed property)
{
if (property.IsNull())
return 0;

return property.TopThickness + property.RibHeight;
}

/***************************************************/
/**** Public Methods - Interfaces ****/
/***************************************************/

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
[Output("totalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double ITotalThickness(this ISurfaceProperty property)
{
return property.IsNull() ? 0 : TotalThickness(property as dynamic);
Expand Down
Loading
Loading