Skip to content

Commit

Permalink
update handling of compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
o-babii committed Nov 27, 2024
1 parent cf6009c commit 31c1d57
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions Source/Revit.IFC.Export/Exporter/CeilingExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using Revit.IFC.Export.Utility;
using Revit.IFC.Export.Toolkit;
using Revit.IFC.Common.Enums;
using System.Reflection;

namespace Revit.IFC.Export.Exporter
{
Expand Down Expand Up @@ -141,14 +142,24 @@ public static void ExportCovering(ExporterIFC exporterIFC, Element element, ref
if (ExporterCacheManager.ExportCeilingGrids())
{
IList<Curve> ceilingGridLines = null;
try
{
ceilingGridLines = (element as Ceiling)?.GetCeilingGridLines(true);
}
catch(MissingMethodException)

var ceiling = element as Ceiling;
if (ceiling != null)
{
// Ceiling.GetCeilingGridLines method is availiable since 2025.3
// ignore ceiling grid export for older Revit versions.
try
{
var methodInfo = typeof(Ceiling).GetMethod("GetCeilingGridLines", BindingFlags.Instance | BindingFlags.Public);
if (methodInfo != null)
{
// Invoke the method dynamically and cast the result to the expected type
ceilingGridLines = (IList<Curve>)methodInfo.Invoke(ceiling, new object[] { true });
}
}
catch (Exception)
{
// Ceiling.GetCeilingGridLines method is availiable since 2025.3
// ignore ceiling grid export for older Revit versions.
}
}

HashSet<IFCAnyHandle> repItems = new();
Expand Down

0 comments on commit 31c1d57

Please sign in to comment.