Hello Speckle Team!
I’m working on a tool which utilizes Speckle as the medium of data transfers. In this project we have two classes that inherit from Speckle’s Base class. For reference see below:
public class Class1: Base
{
public string Property1 { get; set; }
public string Property2 { get; set; }
public string Property3 { get; set; }
public Base Mesh { get; set; }
public List<Class2> ListOfChildrenObjects;
}
public class Class2: Base
{
public string Property1 { get; set; }
public string Property2 { get; set; }
public string Property3 { get; set; }
}
As of now, we use the above classes to transfer data from Unity to Revit and vice versa. Even though receiving the data using the Operations.Receive() method works fine, I have trouble sending a list of data back. In particular, when trying to add the list of objects of class 1 to a base object before sending, the list of class 2 children doesn’t convert and hence, when I receive it back and convert it to class 1 objects, the list of class 2 objects of every class 1 object is empty. I tried converting class 2 objects to Base objects before sending, using arrays instead of lists and converting the list of class 1 objects to a json format before sending, but to no avail. Is there something I am missing and what you would be a solution to the above problem? For reference, I attach my send method below:
public async void SendData()
{
var @base = new Base();
@base["objects"] = listOfClass1Objects;
var transport = new ServerTransport(CurrentAccount, CurrentStream.id);
string message = "Updated";
_ = await Helpers.Send(CurrentStream.id, @base, message);
}
Thanks in advance!