bimvie.ws-viewer icon indicating copy to clipboard operation
bimvie.ws-viewer copied to clipboard

Boilerplate code for testing load of object/geometry binary streams

Open xeolabs opened this issue 9 years ago • 13 comments

Could you insert my Download component into where you think it would go within the index page? Just put it in place, and ensure that it's getting the model and a list of revision and object IDs to load. I can debug it from there.

Or alternatively, could you make a second index page that just loads some objects from a model, then feeds them into my Download component? The key things I need are the model, roids and oids, all fed into the Downloader.

Just make a stub function that takes all the parameters required by the Download component, then I'll implement the stub.

Here's a gist that shows how the Download component is used: https://gist.github.com/xeolabs/4c146797d1f772833865

And the Download component source code is here, for reference, with more usage patterns shown in the class comment: https://github.com/opensourceBIM/bimvie.ws-viewer/blob/master/src/viewer/loading/download.js

Note that the Download component batch-loads a list of objects (via socket), and is then bound to the objects it has created in the 3D view, so that when you destroy the Download, it destroys those objects in the 3D view. (That's just to get started really - I could instead have a singleton loader that can be told to load and destroy objects as they are shown/hidden in the tree view, but I guess I can get started with this one for now. I just want to get some IFC objects appearing in the viewer at this point, to debug the extraction of geometry/material from binary streams.

xeolabs avatar Aug 25 '15 11:08 xeolabs

https://github.com/opensourceBIM/bimvie.ws-viewer/commit/6643e93b4e0528295e3fbd3aef62e19532bc69e0

rubendel avatar Aug 25 '15 19:08 rubendel

Thanks Ruben, I've extracted that out into an example which you can run here and source code for the example is here.

(I'm maintaining this set of bare metal (ie. without Dojo) examples for easy reference.)

The example integrates my Download component, which you can see integrated in the example here.

However, when I run this example, using the server at http://thebimfederationserver.thebimfederation.com and Thomas' name and password, I get a JS exception ('firstUpper' is undefined):

(I'll need to get a name and password from you to use the http://thisisanexperimentalserver.com server you've provided, so in the meantime I'm using the one Thomas gave me.)

screenshot from 2015-08-26 15 34 23

I've concatenated the API into the bimviews.js binary is build, and the so the exception originates here.

xeolabs avatar Aug 26 '15 13:08 xeolabs

firstUpper is defined to be a method of String in String.js, I can't test the example as I don't have Thomas his credentials.

rubendel avatar Aug 26 '15 13:08 rubendel

Ah ok - maybe I'd better ensure String.js is integrated in the build then, I'll do that later tonight

On Wed, Aug 26, 2015 at 3:54 PM, Ruben de Laat [email protected] wrote:

firstUpper is defined to be a method of String in String.js, I can't test the example as I don't have Thomas his credentials.

— Reply to this email directly or view it on GitHub https://github.com/opensourceBIM/bimvie.ws-viewer/issues/3#issuecomment-135028053 .

Lindsay Kay http://xeolabs.com

xeolabs avatar Aug 26 '15 14:08 xeolabs

OK I've integrated string.js into the build, and now getting this error after loading the (empty) model:

screenshot from 2015-08-26 17 26 18

You should be OK to run it now..

xeolabs avatar Aug 26 '15 15:08 xeolabs

https://github.com/opensourceBIM/bimvie.ws-viewer/blob/master/index.html#L97 is being passed "null" as the second argument, you can replace it with something like this:

function Notifier() {
            var othis = this;

            this.setSelector = function(selector) {
            };

            this.clear = function() {
            };

            this.resetStatus = function(){
            };

            this.resetStatusQuick = function(){
            };

            this.setSuccess = function(status, timeToShow) {
                console.log("success", status);
            };

            this.setInfo = function(info, timeToShow) {
                console.log("info", info);
            };

            this.setError = function(error) {
                console.log("error", error);
            };
        }

        notifier = new Notifier();

rubendel avatar Aug 26 '15 16:08 rubendel

I'm back on this issue -

I've reworked http://opensourcebim.github.io/bimvie.ws-viewer/examples/api_Download_model.html (runnable here) so that the binary loading code is "bare metal", without using my Download component.

That's just so I can get this working as a reference, then I'll try to reintegrate that component.

Problem I'm having now is that execution never makes it to this point.

@rubendel I'm not sure where I'm going wrong here - would you be able to debug that for me, just so that execution makes it to here, where I'm getting a packet of binary data?

xeolabs avatar Aug 31 '15 10:08 xeolabs

Execution makes it as far as line 196, then state.title equals "User has insufficient rights to download revisions from this project", so I guess Thomas' account needs those permissions.

Are you able to set those permissions up in the server? Or maybe set up another account with those permissions?

(I'm using the same credentials from Thomas that I emailed to you on Aug 26).

xeolabs avatar Sep 02 '15 08:09 xeolabs

Got one more issue - see screenshot:

screenshot from 2015-09-08 14 33 42

xeolabs avatar Sep 08 '15 12:09 xeolabs

I added this line to show you that you are passing null as the first argument to setBinaryDataListener.

https://github.com/opensourceBIM/bimvie.ws-viewer/blob/master/examples/api_Download_model.html#L210

rubendel avatar Sep 09 '15 07:09 rubendel

Cool - seems to be downloading data now.

xeolabs avatar Sep 09 '15 07:09 xeolabs

I have test this example with bimserver-1.4.0-FINAL-2015-10-25 deployed on my computer win7 64-bit . I find a issue when testing the architect.ifc as shown below in the Chrome:

1089de4c-031e-11e6-9005-39a78d5b26a8

I think this issue is caused when creating the geometry of which geometryType=3 indices = stream.readIntArray(numIndices); How can I settle this problems? thanks.

gstslxd avatar Apr 15 '16 07:04 gstslxd

I have settle this bug. I add the code below:

else if (geometryType == 3) {
               numParts = stream.readInt();
                objectBounds = stream.readFloatArray(6);

It's OK now. @xeolabs

gstslxd avatar Apr 16 '16 05:04 gstslxd