Skip to content

Commit

Permalink
added conditional compilation example from https://forums.autodesk.co…
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremytammik committed Jun 2, 2021
1 parent ef346d3 commit 3b679c5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions BuildingCoder/BuildingCoder/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@
// 2021-05-06 2022.0.150.5 added SketchEditScopeSample
// 2021-05-10 2022.0.150.6 added GetCloudModelLocalCacheFilepath from https://forums.autodesk.com/t5/revit-api-forum/get-bim-360-model-s-quot-absolute-quot-path/m-p/10292538
// 2021-05-13 2022.0.150.7 added bool enforceResultOnLine argument to LinePlaneIntersection suggested by Miguel B in https://thebuildingcoder.typepad.com/blog/2020/10/high-performance-outline-and-line-plane-intersection.html#comment-5381317900
// 2021-06-02 2022.0.150.8 added conditional compilation example from https://forums.autodesk.com/t5/revit-api-forum/forgetypeid-how-to-use/m-p/10357374
//
[assembly: AssemblyVersion( "2022.0.150.7" )]
[assembly: AssemblyFileVersion( "2022.0.150.7" )]
20 changes: 20 additions & 0 deletions BuildingCoder/BuildingCoder/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,26 @@ public static void ListForgeTypeIds()
UnitUtils.GetTypeCatalogStringForUnit( fti ) );
}
}

#region Conditional compilation using ifdef to handle ForgeTypeId
public static double InternalUnitToMillimetres(
double a,
bool roundup = false )
{
double mm;

#if (CONFIG_R2019 || CONFIG_R2020)
mm = UnitUtils.ConvertFromInternalUnits(
a, DisplayUnitType.DUT_MILLIMETERS );
#else
mm = UnitUtils.ConvertFromInternalUnits(
a, UnitTypeId.Millimeters );
#endif

return roundup ? Math.Round( mm, 0 ) : mm;
}
#endregion // Conditional compilation using ifdef to handle ForgeTypeId

#endregion // Unit Handling

#region Formatting
Expand Down

0 comments on commit 3b679c5

Please sign in to comment.