Skip to content

Commit 39f5257

Browse files
Merge pull request #409 from specklesystems/bjorn/cnx-2722-grasshopper-root-collection-props
feat(grasshopper): add model-wide properties to send/receive
2 parents 0e98e1c + 2ea6348 commit 39f5257

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

src/Speckle.Objects/Interfaces.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Speckle.Objects.Other;
33
using Speckle.Objects.Primitive;
44
using Speckle.Sdk.Models;
5+
using Speckle.Sdk.Models.Data;
56

67
namespace Speckle.Objects;
78

@@ -110,15 +111,7 @@ public interface IDisplayValue<out T> : ISpeckleObject
110111

111112
#region Data objects
112113

113-
/// <summary>
114-
/// Specifies properties on objects to be used for data-based workflows
115-
/// </summary>
116-
public interface IProperties : ISpeckleObject
117-
{
118-
Dictionary<string, object?> properties { get; }
119-
}
120-
121-
public interface IDataObject : IProperties, IDisplayValue<IReadOnlyList<Base>>
114+
public interface IDataObject : IProperties, IDisplayValue<IReadOnlyList<Base>>, ISpeckleObject
122115
{
123116
/// <summary>
124117
/// The name of the object, primarily used to decorate the object for consumption in frontend and other apps
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Speckle.Sdk.Models.Data;
2+
3+
namespace Speckle.Sdk.Models.Collections;
4+
5+
/// <summary>
6+
/// Root collection that represents the top-level commit object.
7+
/// Extends Collection to include model-wide properties that apply to the entire model.
8+
/// </summary>
9+
[SpeckleType("Speckle.Core.Models.Collections.RootCollection")]
10+
public class RootCollection : Collection, IProperties
11+
{
12+
public RootCollection() { }
13+
14+
public RootCollection(string name)
15+
: base(name) { }
16+
17+
/// <summary>
18+
/// Model-wide properties that apply to the entire model.
19+
/// </summary>
20+
public Dictionary<string, object?> properties { get; set; } = new();
21+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Speckle.Sdk.Models.Data;
2+
3+
/// <summary>
4+
/// Specifies properties on objects to be used for data-based workflows.
5+
/// Can be applied to both objects and collections.
6+
/// </summary>
7+
public interface IProperties
8+
{
9+
Dictionary<string, object?> properties { get; }
10+
}

0 commit comments

Comments
 (0)