Skip to content

Commit

Permalink
Merge pull request #5 from ThorntonTomasetti/Release-0.3.0.0
Browse files Browse the repository at this point in the history
Release 0.3.0.0
  • Loading branch information
ktam-tt authored Jan 16, 2020
2 parents dd91693 + c40fa87 commit 983e41e
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 30 deletions.
62 changes: 41 additions & 21 deletions Beacon/Data/RevitReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private void ReadFramings()
revitElement.AssociatedLevel = GetMappedLevel(revitElement.AssociatedLevel);

var elementVolume = element.GetParameters("Volume");
revitElement.Volume = elementVolume.Count() > 0 ? elementVolume[0].AsDouble() : 0.0;
revitElement.Volume = elementVolume.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(elementVolume[0].AsDouble(), DisplayUnitType.DUT_CUBIC_FEET) : 0.0;
var framingStructuralMaterial = this.GetStructuralMaterialFromElement(element, a_doc);
revitElement.MaterialName = framingStructuralMaterial != null ? framingStructuralMaterial.Name : "";
revitElement.Material = framingStructuralMaterial != null ? GetMaterialType(framingStructuralMaterial) : MaterialType.Unknown;
Expand Down Expand Up @@ -208,7 +208,7 @@ private void ReadColumns()
revitElement.AssociatedLevel = GetMappedLevel(revitElement.AssociatedLevel);

var elementVolume = element.GetParameters("Volume");
revitElement.Volume = elementVolume.Count() > 0 ? elementVolume[0].AsDouble() : 0.0;
revitElement.Volume = elementVolume.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(elementVolume[0].AsDouble(), DisplayUnitType.DUT_CUBIC_FEET) : 0.0;
var framingStructuralMaterial = this.GetStructuralMaterialFromElement(element, a_doc);
revitElement.MaterialName = framingStructuralMaterial != null ? framingStructuralMaterial.Name : "";
revitElement.Material = framingStructuralMaterial != null ? GetMaterialType(framingStructuralMaterial) : MaterialType.Unknown;
Expand Down Expand Up @@ -274,20 +274,24 @@ private void ReadFloors()
revitElement.AssociatedLevel = GetMappedLevel(revitElement.AssociatedLevel);

var floorArea = element.GetParameters("Area");
revitElement.Area = floorArea.Count() > 0 ? floorArea[0].AsDouble() : 0.0;
revitElement.Area = floorArea.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(floorArea[0].AsDouble(), DisplayUnitType.DUT_SQUARE_FEET) : 0.0;

var elementVolume = element.GetParameters("Volume");
revitElement.Volume = elementVolume.Count() > 0 ? elementVolume[0].AsDouble() : 0.0;
revitElement.Volume = elementVolume.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(elementVolume[0].AsDouble(), DisplayUnitType.DUT_CUBIC_FEET) : 0.0;

// Look for metal deck
bool addRevitElement = true;
var floorTypeId = element.GetTypeId();
var floorType = a_doc.GetElement(floorTypeId) as HostObjAttributes;
if (floorType != null)
{
var elementCompoundStructure = floorType.GetCompoundStructure();
int structuralLayerIndex = elementCompoundStructure.StructuralMaterialIndex;
var compoundStructureLayers = elementCompoundStructure.GetLayers();
foreach (var elementLayer in compoundStructureLayers)
bool allStructuralDecks = true;
for (int i = 0; i < compoundStructureLayers.Count; i++)
{
var elementLayer = compoundStructureLayers[i];
if (elementLayer.Function == MaterialFunctionAssignment.StructuralDeck)
{
var elementLayerDeck = a_doc.GetElement(elementLayer.DeckProfileId) as FamilySymbol;
Expand All @@ -296,19 +300,19 @@ private void ReadFloors()
{
// hr = height of rib
var hrParam = elementLayerDeck.GetParameters("hr");
double hr = hrParam.Count() > 0 ? hrParam[0].AsDouble() : 0.0;
double hr = hrParam.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(hrParam[0].AsDouble(), DisplayUnitType.DUT_DECIMAL_FEET) : 0.0;
// wr = width of rib
var wrParam = elementLayerDeck.GetParameters("wr");
double wr = wrParam.Count() > 0 ? wrParam[0].AsDouble() : 0.0;
double wr = wrParam.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(wrParam[0].AsDouble(), DisplayUnitType.DUT_DECIMAL_FEET) : 0.0;
// rr = root of rib
var rrParam = elementLayerDeck.GetParameters("rr");
double rr = rrParam.Count() > 0 ? rrParam[0].AsDouble() : 0.0;
double rr = rrParam.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(rrParam[0].AsDouble(), DisplayUnitType.DUT_DECIMAL_FEET) : 0.0;
// Sr = width of rib
var srParam = elementLayerDeck.GetParameters("Sr");
double Sr = srParam.Count() > 0 ? srParam[0].AsDouble() : 0.0;
double Sr = srParam.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(srParam[0].AsDouble(), DisplayUnitType.DUT_DECIMAL_FEET) : 0.0;
// Thickness
var thicknessParam = elementLayerDeck.GetParameters("Thickness");
double thickness = thicknessParam.Count() > 0 ? thicknessParam[0].AsDouble() : 0.0;
double thickness = thicknessParam.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(thicknessParam[0].AsDouble(), DisplayUnitType.DUT_DECIMAL_FEET) : 0.0;
// Layer Density
double layerDensity = GetDensity(elementLayerMaterial);

Expand All @@ -333,9 +337,24 @@ private void ReadFloors()
elementLayerMaterial.Name, GetMaterialType(elementLayerMaterial), layerDensity);
floorDeck.Area = revitElement.Area;
a_revitElementData.Add(floorDeck);

// Don't add revitElement if added here, avoid double counting and counting deck with full depth volume.
if (addRevitElement == true)
{
addRevitElement = structuralLayerIndex == i ? false : true;
}
}
}
}
else
{
allStructuralDecks = false;
}
}

