From 47c536d3b719d82f9404c8273df81fd9ddd1821d Mon Sep 17 00:00:00 2001 From: nagaokar <63868849+nagaokar@users.noreply.github.com> Date: Wed, 8 Sep 2021 14:27:40 +0100 Subject: [PATCH 1/2] Fix 'TypeError' when run locally In response to this issue: https://discourse.mcneel.com/t/problems-with-some-examples-for-rhino-compute-appserver/122311 --- src/examples/spikyThing/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples/spikyThing/script.js b/src/examples/spikyThing/script.js index 489a35c8..4d0829b9 100644 --- a/src/examples/spikyThing/script.js +++ b/src/examples/spikyThing/script.js @@ -73,7 +73,7 @@ async function compute(){ // hide spinner document.getElementById('loader').style.display = 'none' - let data = JSON.parse(responseJson.values[0].InnerTree['{ 0; }'][0].data) + let data = JSON.parse(responseJson.values[0].InnerTree['{0}'][0].data) let mesh = rhino.DracoCompression.decompressBase64String(data) t1 = performance.now() From 5ed2e305bdf4cb3d5d4b9d63427245be087b3c24 Mon Sep 17 00:00:00 2001 From: nagaokar <63868849+nagaokar@users.noreply.github.com> Date: Wed, 8 Sep 2021 14:42:52 +0100 Subject: [PATCH 2/2] Fix:Panels "Cannot read '0' at undefined compute'" In response to this issue, which still exists in the latest version as of(08/09/21). Same as a previous issue (spikyThing) https://discourse.mcneel.com/t/problems-with-some-examples-for-rhino-compute-appserver/122311 --- src/examples/panels/script.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/examples/panels/script.js b/src/examples/panels/script.js index 47eb1338..920e1b86 100644 --- a/src/examples/panels/script.js +++ b/src/examples/panels/script.js @@ -71,7 +71,7 @@ async function compute(){ document.getElementById('loader').style.display = 'none' // process mesh - let mesh_data = JSON.parse(responseJson.values[0].InnerTree['{ 0; }'][0].data) + let mesh_data = JSON.parse(responseJson.values[0].InnerTree['{0}'][0].data) let mesh = rhino.CommonObject.decode(mesh_data) if (!_threeMaterial) { @@ -82,11 +82,11 @@ async function compute(){ replaceCurrentMesh(threeMesh) //process data - let cluster_data = responseJson.values[1].InnerTree['{ 0; }'].map(d=>d.data) + let cluster_data = responseJson.values[1].InnerTree['{0}'].map(d=>d.data) console.log(cluster_data) //process colors - let color_data = responseJson.values[2].InnerTree['{ 0; }'].map( d=> { + let color_data = responseJson.values[2].InnerTree['{0}'].map( d=> { return 'rgb(' + JSON.parse(d.data) + ')'