Yes! Thanks. I am quite new to vue environment. So i might missed something. I am able to run the example above now. But still wondering why I get the error.
Also I came across the following error, trying to use my own Grasshopper ghx file.
Any ideas on this?
Difficult to tell from whatâs provided. Sorry I know thatâs not helpful.
One common reason you get the first error you posted is when the .wasm file doesnât make it to the same directory as your javascript files. Most wasm compilers will assume itâs there, because thatâs what they generate, and attempt to fetch
with just the file name. See snippet from what rhino3dm.js is shipping rn (comments by me):
var wasmBinaryFile = 'rhino3dm.wasm'; /* file name to search for */
if (!isDataURI(wasmBinaryFile)) {
wasmBinaryFile = locateFile(wasmBinaryFile);
}
/* ... */
function getBinaryPromise() {
if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && typeof fetch === 'function') {
return fetch(wasmBinaryFile, { credentials: 'same-origin' }).then(function(response) { /* where the fetch happens */
if (!response['ok']) {
throw "failed to load wasm binary file at '" + wasmBinaryFile + "'";
}
return response['arrayBuffer']();
}).catch(function () {
return getBinary();
});
}
return new Promise(function(resolve, reject) {
resolve(getBinary());
});
}
Thanks Chuck! any ideaâs on this one?
Hi all,
When I try my own GHX file, i get the following error:
So changing the Grasshopper script, inputs / outputs. Anyone seen this error?
Rick
We added some functionality to the JS Compute client library for evaluating grasshopper definitions. Take a look at this sampleâŚ
The evaluateDefiniton() function takes care of base64 encoding for you, so hopefully it will solve this problem!
Thanks Will! I got my script working from one of the codes above ( which now seems unavailable). Is there a Vue example using this functionality of JS compute?
Hi Luis,
Could you make this available again?
I am puzzling around, but getting error after error.
Rick
Hey, just a heads up that the code you provided last time wasnât actually using any rhino3dm. If you can point me to the code thatâs giving you some issues I can be a bit more helpful.
You are right. I donât know what happened haha. Attached the code. I managed to get this to work, but not use other Grasshopper scripts. Maybe my arrangement of the Vue is wrong? The app.js from extrusions above is quite different. (I tried using this piece of code, but couldnât get it to work).
Would be nice if someone can provide an example.
Hi all,
Almost able to run it, but now running into the WASM againâŚ
Please help
Rhino.zip (2.1 KB)Solved:
So I was able to solve it.
I firstly installed npm i --save compute-rhino3d and rhino3dm.
Then in those folders i found (nodemodules):
So i downloaded those and copied them in. This works.
Whatever youâre using to generate your output html/js/css (vue-cli uses webpack) must copy the .wasm file to the same folder as the javascript that calls it. I canât tell what youâre using from the screenshot/image provided.
Doesnât look like your issue is your logic, just how packages are pointing to each other. Without seeing the full setup, I canât troubleshoot that.