Jump to content

Importing .stls


focomoso
 Share

Recommended Posts

I'm trying to import an .stl file with the asset manager. The task seems to complete successfully, but there are no meshes in the loadedMeshes array so there's nothing to add to the scene. The same thing happens if I use the SceneLoader.Load (and I've tested this using a local .stl file served off a local web server rather than aws with the same result).

I suspect I'm just doing it wrong.

playground here: http://www.babylonjs-playground.com/#V4WNE7#9

Thanks for any help.

Link to comment
Share on other sites

Well, that would do it. I'll try an ascii (though it would be good if there were an error). If I were to write a binary stl importer, would it be better to integrate it into the existing stlFileLoader.js or create a binaryStlFileLoader.js?

Link to comment
Share on other sites

Unfortunately there's a catch-22 here.

The data being sent to the stlFileLoader has already been converted to a string (and lost significance) because loader itself has to register as .isBinary in order get useArrayBuffer to be true and therefore get binary data, but the choice of loader is based on file extension so there's no way for the loader to make the determination itself. 

The only workaround I can think of would be to have the stlFileLoader register as .isBinary and handle the conversion to a string itself (based on the content of the file). Does anyone think this might mess up other use cases?

 

James

Link to comment
Share on other sites

Okay - I have this working. Except...

When I export geometry from Blender for testing, the ascii output only seems to come in correctly if you use the setting Z forward Y up and the binary output only seems to work with Y forward and Z up. Are there any known issues with exporting stls from Blender (I'm no Blender expert)? 

Thanks for any help with this.

James

Link to comment
Share on other sites

I figured it out. Had to flip the order of the y and z vertices (and the normal).

Below is the blender monkey exported from blender with Y up and -Z forward. The one on the left is binary, the one on the right, ASCII.

Pull request created.

Screen Shot 2017-06-12 at 3.28.54 PM.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...