From 29581fd305acecbf83b084e3a89eca4db41b6c9f Mon Sep 17 00:00:00 2001 From: kike-garbo Date: Fri, 19 May 2023 21:54:56 +0200 Subject: [PATCH 1/2] Moved SpatialElement.cs to Topology/SpatialElement.cs --- .../Parameters/{ => Topology}/SpatialElement.cs | 0 src/RhinoInside.Revit.GH/RhinoInside.Revit.GH.csproj | 4 ++-- .../Types/{ => Topology}/SpatialElement.cs | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename src/RhinoInside.Revit.GH/Parameters/{ => Topology}/SpatialElement.cs (100%) rename src/RhinoInside.Revit.GH/Types/{ => Topology}/SpatialElement.cs (100%) diff --git a/src/RhinoInside.Revit.GH/Parameters/SpatialElement.cs b/src/RhinoInside.Revit.GH/Parameters/Topology/SpatialElement.cs similarity index 100% rename from src/RhinoInside.Revit.GH/Parameters/SpatialElement.cs rename to src/RhinoInside.Revit.GH/Parameters/Topology/SpatialElement.cs diff --git a/src/RhinoInside.Revit.GH/RhinoInside.Revit.GH.csproj b/src/RhinoInside.Revit.GH/RhinoInside.Revit.GH.csproj index 0de56626d..88da0ed59 100644 --- a/src/RhinoInside.Revit.GH/RhinoInside.Revit.GH.csproj +++ b/src/RhinoInside.Revit.GH/RhinoInside.Revit.GH.csproj @@ -325,6 +325,7 @@ + @@ -396,7 +397,6 @@ - @@ -481,11 +481,11 @@ - + diff --git a/src/RhinoInside.Revit.GH/Types/SpatialElement.cs b/src/RhinoInside.Revit.GH/Types/Topology/SpatialElement.cs similarity index 100% rename from src/RhinoInside.Revit.GH/Types/SpatialElement.cs rename to src/RhinoInside.Revit.GH/Types/Topology/SpatialElement.cs From 46aa40e2699eeed6f1b5167638d4d97ae412df6f Mon Sep 17 00:00:00 2001 From: kike-garbo Date: Fri, 19 May 2023 22:24:45 +0200 Subject: [PATCH 2/2] Added `Types.AreaScheme` types. --- .../Topology/QuerySpatialElements.cs | 9 +- .../Parameters/BasePoint.cs | 3 +- .../Parameters/Topology/AreaElement.cs | 43 +++++++ .../Parameters/Topology/AreaScheme.cs | 23 ++++ .../Parameters/Topology/RoomElement.cs | 46 ++++++++ .../Parameters/Topology/SpaceElement.cs | 46 ++++++++ .../Parameters/Topology/SpatialElement.cs | 107 ------------------ .../RhinoInside.Revit.GH.csproj | 8 ++ .../Types/Element.Activator.cs | 1 + .../Types/Topology/AreaElement.cs | 46 ++++++++ .../Types/Topology/AreaScheme.cs | 17 +++ .../Types/Topology/RoomlElement.cs | 36 ++++++ .../Types/Topology/SpacelElement.cs | 36 ++++++ .../Types/Topology/SpatialElement.cs | 93 --------------- 14 files changed, 309 insertions(+), 205 deletions(-) create mode 100644 src/RhinoInside.Revit.GH/Parameters/Topology/AreaElement.cs create mode 100644 src/RhinoInside.Revit.GH/Parameters/Topology/AreaScheme.cs create mode 100644 src/RhinoInside.Revit.GH/Parameters/Topology/RoomElement.cs create mode 100644 src/RhinoInside.Revit.GH/Parameters/Topology/SpaceElement.cs create mode 100644 src/RhinoInside.Revit.GH/Types/Topology/AreaElement.cs create mode 100644 src/RhinoInside.Revit.GH/Types/Topology/AreaScheme.cs create mode 100644 src/RhinoInside.Revit.GH/Types/Topology/RoomlElement.cs create mode 100644 src/RhinoInside.Revit.GH/Types/Topology/SpacelElement.cs diff --git a/src/RhinoInside.Revit.GH/Components/Topology/QuerySpatialElements.cs b/src/RhinoInside.Revit.GH/Components/Topology/QuerySpatialElements.cs index 3ed3123d7..843be97ae 100755 --- a/src/RhinoInside.Revit.GH/Components/Topology/QuerySpatialElements.cs +++ b/src/RhinoInside.Revit.GH/Components/Topology/QuerySpatialElements.cs @@ -201,13 +201,13 @@ public QueryAreas() : base ), new ParamDefinition ( - new Parameters.Element() + new Parameters.AreaScheme() { Name = "Area Scheme", NickName = "AS", Description = "Only areas on a specific Area Scheme.", Optional = true - }, ParamRelevance.Secondary + }, ParamRelevance.Primary ), new ParamDefinition ( @@ -340,7 +340,7 @@ public class QueryAreaSchemes : ElementCollectorComponent public override GH_Exposure Exposure => GH_Exposure.secondary; static readonly ARDB.ElementFilter elementFilter = CompoundElementFilter.ElementClassFilter(typeof(ARDB.AreaScheme)); - protected override ARDB.ElementFilter ElementFilter => CompoundElementFilter.ElementClassFilter(typeof(ARDB.AreaScheme)); + protected override ARDB.ElementFilter ElementFilter => elementFilter; public QueryAreaSchemes() : base ( @@ -392,11 +392,12 @@ public QueryAreaSchemes() : base { new ParamDefinition ( - new Parameters.Element() + new Parameters.AreaScheme() { Name = "Area Schemes", NickName = "AS", Description = "Area Schemes list", + Access = GH_ParamAccess.list } ) }; diff --git a/src/RhinoInside.Revit.GH/Parameters/BasePoint.cs b/src/RhinoInside.Revit.GH/Parameters/BasePoint.cs index 157ee7b73..4a2a70799 100644 --- a/src/RhinoInside.Revit.GH/Parameters/BasePoint.cs +++ b/src/RhinoInside.Revit.GH/Parameters/BasePoint.cs @@ -3,11 +3,12 @@ using System.Windows.Forms; using Grasshopper.GUI; using Grasshopper.Kernel; -using RhinoInside.Revit.External.DB.Extensions; using ARDB = Autodesk.Revit.DB; namespace RhinoInside.Revit.GH.Parameters { + using External.DB.Extensions; + public class BasePoint : GraphicalElement { public override GH_Exposure Exposure => GH_Exposure.senary | GH_Exposure.obscure; diff --git a/src/RhinoInside.Revit.GH/Parameters/Topology/AreaElement.cs b/src/RhinoInside.Revit.GH/Parameters/Topology/AreaElement.cs new file mode 100644 index 000000000..92573dcad --- /dev/null +++ b/src/RhinoInside.Revit.GH/Parameters/Topology/AreaElement.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using Grasshopper.Kernel; +using ARDB = Autodesk.Revit.DB; +using ARUI = Autodesk.Revit.UI; + +namespace RhinoInside.Revit.GH.Parameters +{ + [ComponentVersion(introduced: "1.7")] + public class AreaElement : GraphicalElement + { + public override GH_Exposure Exposure => GH_Exposure.quinary | GH_Exposure.obscure; + public override Guid ComponentGuid => new Guid("66AAAE96-BA85-4DC7-A188-AC213FAD3176"); + + public AreaElement() : base + ( + name: "Area", + nickname: "Area", + description: "Contains a collection of Revit area elements", + category: "Params", + subcategory: "Revit Elements" + ) + { } + + #region UI + protected override IEnumerable ConvertsTo => base.ConvertsTo.Append("Surface"); + + protected override void Menu_AppendPromptNew(ToolStripDropDown menu) + { + var AreaId = ARUI.RevitCommandId.LookupPostableCommandId(ARUI.PostableCommand.Area); + Menu_AppendItem + ( + menu, $"Set new {TypeName}", + Menu_PromptNew(AreaId), + Revit.ActiveUIApplication.CanPostCommand(AreaId), + false + ); + } + #endregion + } +} diff --git a/src/RhinoInside.Revit.GH/Parameters/Topology/AreaScheme.cs b/src/RhinoInside.Revit.GH/Parameters/Topology/AreaScheme.cs new file mode 100644 index 000000000..4839dbbbc --- /dev/null +++ b/src/RhinoInside.Revit.GH/Parameters/Topology/AreaScheme.cs @@ -0,0 +1,23 @@ +using System; +using Grasshopper.Kernel; +using ARDB = Autodesk.Revit.DB; + +namespace RhinoInside.Revit.GH.Parameters +{ + [ComponentVersion(introduced: "1.14")] + public class AreaScheme : Element + { + public override GH_Exposure Exposure => GH_Exposure.quinary | GH_Exposure.obscure; + public override Guid ComponentGuid => new Guid("B042539F-21FB-4BB3-BCA8-F93708CD140E"); + + public AreaScheme() : base + ( + name: "Area Scheme", + nickname: "A-Scheme", + description: "Contains a collection of Revit area scheme elements", + category: "Params", + subcategory: "Revit Elements" + ) + { } + } +} diff --git a/src/RhinoInside.Revit.GH/Parameters/Topology/RoomElement.cs b/src/RhinoInside.Revit.GH/Parameters/Topology/RoomElement.cs new file mode 100644 index 000000000..407cd39ec --- /dev/null +++ b/src/RhinoInside.Revit.GH/Parameters/Topology/RoomElement.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using Grasshopper.Kernel; +using ARDB = Autodesk.Revit.DB; +using ARUI = Autodesk.Revit.UI; + +namespace RhinoInside.Revit.GH.Parameters +{ + [ComponentVersion(introduced: "1.7")] + public class RoomElement : GraphicalElement + { + public override GH_Exposure Exposure => GH_Exposure.quinary | GH_Exposure.obscure; + public override Guid ComponentGuid => new Guid("1E6825B6-4A7A-44EA-BC70-A9A110963E17"); + + public RoomElement() : base + ( + name: "Room", + nickname: "Room", + description: "Contains a collection of Revit room elements", + category: "Params", + subcategory: "Revit Elements" + ) + { } + + #region UI + protected override IEnumerable ConvertsTo => base.ConvertsTo.Concat + ( + new string[] { "Surface", "Brep" } + ); + + protected override void Menu_AppendPromptNew(ToolStripDropDown menu) + { + var RoomId = ARUI.RevitCommandId.LookupPostableCommandId(ARUI.PostableCommand.Room); + Menu_AppendItem + ( + menu, $"Set new {TypeName}", + Menu_PromptNew(RoomId), + Revit.ActiveUIApplication.CanPostCommand(RoomId), + false + ); + } + #endregion + } +} diff --git a/src/RhinoInside.Revit.GH/Parameters/Topology/SpaceElement.cs b/src/RhinoInside.Revit.GH/Parameters/Topology/SpaceElement.cs new file mode 100644 index 000000000..38ee2d009 --- /dev/null +++ b/src/RhinoInside.Revit.GH/Parameters/Topology/SpaceElement.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using Grasshopper.Kernel; +using ARDB = Autodesk.Revit.DB; +using ARUI = Autodesk.Revit.UI; + +namespace RhinoInside.Revit.GH.Parameters +{ + [ComponentVersion(introduced: "1.7")] + public class SpaceElement : GraphicalElement + { + public override GH_Exposure Exposure => GH_Exposure.quinary | GH_Exposure.obscure; + public override Guid ComponentGuid => new Guid("30473B1D-6226-45CE-90A7-5F8E1E1DCBE3"); + + public SpaceElement() : base + ( + name: "Space", + nickname: "Space", + description: "Contains a collection of Revit space elements", + category: "Params", + subcategory: "Revit Elements" + ) + { } + + #region UI + protected override IEnumerable ConvertsTo => base.ConvertsTo.Concat + ( + new string[] { "Surface", "Brep" } + ); + + protected override void Menu_AppendPromptNew(ToolStripDropDown menu) + { + var SpaceId = ARUI.RevitCommandId.LookupPostableCommandId(ARUI.PostableCommand.Space); + Menu_AppendItem + ( + menu, $"Set new {TypeName}", + Menu_PromptNew(SpaceId), + Revit.ActiveUIApplication.CanPostCommand(SpaceId), + false + ); + } + #endregion + } +} diff --git a/src/RhinoInside.Revit.GH/Parameters/Topology/SpatialElement.cs b/src/RhinoInside.Revit.GH/Parameters/Topology/SpatialElement.cs index 4b2979b81..4fbdb3bba 100755 --- a/src/RhinoInside.Revit.GH/Parameters/Topology/SpatialElement.cs +++ b/src/RhinoInside.Revit.GH/Parameters/Topology/SpatialElement.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Windows.Forms; using Grasshopper.Kernel; using ARDB = Autodesk.Revit.DB; -using ARUI = Autodesk.Revit.UI; namespace RhinoInside.Revit.GH.Parameters { @@ -31,109 +29,4 @@ public SpatialElement() : base ); #endregion } - - [ComponentVersion(introduced: "1.7")] - public class AreaElement : GraphicalElement - { - public override GH_Exposure Exposure => GH_Exposure.quinary | GH_Exposure.obscure; - public override Guid ComponentGuid => new Guid("66AAAE96-BA85-4DC7-A188-AC213FAD3176"); - - public AreaElement() : base - ( - name: "Area", - nickname: "Area", - description: "Contains a collection of Revit area elements", - category: "Params", - subcategory: "Revit Elements" - ) - { } - - #region UI - protected override IEnumerable ConvertsTo => base.ConvertsTo.Append("Surface"); - - protected override void Menu_AppendPromptNew(ToolStripDropDown menu) - { - var AreaId = ARUI.RevitCommandId.LookupPostableCommandId(ARUI.PostableCommand.Area); - Menu_AppendItem - ( - menu, $"Set new {TypeName}", - Menu_PromptNew(AreaId), - Revit.ActiveUIApplication.CanPostCommand(AreaId), - false - ); - } - #endregion - } - - [ComponentVersion(introduced: "1.7")] - public class RoomElement : GraphicalElement - { - public override GH_Exposure Exposure => GH_Exposure.quinary | GH_Exposure.obscure; - public override Guid ComponentGuid => new Guid("1E6825B6-4A7A-44EA-BC70-A9A110963E17"); - - public RoomElement() : base - ( - name: "Room", - nickname: "Room", - description: "Contains a collection of Revit room elements", - category: "Params", - subcategory: "Revit Elements" - ) - { } - - #region UI - protected override IEnumerable ConvertsTo => base.ConvertsTo.Concat - ( - new string[] { "Surface", "Brep" } - ); - - protected override void Menu_AppendPromptNew(ToolStripDropDown menu) - { - var RoomId = ARUI.RevitCommandId.LookupPostableCommandId(ARUI.PostableCommand.Room); - Menu_AppendItem - ( - menu, $"Set new {TypeName}", - Menu_PromptNew(RoomId), - Revit.ActiveUIApplication.CanPostCommand(RoomId), - false - ); - } - #endregion - } - - [ComponentVersion(introduced: "1.7")] - public class SpaceElement : GraphicalElement - { - public override GH_Exposure Exposure => GH_Exposure.quinary | GH_Exposure.obscure; - public override Guid ComponentGuid => new Guid("30473B1D-6226-45CE-90A7-5F8E1E1DCBE3"); - - public SpaceElement() : base - ( - name: "Space", - nickname: "Space", - description: "Contains a collection of Revit space elements", - category: "Params", - subcategory: "Revit Elements" - ) - { } - - #region UI - protected override IEnumerable ConvertsTo => base.ConvertsTo.Concat - ( - new string[] { "Surface", "Brep" } - ); - - protected override void Menu_AppendPromptNew(ToolStripDropDown menu) - { - var SpaceId = ARUI.RevitCommandId.LookupPostableCommandId(ARUI.PostableCommand.Space); - Menu_AppendItem - ( - menu, $"Set new {TypeName}", - Menu_PromptNew(SpaceId), - Revit.ActiveUIApplication.CanPostCommand(SpaceId), - false - ); - } - #endregion - } } diff --git a/src/RhinoInside.Revit.GH/RhinoInside.Revit.GH.csproj b/src/RhinoInside.Revit.GH/RhinoInside.Revit.GH.csproj index 88da0ed59..31a42b567 100644 --- a/src/RhinoInside.Revit.GH/RhinoInside.Revit.GH.csproj +++ b/src/RhinoInside.Revit.GH/RhinoInside.Revit.GH.csproj @@ -325,6 +325,10 @@ + + + + @@ -485,6 +489,10 @@ + + + + diff --git a/src/RhinoInside.Revit.GH/Types/Element.Activator.cs b/src/RhinoInside.Revit.GH/Types/Element.Activator.cs index f1f9f35ed..c6bc69358 100644 --- a/src/RhinoInside.Revit.GH/Types/Element.Activator.cs +++ b/src/RhinoInside.Revit.GH/Types/Element.Activator.cs @@ -329,6 +329,7 @@ public static Element FromReference(ARDB.Document doc, ARDB.Reference reference) { typeof(ARDB.SpatialElement), (element)=> new SpatialElement (element as ARDB.SpatialElement) }, { typeof(ARDB.Area), (element)=> new AreaElement (element as ARDB.Area) }, + { typeof(ARDB.AreaScheme), (element)=> new AreaScheme (element as ARDB.AreaScheme) }, { typeof(ARDB.Architecture.Room), (element)=> new RoomElement (element as ARDB.Architecture.Room) }, { typeof(ARDB.Mechanical.Space), (element)=> new SpaceElement (element as ARDB.Mechanical.Space) }, diff --git a/src/RhinoInside.Revit.GH/Types/Topology/AreaElement.cs b/src/RhinoInside.Revit.GH/Types/Topology/AreaElement.cs new file mode 100644 index 000000000..a2a1253f3 --- /dev/null +++ b/src/RhinoInside.Revit.GH/Types/Topology/AreaElement.cs @@ -0,0 +1,46 @@ +using System; +using Grasshopper.Kernel; +using Rhino.Geometry; +using ARDB = Autodesk.Revit.DB; + +namespace RhinoInside.Revit.GH.Types +{ + [Kernel.Attributes.Name("Area")] + public class AreaElement : SpatialElement + { + protected override Type ValueType => typeof(ARDB.Area); + public new ARDB.Area Value => base.Value as ARDB.Area; + + public AreaElement() { } + public AreaElement(ARDB.Area element) : base(element) { } + + public override BoundingBox GetBoundingBox(Transform xform) + { + if (IsPlaced && IsEnclosed) + { + if (Boundaries is Curve[] boundaries) + { + var bbox = BoundingBox.Empty; + foreach (var boundary in boundaries) + bbox.Union(boundary.GetBoundingBox(xform)); + + return bbox; + } + } + + return NaN.BoundingBox; + } + + protected override void DrawViewportWires(GH_PreviewWireArgs args) + { + if (IsPlaced && IsEnclosed) + { + if (Boundaries is Curve[] boundaries) + foreach (var bopundary in boundaries) + args.Pipeline.DrawCurve(bopundary, args.Color, args.Thickness); + } + } + + protected override void DrawViewportMeshes(GH_PreviewMeshArgs args) { } + } +} diff --git a/src/RhinoInside.Revit.GH/Types/Topology/AreaScheme.cs b/src/RhinoInside.Revit.GH/Types/Topology/AreaScheme.cs new file mode 100644 index 000000000..15e05d7ff --- /dev/null +++ b/src/RhinoInside.Revit.GH/Types/Topology/AreaScheme.cs @@ -0,0 +1,17 @@ +using System; +using Grasshopper.Kernel; +using Rhino.Geometry; +using ARDB = Autodesk.Revit.DB; + +namespace RhinoInside.Revit.GH.Types +{ + [Kernel.Attributes.Name("Area Scheme")] + public class AreaScheme : Element + { + protected override Type ValueType => typeof(ARDB.AreaScheme); + public new ARDB.AreaScheme Value => base.Value as ARDB.AreaScheme; + + public AreaScheme() { } + public AreaScheme(ARDB.AreaScheme element) : base(element) { } + } +} diff --git a/src/RhinoInside.Revit.GH/Types/Topology/RoomlElement.cs b/src/RhinoInside.Revit.GH/Types/Topology/RoomlElement.cs new file mode 100644 index 000000000..19be30dc0 --- /dev/null +++ b/src/RhinoInside.Revit.GH/Types/Topology/RoomlElement.cs @@ -0,0 +1,36 @@ +using System; +using System.Linq; +using Rhino; +using Rhino.Geometry; +using ARDB = Autodesk.Revit.DB; + +namespace RhinoInside.Revit.GH.Types +{ + using Convert.Geometry; + + [Kernel.Attributes.Name("Room")] + public class RoomElement : SpatialElement + { + protected override Type ValueType => typeof(ARDB.Architecture.Room); + public new ARDB.Architecture.Room Value => base.Value as ARDB.Architecture.Room; + + public RoomElement() { } + public RoomElement(ARDB.Architecture.Room element) : base(element) { } + + #region Location + public override Brep PolySurface + { + get + { + if (Value is ARDB.Architecture.Room room) + { + var solids = room.ClosedShell.OfType().Where(x => x.Faces.Size > 0); + return Brep.MergeBreps(solids.Select(x => x.ToBrep()), RhinoMath.UnsetValue); + } + + return null; + } + } + #endregion + } +} diff --git a/src/RhinoInside.Revit.GH/Types/Topology/SpacelElement.cs b/src/RhinoInside.Revit.GH/Types/Topology/SpacelElement.cs new file mode 100644 index 000000000..bf74f40c0 --- /dev/null +++ b/src/RhinoInside.Revit.GH/Types/Topology/SpacelElement.cs @@ -0,0 +1,36 @@ +using System; +using System.Linq; +using Rhino; +using Rhino.Geometry; +using ARDB = Autodesk.Revit.DB; + +namespace RhinoInside.Revit.GH.Types +{ + using Convert.Geometry; + + [Kernel.Attributes.Name("Space")] + public class SpaceElement : SpatialElement + { + protected override Type ValueType => typeof(ARDB.Mechanical.Space); + public new ARDB.Mechanical.Space Value => base.Value as ARDB.Mechanical.Space; + + public SpaceElement() { } + public SpaceElement(ARDB.Mechanical.Space element) : base(element) { } + + #region Location + public override Brep PolySurface + { + get + { + if (Value is ARDB.Mechanical.Space space) + { + var solids = space.ClosedShell.OfType().Where(x => x.Faces.Size > 0); + return Brep.MergeBreps(solids.Select(x => x.ToBrep()), RhinoMath.UnsetValue); + } + + return null; + } + } + #endregion + } +} diff --git a/src/RhinoInside.Revit.GH/Types/Topology/SpatialElement.cs b/src/RhinoInside.Revit.GH/Types/Topology/SpatialElement.cs index e46d48624..4fe17a95b 100755 --- a/src/RhinoInside.Revit.GH/Types/Topology/SpatialElement.cs +++ b/src/RhinoInside.Revit.GH/Types/Topology/SpatialElement.cs @@ -1,8 +1,6 @@ using System; using System.Linq; -using Rhino; using Rhino.Geometry; -using Grasshopper.Kernel; using ARDB = Autodesk.Revit.DB; namespace RhinoInside.Revit.GH.Types @@ -162,95 +160,4 @@ public double? Volume } #endregion } - - [Kernel.Attributes.Name("Area")] - public class AreaElement : SpatialElement - { - protected override Type ValueType => typeof(ARDB.Area); - public new ARDB.Area Value => base.Value as ARDB.Area; - - public AreaElement() { } - public AreaElement(ARDB.Area element) : base(element) { } - - public override BoundingBox GetBoundingBox(Transform xform) - { - if (IsPlaced && IsEnclosed) - { - if (Boundaries is Curve[] boundaries) - { - var bbox = BoundingBox.Empty; - foreach (var boundary in boundaries) - bbox.Union(boundary.GetBoundingBox(xform)); - - return bbox; - } - } - - return NaN.BoundingBox; - } - - protected override void DrawViewportWires(GH_PreviewWireArgs args) - { - if (IsPlaced && IsEnclosed) - { - if (Boundaries is Curve[] boundaries) - foreach (var bopundary in boundaries) - args.Pipeline.DrawCurve(bopundary, args.Color, args.Thickness); - } - } - - protected override void DrawViewportMeshes(GH_PreviewMeshArgs args) { } - } - - [Kernel.Attributes.Name("Room")] - public class RoomElement : SpatialElement - { - protected override Type ValueType => typeof(ARDB.Architecture.Room); - public new ARDB.Architecture.Room Value => base.Value as ARDB.Architecture.Room; - - public RoomElement() { } - public RoomElement(ARDB.Architecture.Room element) : base(element) { } - - #region Location - public override Brep PolySurface - { - get - { - if (Value is ARDB.Architecture.Room room) - { - var solids = room.ClosedShell.OfType().Where(x => x.Faces.Size > 0); - return Brep.MergeBreps(solids.Select(x => x.ToBrep()), RhinoMath.UnsetValue); - } - - return null; - } - } - #endregion - } - - [Kernel.Attributes.Name("Space")] - public class SpaceElement : SpatialElement - { - protected override Type ValueType => typeof(ARDB.Mechanical.Space); - public new ARDB.Mechanical.Space Value => base.Value as ARDB.Mechanical.Space; - - public SpaceElement() { } - public SpaceElement(ARDB.Mechanical.Space element) : base(element) { } - - #region Location - public override Brep PolySurface - { - get - { - if (Value is ARDB.Mechanical.Space space) - { - var solids = space.ClosedShell.OfType().Where(x => x.Faces.Size > 0); - return Brep.MergeBreps(solids.Select(x => x.ToBrep()), RhinoMath.UnsetValue); - } - - return null; - } - } - #endregion - } }