Skip to content

Commit

Permalink
Merge pull request #7 from ThorntonTomasetti/Release-0.4.0.0
Browse files Browse the repository at this point in the history
Release 0.4.0.0
  • Loading branch information
ktam-tt authored Jan 24, 2020
2 parents 5c28beb + ae7ecbb commit 453deb1
Show file tree
Hide file tree
Showing 11 changed files with 343 additions and 85 deletions.
23 changes: 21 additions & 2 deletions Beacon/Data/RevitElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public double Density {
set
{
density = value;
Weight = Volume * density;
if (density == 0.0)
{
Material = MaterialType.Unknown;
Expand All @@ -75,7 +74,27 @@ public double Density {
/// <summary>
/// Weight in lbs
/// </summary>
public double Weight { get; set; }
public double Weight {
get
{
return Volume * Density;
}
}

/// <summary>
/// Factor for volume
/// </summary>
public double VolumeFactor { get; set; }

/// <summary>
/// Factored Volume
/// </summary>
public double FactoredVolume { get; set; }

/// <summary>
/// Factored Weight
/// </summary>
public double FactoredWeight { get; set; }

/// <summary>
/// Area in ft^2
Expand Down
64 changes: 57 additions & 7 deletions Beacon/Plots/PlotData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,32 @@ public GwpNameValue(string name, double value, MultiplierType type = MultiplierT
public class GwpData : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// List of all RevitElements belonging to GwpData
/// </summary>
public List<RevitElement> RevitElements = new List<RevitElement>();

/// <summary>
/// Get total rebar weight of all RevitElements belonging to this GwpData
/// </summary>
/// <returns>Total Rebar Weight</returns>
public double GetTotalRebarWeight()
{
double totalRebarWeight = 0.0;
foreach (var revitElement in RevitElements)
{
if (revitElement.Category == RevitCategory.Floor)
{
totalRebarWeight += VolumeFactor * RebarWeightMultiplier * revitElement.Area;
}
else
{
totalRebarWeight += VolumeFactor * RebarWeightMultiplier * revitElement.Volume / 27;
}
}
return totalRebarWeight;
}

/// <summary>
/// GWP representation
Expand All @@ -192,6 +218,7 @@ public GwpData(RevitCategory revitCategory, string materialName)
{
Category = revitCategory;
MaterialName = materialName;
volumeFactor = 1.00;
}

/// <summary>
Expand Down Expand Up @@ -248,11 +275,14 @@ public double RebarGwp
/// </summary>
public double RebarEstimateBasis
{
get { return rebarEstimateBasis; }
get
{
return VolumeFactor * rebarEstimateBasis;
}
set
{
rebarEstimateBasis = value;
RebarWeight = rebarEstimateBasis * rebarWeightMultiplier;
RebarWeight = RebarEstimateBasis * RebarWeightMultiplier;
}
}

Expand All @@ -263,7 +293,7 @@ public string RebarEstimateBasisString
{
get
{
string val = rebarEstimateBasis.ToString("N2");
string val = RebarEstimateBasis.ToString("N2");
if (this.Category == RevitCategory.Floor) val = val + " SF";
else val = val + " CY";
return val;
Expand All @@ -280,7 +310,8 @@ public double RebarWeightMultiplier
set
{
rebarWeightMultiplier = value;
RebarWeight = rebarEstimateBasis * rebarWeightMultiplier;
RebarWeight = RebarEstimateBasis * RebarWeightMultiplier;
OnPropertyChanged("RebarWeight");
}
}

Expand Down Expand Up @@ -343,22 +374,41 @@ public Dictionary<string, double> rebarLevelRatio
public double Volume {
get
{
return volume;
return Math.Round(VolumeFactor * volume, 2);
}
set
{
volume = Math.Round(value, 2);
}
}

private double volumeFactor;
/// <summary>
/// Factor for Volume
/// </summary>
public double VolumeFactor
{
get
{
return volumeFactor;
}
set
{
volumeFactor = value;
OnPropertyChanged("VolumeString");
OnPropertyChanged("RebarEstimateBasisString");
RebarWeight = RebarEstimateBasis * RebarWeightMultiplier;
}
}

/// <summary>
/// Volume string with unit
/// </summary>
public string VolumeString
{
get
{
return volume.ToString("N0") + " CF";
return Volume.ToString("N0") + " CF";
}
}

Expand All @@ -384,7 +434,7 @@ public string DensityString
{
get
{
return density.ToString("N0") + " PCF";
return Density.ToString("N0") + " PCF";
}
}

Expand Down
4 changes: 2 additions & 2 deletions Beacon/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.0.0")]
[assembly: AssemblyFileVersion("0.3.0.0")]
[assembly: AssemblyVersion("0.4.0.0")]
[assembly: AssemblyFileVersion("0.4.0.0")]
5 changes: 3 additions & 2 deletions Beacon/UI/DataGridUI.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
<DataGridTextColumn Header="Id" Binding="{Binding Id}" IsReadOnly="True" />
<DataGridTextColumn Header="Name" Binding="{Binding Name}" IsReadOnly="True"/>
<DataGridTextColumn Header="AssociatedLevel" Binding="{Binding AssociatedLevel}" IsReadOnly="True"/>
<DataGridTextColumn Header="Volume (CF)" Binding="{Binding Volume, StringFormat=N2}" IsReadOnly="True"/>
<DataGridTextColumn Header="Volume Factor" Binding="{Binding VolumeFactor, StringFormat=N2}" IsReadOnly="True"/>
<DataGridTextColumn Header="Factored Volume (CF)" Binding="{Binding FactoredVolume, StringFormat=N2}" IsReadOnly="True"/>
<DataGridTextColumn Header="Density (PCF)" Binding="{Binding Density, StringFormat=N2}" IsReadOnly="True" />
<DataGridTextColumn Header="Weight (LB)" Binding="{Binding Weight, StringFormat=N2}" IsReadOnly="True"/>
<DataGridTextColumn Header="Factored Weight (LB)" Binding="{Binding FactoredWeight, StringFormat=N2}" IsReadOnly="True"/>
<DataGridTextColumn Header="Area (SF)" Binding="{Binding Area, StringFormat=N2}" IsReadOnly="True"/>
<DataGridTextColumn Header="Material" Binding="{Binding Material}" IsReadOnly="True"/>
<DataGridTextColumn Header="MaterialName" Binding="{Binding MaterialName}" IsReadOnly="True" />
Expand Down
41 changes: 35 additions & 6 deletions Beacon/UI/MainUI.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
Title="Beacon" Height="900" Width="1500" Closing="Window_Closing">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="37*"/>
<ColumnDefinition Width="48*"/>
<ColumnDefinition Width="40*"/>
<ColumnDefinition Width="45*"/>
<ColumnDefinition Width="15*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
Expand Down Expand Up @@ -40,7 +40,7 @@
</Grid>

<TabControl Grid.Column="0" Grid.Row="0" Grid.RowSpan="9" Margin="10">
<TabItem Header="Steel">
<TabItem Name="SteelTab" Header="Steel" GotFocus="SteelTab_GotFocus">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5*"></RowDefinition>
Expand All @@ -62,6 +62,13 @@
<DataGrid.Columns>
<DataGridTextColumn Header="Category" Binding="{Binding Category}" IsReadOnly="True" />
<DataGridTextColumn Header="Material Name" Binding="{Binding MaterialName}" IsReadOnly="True"/>
<DataGridTemplateColumn Header="Factor">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=VolumeFactor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" LostFocus="TextBox_LostFocus" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Volume" Binding="{Binding VolumeString}" IsReadOnly="True"/>
<DataGridTextColumn Header="Density" Binding="{Binding DensityString}" IsReadOnly="True"/>
<DataGridTemplateColumn Header="GWP Type">
Expand All @@ -82,7 +89,7 @@
</DataGrid>
</Grid>
</TabItem>
<TabItem Header="Concrete">
<TabItem Name="ConcreteTab" Header="Concrete" GotFocus="ConcreteTab_GotFocus">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5*"></RowDefinition>
Expand All @@ -104,6 +111,13 @@
<DataGrid.Columns>
<DataGridTextColumn Header="Category" Binding="{Binding Category}" IsReadOnly="True"/>
<DataGridTextColumn Header="Material Name" Binding="{Binding MaterialName}" IsReadOnly="True"/>
<DataGridTemplateColumn Header="Factor">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=VolumeFactor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" LostFocus="TextBox_LostFocus" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Volume" Binding="{Binding VolumeString}" IsReadOnly="True"/>
<DataGridTextColumn Header="Density" Binding="{Binding DensityString}" IsReadOnly="True"/>
<DataGridTemplateColumn Header="GWP Type">
Expand All @@ -124,7 +138,7 @@
</DataGrid>
</Grid>
</TabItem>
<TabItem Header="Timber">
<TabItem Name="TimberTab" Header="Timber" GotFocus="TimberTab_GotFocus">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5*"></RowDefinition>
Expand All @@ -146,6 +160,13 @@
<DataGrid.Columns>
<DataGridTextColumn Header="Category" Binding="{Binding Category}" IsReadOnly="True"/>
<DataGridTextColumn Header="Material Name" Binding="{Binding MaterialName}" IsReadOnly="True"/>
<DataGridTemplateColumn Header="Factor">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=VolumeFactor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" LostFocus="TextBox_LostFocus" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Volume" Binding="{Binding VolumeString}" IsReadOnly="True"/>
<DataGridTextColumn Header="Density" Binding="{Binding DensityString}" IsReadOnly="True"/>
<DataGridTemplateColumn Header="GWP Type">
Expand All @@ -166,7 +187,7 @@
</DataGrid>
</Grid>
</TabItem>
<TabItem Header="Unknown" Name="UnknownTab" ToolTip="Bold if there are elements with undefined material or material with zero density.">
<TabItem Header="Unknown" Name="UnknownTab" ToolTip="Bold if there are elements with undefined material or material with zero density." GotFocus="UnknownTab_GotFocus">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5*"></RowDefinition>
Expand All @@ -188,6 +209,13 @@
<DataGrid.Columns>
<DataGridTextColumn Header="Category" Binding="{Binding Category}" IsReadOnly="True"/>
<DataGridTextColumn Header="Material Name" Binding="{Binding MaterialName}" IsReadOnly="True"/>
<DataGridTemplateColumn Header="Factor">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=VolumeFactor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" LostFocus="TextBox_LostFocus" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Volume" Binding="{Binding VolumeString}" IsReadOnly="True"/>
<DataGridTextColumn Header="Density" Binding="{Binding DensityString}" IsReadOnly="True"/>
<DataGridTemplateColumn Header="GWP Type">
Expand Down Expand Up @@ -312,5 +340,6 @@
EC3 Tool
</Hyperlink>
</TextBlock>
<Label Grid.Column="2" Grid.Row="8" Name="VersionLabel" Content="v0.3.0.0" FontWeight="Normal" HorizontalAlignment="Right" Margin="0,0,5,0" VerticalAlignment="Bottom" Height="26" Width="50" />
</Grid>
</Window>
Loading

0 comments on commit 453deb1

Please sign in to comment.