diff --git a/Revit/Speckle.Revit.Api/IRevitModelCurveProxy.cs b/Revit/Speckle.Revit.Api/IRevitModelCurveProxy.cs index 1198319a..b4a7e5af 100644 --- a/Revit/Speckle.Revit.Api/IRevitModelCurveProxy.cs +++ b/Revit/Speckle.Revit.Api/IRevitModelCurveProxy.cs @@ -74,6 +74,29 @@ public partial interface IRevitLocationCurveProxy : IRevitLocationCurve; [Proxy(typeof(Location), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface)] public partial interface IRevitLocationProxy : IRevitLocation; +public partial class LocationProxy +{ + public IRevitLocationCurve? ToLocationCurve() + { + if (_Instance is LocationCurve m) + { + return new LocationCurveProxy(m); + } + + return null; + } + + public IRevitLocationPoint? ToLocationPoint() + { + if (_Instance is LocationPoint m) + { + return new LocationPointProxy(m); + } + + return null; + } +} + [Proxy( typeof(LocationPoint), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface diff --git a/Revit/Speckle.Revit.Api/IRevitUnitsProxy.cs b/Revit/Speckle.Revit.Api/IRevitUnitsProxy.cs index fb2e4d4e..a8918946 100644 --- a/Revit/Speckle.Revit.Api/IRevitUnitsProxy.cs +++ b/Revit/Speckle.Revit.Api/IRevitUnitsProxy.cs @@ -218,6 +218,49 @@ public partial interface IRevitGroupProxy : IRevitGroup; )] public partial interface IRevitGeometryObjectProxy : IRevitGeometryObject; +public partial class GeometryObjectProxy +{ + public IRevitSolid? ToSolid() + { + if (_Instance is Solid m) + { + return new SolidProxy(m); + } + + return null; + } + + public IRevitMesh? ToMesh() + { + if (_Instance is Mesh m) + { + return new MeshProxy(m); + } + + return null; + } + + public IRevitGeometryInstance? ToGeometryInstance() + { + if (_Instance is GeometryInstance m) + { + return new GeometryInstanceProxy(m); + } + + return null; + } + + public IRevitGeometryElement? ToGeometryElement() + { + if (_Instance is GeometryElement m) + { + return new GeometryElementProxy(m); + } + + return null; + } +} + [Proxy( typeof(Options), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface, diff --git a/Revit/Speckle.Revit.Interfaces/IRevitLocation.cs b/Revit/Speckle.Revit.Interfaces/IRevitLocation.cs index c7260a60..51046958 100644 --- a/Revit/Speckle.Revit.Interfaces/IRevitLocation.cs +++ b/Revit/Speckle.Revit.Interfaces/IRevitLocation.cs @@ -1,3 +1,7 @@ namespace Speckle.Revit.Interfaces; -public interface IRevitLocation : IRevitObject; +public interface IRevitLocation : IRevitObject +{ + IRevitLocationCurve? ToLocationCurve(); + IRevitLocationPoint? ToLocationPoint(); +} diff --git a/Revit/Speckle.Revit.Interfaces/IRevitLocationCurve.cs b/Revit/Speckle.Revit.Interfaces/IRevitLocationCurve.cs index 01aad72d..27a5f95f 100644 --- a/Revit/Speckle.Revit.Interfaces/IRevitLocationCurve.cs +++ b/Revit/Speckle.Revit.Interfaces/IRevitLocationCurve.cs @@ -16,6 +16,10 @@ public interface IRevitPolyLine : IRevitGeometryObject public interface IRevitGeometryObject : IRevitObject { IRevitElementId GraphicsStyleId { get; } + IRevitSolid? ToSolid(); + IRevitMesh? ToMesh(); + IRevitGeometryInstance? ToGeometryInstance(); + IRevitGeometryElement? ToGeometryElement(); } public interface IRevitPoint : IRevitObject