Preview Pane Flashing Broken Image Icon With Multiple Loadmodeldistance Objects

Discussion in 'ShapeJS' started by skwirrel, Mar 21, 2017.

  1. skwirrel
    skwirrel Member
    I am building a shapejs script to pull in a series of pre-rendered STL files (lettering in this case) and merge these into a single scene. Although there are other approaches for text (text and text2D) I am using this as I prefer the crisp rounded lettering this produces and besides which I thought it was worth flagging as this might affect others pulling in multiple STL files.

    BTW: the fonts are generated from the free Hersheys Fonts from this JS library: https://github.com/techninja/hersheytextjs .I can share details of how to build these if anyone is interested.

    The problem manifests itself when I go over 11 letters and one other base model file (so 12 STL files in total).

    The code to generate the lettering is available here:
    https://www.dropbox.com/s/zrk8tpee9x5qq6j/lettering.shape.js?dl=0

    I have tried tweaking voxel resolution and depthmax but neither of these help.

    Chrome inspector shows this network activity...

    [​IMG]
    The makeImageCached call is returning this content
    {"errors":[{"type":"java.lang.ArrayIndexOutOfBoundsException"}]}

    If I add the following at line 13....
    letter = new Cylinder(Vector3d(0*MM, 0*MM, 0*MM),Vector3d(0*MM, 10*MM, 0*MM),1*MM);
    to replace each letter with a simple stick, then the model renders OK. So it feels to me like it is either something to do with the complexity of all the letters together, or some sort of limit on the number of external models that can be loaded.

    There is also another problem I encountered when building this script if the same model file is included twice with the same URL. The second instance of the model doesn't appear. I worked round this by adding the '?'+i to the end of the URL so that each one is different. But it feels to me maybe like a pointer being copied as opposed to an object being deep cloned in the model caching code.

    Any pointers or workarounds would be gratefully received.
     
    Last edited: Mar 21, 2017
  2. AlanHudson
    AlanHudson Shapeways Employee Dev Team
    Currently there is a max of 10 models that can loaded at a time. We originally thought of these as loading 10 "big" 3d models so it seemed reasonable. But I see that using it as characters it's not very many. I've been meaning to test whether we can expand that without performance penalty. I'll try it out and see if we can increase that number.