if (allStructuralDecks == false && addRevitElement == false)
{
addRevitElement = true;
}
}

Expand All @@ -345,7 +364,7 @@ private void ReadFloors()
double density = framingStructuralMaterial != null ? GetDensity(framingStructuralMaterial) : 0.0;
revitElement.Density = density;

a_revitElementData.Add(revitElement);
if (addRevitElement) a_revitElementData.Add(revitElement);
}
}
catch (Exception e)
Expand Down Expand Up @@ -389,7 +408,7 @@ private void ReadWalls()
revitElement.AssociatedLevel = GetMappedLevel(revitElement.AssociatedLevel);

var elementVolume = element.GetParameters("Volume");
revitElement.Volume = elementVolume.Count() > 0 ? elementVolume[0].AsDouble() : 0.0;
revitElement.Volume = elementVolume.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(elementVolume[0].AsDouble(), DisplayUnitType.DUT_CUBIC_FEET) : 0.0;
var framingStructuralMaterial = this.GetStructuralMaterialFromElement(element, a_doc);
revitElement.MaterialName = framingStructuralMaterial != null ? framingStructuralMaterial.Name : "";
revitElement.Material = framingStructuralMaterial != null ? GetMaterialType(framingStructuralMaterial) : MaterialType.Unknown;
Expand All @@ -398,12 +417,13 @@ private void ReadWalls()

