update to new speckle core dependencies

This commit is contained in:
Gergő Jedlicska
2023-08-10 13:46:53 +02:00
parent c48564c04f
commit 72ad134dc4
4 changed files with 23 additions and 23 deletions
+5 -10
View File
@@ -1,6 +1,7 @@
using Objects.Geometry;
using Speckle.Core.Api;
using Speckle.Core.Credentials;
using Speckle.Core.Models.GraphTraversal;
using Speckle.Core.Models.Extensions;
using Speckle.Core.Transports;
using SpeckleAutomateDotnetExample;
@@ -20,7 +21,8 @@ class AutomateFunction
var client = new Client(account);
// var kit = KitManager.GetDefaultKit();
// HACK needed for the objects kit to initialize
var p = new Point();
var commit = await client.CommitGet(
speckleProjectData.ProjectId,
@@ -34,13 +36,6 @@ class AutomateFunction
new MemoryTransport()
);
var traversalRule = TraversalRule
.NewTraversalRule()
.When(_ => true)
.ContinueTraversing(DefaultTraversal.ElementsAliases);
var gt = new GraphTraversal(traversalRule);
var ret = gt.Traverse(rootObject).Select(b => b.current).ToList();
return ret.Count( b => b.speckle_type == functionInputs.SpeckleTypeToCount);
return rootObject.Flatten().Count( b => b.speckle_type == functionInputs.SpeckleTypeToCount);
}
}
+9 -4
View File
@@ -2,7 +2,6 @@
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json.Schema.Generation;
using Newtonsoft.Json.Serialization;
using Objects.Geometry;
using Speckle.Newtonsoft.Json;
namespace SpeckleAutomateDotnetExample;
@@ -57,14 +56,20 @@ internal static class Program
string speckleToken
)
{
var p = new Point();
var speckleProjectData = JsonConvert.DeserializeObject<SpeckleProjectData>(
rawSpeckleProjectData
);
var functionInputs = JsonConvert.DeserializeObject<FunctionInputs>(
rawFunctionInputs
);
await AutomateFunction.Run(speckleProjectData, functionInputs, speckleToken);
var count = await AutomateFunction.Run(
speckleProjectData,
functionInputs,
speckleToken
);
Console.WriteLine(
$"Found {count} elements that have the type {functionInputs.SpeckleTypeToCount}"
);
}
static string GenerateFunctionInputSchema()
@@ -93,4 +98,4 @@ internal class SpeckleProjectData
public string ModelId;
public string VersionId;
public string SpeckleServerUrl;
}
}
+2 -2
View File
@@ -12,9 +12,9 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.15" />
<PackageReference Include="Speckle.Core" Version="2.15.2" />
<PackageReference Include="Speckle.Core" Version="2.15.3" />
<PackageReference Include="Speckle.Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Speckle.Objects" Version="2.15.2" />
<PackageReference Include="Speckle.Objects" Version="2.15.3" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</ItemGroup>
+7 -7
View File
@@ -13,9 +13,9 @@
},
"Speckle.Core": {
"type": "Direct",
"requested": "[2.15.2, )",
"resolved": "2.15.2",
"contentHash": "1cRak+/w5X2evkyMmWi0DTfgZ5PkwXFNR5XV8FSaWZUrV+Bnl8bQqaucLX8qj6YiEPj582tqoHUTBRa+8DD8cQ==",
"requested": "[2.15.3, )",
"resolved": "2.15.3",
"contentHash": "rL4g3mBgL2TYWw55wC9QqVe0mR1MUISfcuDhiDNfVoPiWMmvGD1UQ6PjU5MncQRvLXYow48KGrUMDl7nntlIAQ==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.CSharp": "4.7.0",
@@ -43,11 +43,11 @@
},
"Speckle.Objects": {
"type": "Direct",
"requested": "[2.15.2, )",
"resolved": "2.15.2",
"contentHash": "Qg92EAMK59rWILYa4heGBN34tNGU61wEPp8xLOlNo5800Pea7guXm+IeylGxe1Vfsy+/Rt5f3WdHIXG9VpXu2g==",
"requested": "[2.15.3, )",
"resolved": "2.15.3",
"contentHash": "oj822fIHKIzevwZRYYZXmed/RNhf/WUX1DtKIxNQyGAhsPrMg6veke2Z5RuY6N3NtzC8NSJz4AyKhu/ESjVh2w==",
"dependencies": {
"Speckle.Core": "2.15.2"
"Speckle.Core": "2.15.3"
}
},
"System.CommandLine": {