diff --git a/Directory.Packages.props b/Directory.Packages.props index 595b6f7e..40ad15fe 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ - + @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/Revit/Revit2023/Speckle.Revit2023.Api/packages.lock.json b/Revit/Revit2023/Speckle.Revit2023.Api/packages.lock.json index b858cfd8..7511a9f7 100644 --- a/Revit/Revit2023/Speckle.Revit2023.Api/packages.lock.json +++ b/Revit/Revit2023/Speckle.Revit2023.Api/packages.lock.json @@ -31,9 +31,9 @@ }, "Speckle.ProxyGenerator": { "type": "Direct", - "requested": "[0.1.6, )", - "resolved": "0.1.6", - "contentHash": "SO9Udllol9Krpq+UFBr54Es79kmiIQmtSRXKFcvplnisdwmjo5CBlucuuvgZYmQUSvF/9KC4BcuVllZRTCBDHQ==" + "requested": "[0.1.7, )", + "resolved": "0.1.7", + "contentHash": "CyMcXENu9e5qHPPbcSTMAtYt4AYHaFaeo/WL7Qhw4MiQyEk+j2ZFsDRY3YxWDmrp41gMcOmuXUPzFEWd0A6YYA==" }, "Speckle.Revit.API": { "type": "Direct", diff --git a/Revit/Revit2024/Speckle.Revit2024.Api/packages.lock.json b/Revit/Revit2024/Speckle.Revit2024.Api/packages.lock.json index 6a5fffd8..50da5882 100644 --- a/Revit/Revit2024/Speckle.Revit2024.Api/packages.lock.json +++ b/Revit/Revit2024/Speckle.Revit2024.Api/packages.lock.json @@ -31,9 +31,9 @@ }, "Speckle.ProxyGenerator": { "type": "Direct", - "requested": "[0.1.6, )", - "resolved": "0.1.6", - "contentHash": "SO9Udllol9Krpq+UFBr54Es79kmiIQmtSRXKFcvplnisdwmjo5CBlucuuvgZYmQUSvF/9KC4BcuVllZRTCBDHQ==" + "requested": "[0.1.7, )", + "resolved": "0.1.7", + "contentHash": "CyMcXENu9e5qHPPbcSTMAtYt4AYHaFaeo/WL7Qhw4MiQyEk+j2ZFsDRY3YxWDmrp41gMcOmuXUPzFEWd0A6YYA==" }, "Speckle.Revit.API": { "type": "Direct", diff --git a/Revit/Speckle.Revit.Api/RevitFilterFactory.cs b/Revit/Speckle.Revit.Api/RevitFilterFactory.cs index b8217f8a..45390136 100644 --- a/Revit/Speckle.Revit.Api/RevitFilterFactory.cs +++ b/Revit/Speckle.Revit.Api/RevitFilterFactory.cs @@ -98,12 +98,12 @@ public partial interface IRevitFilteredElementCollectorProxy : IRevitFilteredEle public partial class FilteredElementCollectorProxy { - public IEnumerable OfClass(IProxyMap proxyMap) => + public IEnumerable OfClass() => _Instance .OfClass( - proxyMap.GetHostTypeFromMappedType(typeof(T)) + ProxyMap.GetHostTypeFromMappedType(typeof(T)) ?? throw new InvalidOperationException($"Could not unmap type: {typeof(T).FullName}") ) - .Select(x => proxyMap.CreateProxy(typeof(T), x)) + .Select(x => ProxyMap.CreateProxy(typeof(T), x)) .Cast(); } diff --git a/Revit/Speckle.Revit.Interfaces/IRevitCurve.cs b/Revit/Speckle.Revit.Interfaces/IRevitCurve.cs index 2de57f6d..e77b7893 100644 --- a/Revit/Speckle.Revit.Interfaces/IRevitCurve.cs +++ b/Revit/Speckle.Revit.Interfaces/IRevitCurve.cs @@ -101,12 +101,6 @@ public interface IRevitGroup : IRevitElement IList GetMemberIds(); } -public interface IRevitSolid : IRevitGeometryObject -{ - IRevitFaceArray Faces { get; } - double SurfaceArea { get; } -} - public interface IRevitFace { IRevitMesh Triangulate(); diff --git a/Revit/Speckle.Revit.Interfaces/IRevitFilterFactory.cs b/Revit/Speckle.Revit.Interfaces/IRevitFilterFactory.cs index 99d8a564..97b5df18 100644 --- a/Revit/Speckle.Revit.Interfaces/IRevitFilterFactory.cs +++ b/Revit/Speckle.Revit.Interfaces/IRevitFilterFactory.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace Speckle.Revit.Interfaces; @@ -19,31 +19,3 @@ params IRevitElementId[] elementIds IRevitPointCloudFilter CreateMultiPlaneFilter(params IRevitPlane[] planes); IRevitElementCategoryFilter CreateElementCategoryFilter(RevitBuiltInCategory category); } - -public interface IProxyMap -{ - Type? GetMappedTypeFromHostType(Type type); - Type? GetMappedTypeFromProxyType(Type type); - Type? GetHostTypeFromMappedType(Type type); - - object CreateProxy(Type type, object toWrap); -} - -// ghetto default interface implementation :( -public static class ProxyMapExtensions -{ - public static (Type, object)? WrapIfExists(this IProxyMap proxyMap, Type target, object toWrap) - { - var mappedType = proxyMap.GetMappedTypeFromHostType(target); - if (mappedType is not null) - { - return (mappedType, proxyMap.CreateProxy(mappedType, toWrap)); - } - mappedType = proxyMap.GetMappedTypeFromProxyType(target); - if (mappedType is not null) - { - return (mappedType, toWrap); - } - return null; - } -} diff --git a/Revit/Speckle.Revit.Interfaces/IRevitFilteredElementCollector.cs b/Revit/Speckle.Revit.Interfaces/IRevitFilteredElementCollector.cs index caefcae7..731d1acc 100644 --- a/Revit/Speckle.Revit.Interfaces/IRevitFilteredElementCollector.cs +++ b/Revit/Speckle.Revit.Interfaces/IRevitFilteredElementCollector.cs @@ -2,5 +2,5 @@ public interface IRevitFilteredElementCollector : IRevitElementFilter { - IEnumerable OfClass(IProxyMap proxyMap); + IEnumerable OfClass(); } diff --git a/Revit/Speckle.Revit.Interfaces/IRevitSolid.cs b/Revit/Speckle.Revit.Interfaces/IRevitSolid.cs new file mode 100644 index 00000000..05653c60 --- /dev/null +++ b/Revit/Speckle.Revit.Interfaces/IRevitSolid.cs @@ -0,0 +1,8 @@ +#nullable enable +namespace Speckle.Revit.Interfaces; + +public interface IRevitSolid : IRevitGeometryObject +{ + IRevitFaceArray Faces { get; } + double SurfaceArea { get; } +}