From bf146bc88a1bc62e02ff07f18cf26453c6ce88a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Jedlicska?= Date: Fri, 25 Aug 2023 16:03:06 +0200 Subject: [PATCH] update function example --- function.ipynb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/function.ipynb b/function.ipynb index fdea7fb..8d6fc14 100644 --- a/function.ipynb +++ b/function.ipynb @@ -60,9 +60,9 @@ }, "outputs": [], "source": [ - "speckle_project_data = \"\"\n", - "function_inputs = \"\"\n", - "token_env_var = \"\"" + "speckle_project_data = '{\"projectId\": \"03434ee1f1\", \"versionId\": \"09d2a0e55a\", \"modelId\": \"base design\", \"speckleServerUrl\": \"https://latest.speckle.dev\" }'\n", + "function_inputs = '{\"speckleType\": \"Objects.Geometry.Brep\"}'\n", + "token_env_var = \"SPECKLE_TOKEN\"" ] }, { @@ -153,7 +153,6 @@ " client = SpeckleClient(project_data.speckle_server_url)\n", " client.authenticate_with_token(speckle_token)\n", " commit = client.commit.get(project_data.project_id, project_data.version_id)\n", - " branch = client.branch.get(project_data.project_id, project_data.model_id, 1)\n", "\n", " memory_transport = MemoryTransport()\n", " server_transport = ServerTransport(project_data.project_id, client)\n", @@ -161,7 +160,8 @@ "\n", " matching_types = [\n", " b for b in flatten_base(base) if b.speckle_type == function_inputs.speckle_type\n", - " ]" + " ]\n", + " print(f\"Found {len(matching_types)} elements that have the speckle_type {function_inputs.speckle_type}\")" ] }, { @@ -178,7 +178,11 @@ " project_data = SpeckleProjectData.model_validate_json(speckle_project_data)\n", " speckle_token = os.environ[token_env_var]\n", " print(project_data)\n", - " print(inputs)" + " print(inputs)\n", + "\n", + " automate_function(project_data, inputs, speckle_token)\n", + " \n", + "main()" ] } ],