fix (revit): Make revit exception be a conversion exception (#1105)
* Make revit exception be a conversion exception * Use ApplicationException * chore: variable name --------- Co-authored-by: Björn Steinhagen <steinhagen.bjoern@gmail.com>
This commit is contained in:
+24
-15
@@ -3,6 +3,8 @@ using Speckle.Converters.Common.Objects;
|
||||
using Speckle.Converters.Revit2023.ToSpeckle.Properties;
|
||||
using Speckle.Converters.RevitShared.Services;
|
||||
using Speckle.Converters.RevitShared.Settings;
|
||||
using Speckle.Sdk.Common.Exceptions;
|
||||
using ApplicationException = Autodesk.Revit.Exceptions.ApplicationException;
|
||||
|
||||
namespace Speckle.Converters.RevitShared.ToSpeckle;
|
||||
|
||||
@@ -80,22 +82,29 @@ public class MaterialQuantitiesToSpeckleLite : ITypedConverter<DB.Element, Dicti
|
||||
quantities[matName] = materialQuantity;
|
||||
}
|
||||
|
||||
// add area and volume props
|
||||
var areaUnitType = unitSettings.GetFormatOptions(DB.SpecTypeId.Area).GetUnitTypeId();
|
||||
AddMaterialProperty(
|
||||
materialQuantity,
|
||||
"area",
|
||||
_scalingService.Scale(element.GetMaterialArea(matId, false), areaUnitType),
|
||||
areaUnitType
|
||||
);
|
||||
try
|
||||
{
|
||||
// add area and volume props
|
||||
var areaUnitType = unitSettings.GetFormatOptions(DB.SpecTypeId.Area).GetUnitTypeId();
|
||||
AddMaterialProperty(
|
||||
materialQuantity,
|
||||
"area",
|
||||
_scalingService.Scale(element.GetMaterialArea(matId, false), areaUnitType),
|
||||
areaUnitType
|
||||
);
|
||||
|
||||
var volumeUnitType = unitSettings.GetFormatOptions(DB.SpecTypeId.Volume).GetUnitTypeId();
|
||||
AddMaterialProperty(
|
||||
materialQuantity,
|
||||
"volume",
|
||||
_scalingService.Scale(element.GetMaterialVolume(matId), volumeUnitType),
|
||||
volumeUnitType
|
||||
);
|
||||
var volumeUnitType = unitSettings.GetFormatOptions(DB.SpecTypeId.Volume).GetUnitTypeId();
|
||||
AddMaterialProperty(
|
||||
materialQuantity,
|
||||
"volume",
|
||||
_scalingService.Scale(element.GetMaterialVolume(matId), volumeUnitType),
|
||||
volumeUnitType
|
||||
);
|
||||
}
|
||||
catch (ApplicationException ex)
|
||||
{
|
||||
throw new ConversionException("Error in Material Quantities", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user