Hi! Looking for some help regarding Speckle Collections in C# (RhinoCommon + Grasshopper)
I am attempting to send some geometry to Speckle as nested Collections with 3 levels.
Collection: Level 1
├── elements
│ ├── Collection: Level 2
│ │ ├── elements
│ │ │ ├── Collection: Level 3
│ │ │ │ └── elements
│ │ │ │ ├── Brep1
│ │ │ │ ├── Brep2
│ │ │ │ └── Brep3
│ │ │ └── Collection: Level 3
│ │ │ └── elements
│ │ │ ├── Brep1
│ │ │ └── Brep2
│ └── Collection: Level 2
│ ├── elements
│ │ ├── Collection: Level 3
│ │ │ └── elements
│ │ │ ├── Brep 1
│ │ │ ├── Brep 2
│ │ │ └── Brep 3
│ │ └── Collection: Level 3
│ │ └── elements
│ │ ├── Brep 1
│ │ └── Brep 2
Sending works fine and the data is showing on the frontend in my model but the collection structure is not. Could there be something I am missing?
I have versions SpeckleCore2, Version=2.21.3.16520 and Speckle.Objects 2.21.3
To simply test sending Collections currently what I am doing is this (simplified for compactness):
//Setup converter
private readonly static ISpeckleConverter _converter = KitManager.GetDefaultKit().LoadConverter("Grasshopper8");
public SpeckleBridge()
{
// Set Converter context document
_converter.SetContextDocument(RhinoDoc.ActiveDoc);
}
// Set collection to root Base object for sending
Speckle.Core.Models.Base testSend = new();
if (_site != null)
{
testSend["Elements"] = converter.ElementsToSpeckle(_site);
}
// Method converts elements and returns the collection
public Speckle.Core.Models.Collection ElementsToSpeckle(siteGeometry site)
{
// A Speckle Collection to contain all the site Elements to export
Speckle.Core.Models.Collection elementsCollection = new("Site Elements", "Elements")
{
applicationId = Guid.NewGuid().ToString()
};
// Converts the geometry to breps
....
//
Speckle.Core.Models.Collection elementCollection = new("ElementLayers", "Layers");
elementsCollection.elements.Add(elementCollection);
return elementsCollection;
}
And the Speckle.Core.Models.Base object is sent with the send node (sending works fine as mentioned above). Very grateful for any help!