diff --git a/Source/Revit.IFC.Export/Exporter/Exporter.cs b/Source/Revit.IFC.Export/Exporter/Exporter.cs index 27732f69..1f89c034 100644 --- a/Source/Revit.IFC.Export/Exporter/Exporter.cs +++ b/Source/Revit.IFC.Export/Exporter/Exporter.cs @@ -4750,8 +4750,6 @@ private bool ExportIFCMapConversion(ExporterIFC exporterIFC, Document doc, IFCAn ProjectInfo projectInfo = doc.ProjectInformation; - - double dblVal = double.MinValue; IFCFile file = exporterIFC.GetFile(); // Explanation: @@ -4768,8 +4766,6 @@ private bool ExportIFCMapConversion(ExporterIFC exporterIFC, Document doc, IFCAn string crsMapUnitStr = null; double? scale = null; - if (ParameterUtil.GetDoubleValueFromElement(projectInfo, "ProjectGlobalPositioning.Scale", out dblVal) != null) - scale = dblVal; string crsVerticalDatum = null; string crsMapProjection = null; string crsMapZone = null; @@ -4937,6 +4933,19 @@ private bool ExportIFCMapConversion(ExporterIFC exporterIFC, Document doc, IFCAn eastings = UnitUtils.ConvertFromInternalUnits(eastings, utId); northings = UnitUtils.ConvertFromInternalUnits(northings, utId); orthogonalHeight = UnitUtils.ConvertFromInternalUnits(orthogonalHeight, utId); + + double dblVal = double.MinValue; + if (ParameterUtil.GetDoubleValueFromElement(projectInfo, "ProjectGlobalPositioning.Scale", out dblVal) != null && dblVal > MathUtil.Eps()) + { + scale = dblVal; + } + else + { + FormatOptions formatOptions = doc.GetUnits().GetFormatOptions(SpecTypeId.Length); + ForgeTypeId selectedUnitTypeId = formatOptions.GetUnitTypeId(); + if (!utId.Equals(selectedUnitTypeId)) + scale = UnitUtils.Convert(1.0, selectedUnitTypeId, utId); + } IFCAnyHandle mapConversionHnd = IFCInstanceExporter.CreateMapConversion(file, geomRepContext, projectedCRS, eastings, northings, orthogonalHeight, xAxisAbscissa, xAxisOrdinate, scale);