BABYLON.SceneLoader.Append('/assets/stl/', 'arm.stl', scene, function(scene) {
});
BJS - [02:26:40]: Unable to load from /assets/stl/arm.stl: importScene of undefined from undefined version: undefined, exporter version: undefinedimportScene has failed JSON parse
Hello did you make sure to reference the stl loader first?
https://doc.babylonjs.com/how_to/stl
@deltakosh yeah, i used angular js, and imported as following:
import * as BABYLON from 'babylonjs';
import * as BABYLON_LOADER from 'babylonjs-loaders';
export class TestComponent {
testMethod() {
// ... init scene
BABYLON.SceneLoader.Append('/assets/stl/', 'arm.stl', scene, function(scene) {
});
}
}
@deltakosh I fixed by modify the import: import 'babylonjs-loaders'; Thanks
@deltakosh I fixed by modify the import: import 'babylonjs-loaders'; Thanks
I tried with that import but I wasn't still able to load the .obj. It seems that webpack is doing something fancy behind. I solved with this quick workaround:
import { Engine, Scene, ArcRotateCamera, HemisphericLight, Vector3, Mesh, MeshBuilder, SceneLoader } from 'babylonjs';
import {OBJFileLoader} from 'babylonjs-loaders';
SceneLoader.RegisterPlugin(new OBJFileLoader())
Most helpful comment
I tried with that import but I wasn't still able to load the
.obj. It seems thatwebpackis doing something fancy behind. I solved with this quick workaround: