I am trying to create a speckle sender and receiver that can sync Revit data to a Unity environment. How and which files should I edit in the git code to achieve this goal?
Right now, I can achieve an auto save in Revit by using a plugin and have it upload to the speckle server. However, as I am fairly new at coding, I don’t know how to detect an update in the model, and receive it in Unity automatically…
If anyone in the community have any suggestions, I would be very grateful.
The best bit of the SDK for me to point you towards is subscriptions API.
Our Speckle.Core.API.Client class
//Start listening for new versions on a project
var subscription = client.Subscription.CreateProjectVersionsUpdatedSubscription()
//Add my event handlers to react to new Versions
subscription.Listeners += MyEventHandler;
//when you're done with the subscription (you can end it by disposing either the subscription or the client)
subscription.Dispose();
The above example is just a flavour for how the subscriptions work.
Hopefully its clear how you might use this to trigger a receive when a new version is created.
Worth noting that you should not need to modify the connector’s git source code, instead you could create your own C# component that uses the existing SpeckleReceiver component, or the static ReceiveAsync function if you’d rather bypass the commit (aka version) selection of the SpeckleReceiver
Please let me know which strategy you take, as I may be able to assist further.
I’ve understood how the subscription method works, and am planning on creating a C# component that uses the existing component. But as I am not well versed in C#, it may take some time learn the language and to code.