30 lines
818 B
C#
30 lines
818 B
C#
using Objects;
|
|
using Objects.Geometry;
|
|
using Speckle.Automate.Sdk;
|
|
using Speckle.Core.Logging;
|
|
using Speckle.Core.Models.Extensions;
|
|
|
|
static class AutomateFunction
|
|
{
|
|
public static async Task Run(
|
|
AutomationContext automationContext,
|
|
FunctionInputs functionInputs
|
|
)
|
|
{
|
|
Console.WriteLine("Starting execution");
|
|
_ = typeof(ObjectsKit).Assembly; // INFO: Force objects kit to initialize
|
|
|
|
Console.WriteLine("Receiving version");
|
|
var commitObject = await automationContext.ReceiveVersion();
|
|
|
|
Console.WriteLine("Received version: " + commitObject);
|
|
|
|
var count = commitObject
|
|
.Flatten()
|
|
.Count(b => b.speckle_type == functionInputs.SpeckleTypeToCount);
|
|
|
|
Console.WriteLine($"Counted {count} objects");
|
|
automationContext.MarkRunSuccess($"Counted {count} objects");
|
|
}
|
|
}
|