Skip to content

Commit

Permalink
Calculate IfcMapConversion Scale attribute (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-vasyi authored Jul 3, 2024
1 parent b83595f commit e63d059
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Source/Revit.IFC.Export/Exporter/Exporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit e63d059

Please sign in to comment.