Jump to content

STL Working example? This isn't working for me


burhop
 Share

Recommended Posts

I'm not able to get an STL file to load due to an exception being thrown in Babylon.js.  I'm using the chrome  --allow-file-access-from-files and get the following error:

 

BJS - [07:57:52]: Babylon.js engine (v2.5-alpha) launched
babylon.js:formatted:3442GET file:///D:/Development/GCODE/GCODE/mark.stl.manifest?1471003072872 net::ERR_FILE_NOT_FOUNDt.checkManifestFile @ babylon.js:formatted:3442t @ babylon.js:formatted:3402t.Append @ babylon.js:formatted:19735t.Load @ babylon.js:formatted:19698(anonymous function) @ small.html:40
babylon.js:formatted:3437GET file:///D:/Development/GCODE/GCODE/mark.stl.manifest net::ERR_FILE_NOT_FOUND(anonymous function) @ babylon.js:formatted:3437
babylon.js:formatted:4396Uncaught Error: Error status: 0 - Unable to load mark.stle.onreadystatechange @ babylon.js:formatted:4396

 

The section of babylon.js code where I hit the exception is below (see  the part about not having the a function:

        t.LoadFile = function(i, r, n, o, s, a) {
            i = t.CleanUrl(i);
            var h = function() {
                var e = new XMLHttpRequest
                  , o = t.BaseUrl + i;
                e.open("GET", o, !0),
                s && (e.responseType = "arraybuffer"),
                e.onprogress = n,
                e.onreadystatechange = function() {
                    if (4 === e.readyState)
                        if (e.onreadystatechange = null ,
                        e.status >= 200 && e.status < 300 || navigator.isCocoonJS && 0 === e.status)
                            r(s ? e.response : e.responseText);
                        else {
                            if (!a)
                                throw new Error("Error status: " + e.status + " - Unable to load " + o);
                            a()
                        }
                }
                ,
 

 

Here's my simple html based on the 

 

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
    <title>STL Viewer</title>
    <script type="text/javascript" src="babylon.js"></script>
    <script type="text/javascript" src="babylon.stlFileLoader.js"></script>">
    <style>
        html, body {
            overflow: hidden;
            width   : 100%;
            height  : 100%;
            margin  : 0;
            padding : 0;
        }

        #renderCanvas {
            width   : 100%;
            height  : 100%;
            touch-action: none;
        }
    </style>


</head>
<body>
    <canvas id="renderCanvas"></canvas>
    <script>
        var canvas = document.getElementById('renderCanvas');

        // load the 3D engine
        var engine = new BABYLON.Engine(canvas, true);


        BABYLON.SceneLoader.Load("", "mark.stl", engine, function (newScene) {
            newScene.activeCamera.attachControl(canvas, false);
            engine.runRenderLoop(function () {
                newScene.render();
            });
        });
    </script>
</body>
</html>

 

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...