Skip to content

Commit

Permalink
Structure_Engine: Fix bug for the Mass method (for Panels) (#3256)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraser Greenroyd authored Jan 18, 2024
2 parents a5674ef + 756e65c commit 86f447c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .ci/Datasets/Structure_Engine/Query/Mass.json

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion Structure_Engine/Query/Mass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ public static double Mass(this Bar bar)
[Output("mass", "The mass of the Panel.", typeof(Mass))]
public static double Mass(this Panel panel)
{
return panel.IsNull() ? 0 : panel.Area() * panel.Property.IMassPerArea();
if (panel.IsNull())
return 0;

double volume = panel.SolidVolume();
MaterialComposition comp = panel.MaterialComposition();
return comp.Materials.Zip(comp.Ratios, (m, r) => m.Density * r * volume).Sum();
}

/***************************************************/
Expand Down

0 comments on commit 86f447c

Please sign in to comment.