// Split Wall by Levels
var unconnectedHeight = element.GetParameters("Unconnected Height"); // accounts for walls that have no top constraint assigned
double wallHeight = unconnectedHeight.Count > 0 ? unconnectedHeight[0].AsDouble() : 0;
double wallHeight = unconnectedHeight.Count > 0 ? UnitUtils.ConvertFromInternalUnits(unconnectedHeight[0].AsDouble(), DisplayUnitType.DUT_DECIMAL_FEET) : 0;
if (wallBaseConstraintLevel != null && wallHeight > 0 && a_levelData.Count > 0)
{
var wallBottomElevation = wallBaseConstraintLevel.ProjectElevation;

var wallBottomOffset = element.GetParameters("Base Offset");
var baseOffset = wallBottomOffset.Count > 0 ? wallBottomOffset[0].AsDouble() : 0;
var baseOffset = wallBottomOffset.Count > 0 ? UnitUtils.ConvertFromInternalUnits(wallBottomOffset[0].AsDouble(), DisplayUnitType.DUT_DECIMAL_FEET) : 0;
double wtrueBel = wallBottomElevation + baseOffset; // true bottom elevation of wall with model offset applied
double wtrueTel = wtrueBel + wallHeight; // true top elevation of wall
SplitByLevels(revitElement, wtrueBel, wtrueTel, wallHeight);
Expand Down Expand Up @@ -470,7 +490,7 @@ private void ReadFoundations()
revitElement.AssociatedLevel = GetMappedLevel(revitElement.AssociatedLevel);

var elementVolume = element.GetParameters("Volume");
revitElement.Volume = elementVolume.Count() > 0 ? elementVolume[0].AsDouble() : 0.0;
revitElement.Volume = elementVolume.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(elementVolume[0].AsDouble(), DisplayUnitType.DUT_CUBIC_FEET) : 0.0;
var framingStructuralMaterial = this.GetStructuralMaterialFromElement(element, a_doc);
revitElement.MaterialName = framingStructuralMaterial != null ? framingStructuralMaterial.Name : "";
revitElement.Material = framingStructuralMaterial != null ? GetMaterialType(framingStructuralMaterial) : MaterialType.Unknown;
Expand Down Expand Up @@ -678,12 +698,12 @@ private double GetDensity(Material material)
if (structuralAsset != null)
{
var densityParam = structuralAsset.GetParameters("Density");
double FromMetricToImperialUnitWeight = 2.20462; //coefficient of converting unit weight from metric unit (kg/ft^3) to imperial unit (lb/ft^3)
density = densityParam.Count() > 0 ? densityParam[0].AsDouble() * FromMetricToImperialUnitWeight : 0.0;
density = densityParam.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(densityParam[0].AsDouble(), DisplayUnitType.DUT_POUNDS_MASS_PER_CUBIC_FOOT) : 0.0;

if (density == 0.0)
{
densityParam = structuralAsset.GetParameters("Unit weight");
density = densityParam.Count() > 0 ? densityParam[0].AsDouble() * FromMetricToImperialUnitWeight : 0.0;
var unitWeightParam = structuralAsset.GetParameters("Unit weight");
density = unitWeightParam.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(unitWeightParam[0].AsDouble(), DisplayUnitType.DUT_POUNDS_FORCE_PER_CUBIC_FOOT) : 0.0;
}
}
return density;
Expand Down Expand Up @@ -728,10 +748,10 @@ public Line CreateVerticalColumnCurve(FamilyInstance inst)
if (pt != null && baseLevel != null && topLevel != null)
{
var baseOffset = inst.GetParameters("Base Offset");
var baseOffsetVal = baseOffset != null && baseOffset.Count > 0 ? baseOffset[0].AsDouble() : 0.0;
var baseOffsetVal = baseOffset != null && baseOffset.Count > 0 ? UnitUtils.ConvertFromInternalUnits(baseOffset[0].AsDouble(), DisplayUnitType.DUT_DECIMAL_FEET) : 0.0;

var topOffset = inst.GetParameters("Top Offset");
var topOffsetVal = topOffset != null && topOffset.Count > 0 ? topOffset[0].AsDouble() : 0.0;
var topOffsetVal = topOffset != null && topOffset.Count > 0 ? UnitUtils.ConvertFromInternalUnits(topOffset[0].AsDouble(), DisplayUnitType.DUT_DECIMAL_FEET) : 0.0;

var strPt = new XYZ(pt.X, pt.Y, baseLevel.Elevation + baseOffsetVal);
var endPt = new XYZ(pt.X, pt.Y, topLevel.Elevation + topOffsetVal);
Expand Down
6 changes: 3 additions & 3 deletions Beacon/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Beacon")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -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.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyVersion("0.3.0.0")]
[assembly: AssemblyFileVersion("0.3.0.0")]
12 changes: 6 additions & 6 deletions BeaconInstaller/BeaconInstaller.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:Beacon, Version=0.2.0.0, Culture=neutral, processorArchitecture=MSIL"
"AssemblyAsmDisplayName" = "8:Beacon, Version=0.3.0.0, Culture=neutral, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_3CD25B80BEDC47E3829FE3DFE177225F"
Expand Down Expand Up @@ -850,7 +850,7 @@
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:Beacon, Version=0.2.0.0, Culture=neutral, processorArchitecture=MSIL"
"AssemblyAsmDisplayName" = "8:Beacon, Version=0.3.0.0, Culture=neutral, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_5A15CD9C758B43AABE0D4F533769B75D"
Expand Down Expand Up @@ -912,7 +912,7 @@
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:Beacon, Version=0.2.0.0, Culture=neutral, processorArchitecture=MSIL"
"AssemblyAsmDisplayName" = "8:Beacon, Version=0.3.0.0, Culture=neutral, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_8B51B39082594E35BA87D08806F52AFE"
Expand Down Expand Up @@ -1250,15 +1250,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Beacon"
"ProductCode" = "8:{6D483BBC-FE44-44B1-8FAF-7C6BCDF1F348}"
"PackageCode" = "8:{808C72D3-8BB0-4320-8F95-A13BD74960D4}"
"ProductCode" = "8:{376FED73-D9FE-4F25-9EC4-CFCE01ACFC2C}"
"PackageCode" = "8:{B4ED5BB3-8E94-4A36-B7CD-3F3666114337}"
"UpgradeCode" = "8:{A3A19A37-6DE8-443F-9205-329EE02CD780}"
"AspNetVersion" = "8:2.0.50727.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:0.2.0"
"ProductVersion" = "8:0.3.0"
"Manufacturer" = "8:Beacon"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
Expand Down
Binary file modified BeaconInstaller/Release2020/BeaconInstaller.msi
Binary file not shown.
Binary file modified Deployment/Beacon.zip
Binary file not shown.
Binary file modified Deployment/Revit2018/Beacon/Beacon.dll
Binary file not shown.
Binary file modified Deployment/Revit2019/Beacon/Beacon.dll
Binary file not shown.
Binary file modified Deployment/Revit2020/Beacon/Beacon.dll
Binary file not shown.

0 comments on commit 983e41e

Please sign in to comment.