Hi there,
im trying to update one(!) single object in a speckle stream.
That means one, for example, one wall recieves a additional attribute which is send but its the only thing that should change from the commit before.
However the addition of data works fine, but If I update via the .NET API the model can’t be viewed again as the geometry seems vanished.
Here is my current code approach without the data adding as the problem stays even when no data is added:
Main-Method
public async Task CommitAdditionalData(string streamid, string id, AdditionalData data, string commitMessage)
{
try
{
var branch = await _speckleClient.BranchGet(streamid, "main", 1); // get branch
var objectId = branch.commits.items[0].referencedObject; // take last commit
var parent = await GetObjectAsync(streamid, objectId); // get parent object
//var updatedObject = UpdateObjectInStream(parent, id, "@AdditionalData", data); // update parent object
var status = await CommitObject(streamid, parent); // commit the object to speckle
}
catch (System.Exception ex)
{
throw;
}
}
public async Task<Base> GetObjectAsync(string streamId, string id)
{
try
{
var transport = new ServerTransport(_speckleClient.Account, streamId);
dynamic data = await Operations.Receive(
id,
remoteTransport: transport,
disposeTransports: false,
serializerVersion: SerializerVersion.V2
);
return data;
}
catch (System.Exception ex)
{
throw;
}
}
public async Task<bool> CommitObject(string streamId, Base obj, string commitMessage = "CommitScanData", string sourceApplication = "My Server")
{
var sendTransport = new ServerTransport(_speckleClient.Account, streamId);
try
{
string objectId = await Operations.Send(@obj, new List<ITransport>() { sendTransport }, false, serializerVersion: SerializerVersion.V2);
CommitCreateInput commitInput = new CommitCreateInput
{
branchName = "main",
message = commitMessage,
sourceApplication = sourceApplication,
streamId = streamId,
objectId = objectId,
totalChildrenCount = (int)obj.totalChildrenCount
};
await _speckleClient.CommitCreate(commitInput);
return true;
}
catch (Exception ex)
{
return false;
}
}
Anyone knows what im doing wrong? I read the docs and haven’t found anything useful for my problem.