Open tjasa-karas opened 10 months ago
Hi, sorry for the late response, you have to wait the model to load before calc its volume, please use "ready_callback" option, like this:
var stl_viewer=new StlViewer
(
document.getElementById("stl_cont"),
all_loaded_callback:loaded_callback
);
stl_viewer.add_model({id:0, filename:"mystl.stl"});
function loaded_callback()
{
alert( JSON.stringify(stl_viewer.get_model_info(0)) );
}
BTW. you don't need to load all of the libs above, only stl_viewer.min.js
Hello thank you so much! I figured it out after a day so its okej :)
I tried to access the volume setting through another domain called Bubble.io. i uploaded a file on that domain and tried to calculate its volume but when i run the code, i get an error saying that the web worker couldnt be constructed. Do you maybe know how to fix this issue?
please post the log here (with Chrome do ctrl+shift+j)
THE ERROR:
run_debug.js:662 Element Volumecalculator(testing) A - The plugin STL parser (testing) / element Volume calculator (testing) threw the following error: Error: Failed to construct 'Worker': Script at 'https://9eaebe63011526167540ff8dae4c76e7.cdn.bubble.io/f1701339509235x335094444249260300/load_stl.min.js' cannot be accessed from origin 'https://api-testing-81257.bubbleapps.io'.
at StlViewer.load_from_stl_file (https://9eaebe63011526167540ff8dae4c76e7.cdn.bubble.io/f1701339509235x335094444249260300/stl_viewer.min.js:2:4288)
at StlViewer.load_model (https://9eaebe63011526167540ff8dae4c76e7.cdn.bubble.io/f1701339509235x335094444249260300/stl_viewer.min.js:2:3795) (please check your plugin's code)
THE PLUGIN CODE:
<script src="//meta-q.cdn.bubble.io/---noworker.js"></script>
<script src="//meta-q.cdn.bubble.io/---/stl_viewer.min.js"></script>
<script src="//meta-q.cdn.bubble.io/--/three.min.js"></script>
<script src="//meta-q.cdn.bubble.io/--/OrbitControls.js"></script>
<div id="stl_cont" style="width:1350px;height:800px;margin:0 auto;background-color:#909090;"></div>
function(instance, context) {
function stl_loaded()
{
console.log(stl_viewer.get_model_info(0));
console.log(stl_viewer.get_vsj());
}
var stl_viewer=new StlViewer
(
document.getElementById("stl_cont")
,
{
model_loaded_callback:stl_loaded,
models:
[
{id:0, filename:"//meta-q.cdn.bubble.io/---/06_elsa_right_hand.stl"},
]
}
);
}
It can't load some js files for some reason, try to load them manually: three.min.js stl_viewer.min.js parser.min.js load_stl.min.js webgl_detector.js CanvasRenderer.js OrbitControls.js TrackballControls.js Projector.js
and set "load_three_files:false" at the init options
Hello, i have noticed that the get_info function returns a null value. i believe that there is a problem with one of the libraries. this is the code i've used to try and acess the volume and other info using the get_model_info() method.
<!DOCTYPE html>