Hi,
Thanks a lot for your explanation.
I just tried the .NET SDK and I am able to read objects and create new objects.
To understand Speckle I tried a couple of different things.
For example: I created an Base Object contains two lines:
var myBuilding = new Base();
myBuilding["name"] = "Test";
myBuilding["line1"] = new Line(new Point(0,0,0), new Point(10,10,10));
myBuilding["line2"] = new Line(new Point(0,0,0), new Point(0,0,10));
var commitId = Helpers.Send(streamId, myBuilding, "My commit message").Result;
As expected I can see the new commit with my two lines.
With the following code I read the referenceObject ID and afterwards the complete referenceObject
var branchName = "main";
var client = new Client(account);
var branch = await client.BranchGet(streamId, branchName, 1);
var objectId = branch.commits.items[0].referencedObject; //
var transport = new ServerTransport(account, streamId);
var data1 = await Operations.Receive(
objectId,
remoteTransport: transport
);
As you can see I am able to read the object.
I have the following guestions:
- Why is totalChidrenCount =0 not 3 (two lines and the name)?
- Why is the line1 one and line2 from Object Base, not from Line?
- If I try to read the line1 object I recive the following error:
[18:44:35 ERR] A deserialization error has occurred Cannot deserialize objectJson, value was null (Parameter 'objectJson')
System.ArgumentNullException: Cannot deserialize objectJson, value was null (Parameter 'objectJson')
at Speckle.Core.Serialisation.BaseObjectDeserializerV2.DeserializeTransportObject(String objectJson)
at Speckle.Core.Serialisation.BaseObjectDeserializerV2.Deserialize(String rootObjectJson)
at Speckle.Core.Api.Operations.DeserializeStringToBase(SerializerVersion serializerVersion, String objString, JsonSerializerSettings settings, BaseObjectDeserializerV2 serializerV2)
Unhandled exception. System.ArgumentNullException: Cannot deserialize objectJson, value was null (Parameter 'objectJson')
at Speckle.Core.Serialisation.BaseObjectDeserializerV2.DeserializeTransportObject(String objectJson)
at Speckle.Core.Serialisation.BaseObjectDeserializerV2.Deserialize(String rootObjectJson)
at Speckle.Core.Api.Operations.DeserializeStringToBase(SerializerVersion serializerVersion, String objString, JsonSerializerSettings settings, BaseObjectDeserializerV2 serializerV2)
at Speckle.Core.Api.Operations.Receive(String objectId, CancellationToken cancellationToken, ITransport remoteTransport, ITransport localTransport, Action`1 onProgressAction, Action`2 onErrorAction, Action`1 onTotalChildrenCountKnown, Boolean disposeTransports, SerializerVersion serializerVersion)
- In the Speckle backend I can see my two lines, but if I click on the “Open object in a new window I receive the 404 error
What did I miss?
Furthermore I would like to know how I can add a new property to an existing object.
In the documentation it is mentioned that objects are immutable. For example I would like to add one the line1 object the attribute name.
Is it enough to commit only the line1 object, or is it necessary to commit the whole object?
Thanks a lot
Ludi