Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/RevitRoundingOfAreas/Models/RevitRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void RoundingOfAreas(List<SpatialModel> spatialModels, RevitParam sourceP
if(sourceValue is 0) {
continue;
}

double roundedValue = RoundWithAccuracy(sourceValue, accuracy);

if(roundedValue is 0) {
Expand Down Expand Up @@ -178,9 +178,11 @@ private bool ValidatePhase(SpatialElement spatialElement, ElementId phaseId) {

// Метод округления числа с заданной точкой после запятой
private double RoundWithAccuracy(double? value, int accuracy) {
double step = Math.Pow(10, -accuracy); // Зависимость от знаков после запятой
double eps = step / 1000.0; // Погрешность
return value.HasValue
? Math.Round(
ConvertValueFromInternalUnits(value.Value),
ConvertValueFromInternalUnits(value.Value) + eps,
accuracy,
systemPluginConfig.MidpointRounding)
: 0;
Expand Down
Loading