In the below code I use viewstl(https://www.viewstl.com/plugin/). but when I create a model with an id and I try to get the model information, I get the error get_model_info - id not found: 0. However, when I look at the stl log, it says the id under the model. Does anyone have an idea why this is happening?
let file = document.createElement('div');
file.setAttribute('id', 'stl_preview');
figure.insertBefore(file, figCap)
let stl = new StlViewer(document.getElementById('stl_preview'), {
models: [{
id:1, filename: reader.result
}]
});
console.log(stl);
console.log(stl.get_model_info(0));
Or if anyone knows other stl viewers I can implement, I am open to suggestions.
Your id is 1 not 0, try this:
console.log(stl.get_model_info(1));