Exporter Errors - Collada and STL

I copied most of the code in Three.js export-examples. It looks like this now:

        function exportGLTF(input){
			exporter = new GLTFExporter();
			var options = {
				trs: true,
				onlyVisible: true,
				truncateDrawRange: true,
				binary: false,
				//animations: ,
				forceIndices: false,
				forcePowerOfTwoTextures: false,
				maxTextureSize: Infinity
			exporter.parse( input, function ( result ) {
				if ( result instanceof ArrayBuffer ) {
					saveArrayBuffer( result, 'scene.glb' );
				} else {
					var output = JSON.stringify( result, null, 2 );
					console.log( output );
					saveString( output, 'scene.gltf' );
			}, options );

		function exportSTLAscii(input) {
			exporter = new STLExporter();
			var result = exporter.parse(input);
			saveString( result, 'scene.stl' );

		function exportCollada(input) {
			exporter = new ColladaExporter();
			var result = exporter.parse(input);
			saveString( result.data, 'scene.dae' );

			/* result.textures.forEach( tex => {
				saveArrayBuffer( tex.data, `${ tex.name }.${ tex.ext }` );
			} ); */

The “input” variable of all three functions is an array, which contains all objects, i want to export.

If i want to export my imported gltf object, the gltf exporter works, the stl exporter prints out this error : “Object doesnt support property or method ‘traverse’” (STLExporter.js (42,3)) and the Collada exporter prints out this error: "Object doesnt support property or method updateMatrix (ColladaExporter.js 196,3). Can somebody help me?
Also i am not sure if i have to use or delete the last code in the collada-function (which is at the moment a comment).

Please demonstrate the issue with a live example or a git repository. It’s not possible to see from your code snippet what’s going wrong.

hello @Mugen87
Here webgl_loader_gltf_extensions.html (13.3 KB) i uploaded an edited Three.js - example
In line 150 you can switch between stl and collada exporter.
Same errors in console for this example as for my program.
Can you help me?

1 Like

STLExporter expects a single instance of Objetc3D like Scene as an input. Same for ColladaExporter. You are passing an array of 3D objects which is not supported.

Thank you… Somehow i didn’t see that. In gltf it is possible so i was a bit confused.
Thank you!!

1 Like

Indeed. It would be more user-friendly if all exporters would have the same public interface.

1 Like