g-stl crashes when using large BOTs?

T Vaughan
  • T Vaughan

    T Vaughan - 2012-10-26


    First of all, this is a great tool, and I'm glad to see that it continues to be developed! It turned out to be exactly what I needed for my project.

    I am having a problem though. I'm not sure whether this is a bug or if I'm maybe doing something wrong. Basically, I've got these two large .stl files of several thousand triangles each (let's call them model1 and model2). I import them using stl-g, then I add shapes to model1 using a combination. I subtract model2 from my modified model1 using a region. When I try to export this region using g-stl, it runs for a very long time before crashing due to there being insufficient memory (which I'm monitoring).

    One other thing I should mention is that model1 and model2 both share some triangles. In other words, they touch over some surface. They do not overlap. I'm not sure if this could result in this behaviour. If it shouldn't, could this be a bug? Or am I doing something wrong?

    I'm running the 64-bit Linux version 7.22.

    Thanks in advance for any tips or suggestions!

  • Sean Morrison

    Sean Morrison - 2012-10-26


    Thanks for the compliments!

    So it's definitely a bug if it crashes, but unbounded memory can be problematic.  Still, whether you're doing anything wrong remains to be seen.  :)

    What you described "should" work, but obviously doesn't.  The first thing to try would be to nudge them ever so slightly closer together (0.01mm is probably sufficient)  so that they DO overlap and don't have faces that overlap exactly.  The coinciding faces might be getting stuck in an infinite loop until all memory is exhausted and it crashes.  A few thousand triangles certainly shouldn't use that much memory.

    If you can post your .g file, then even better.  You can submit a bug report here:


  • T Vaughan

    T Vaughan - 2012-10-26

    Hi Sean,

    Thanks for the fast reply!

    I tried what you said, and that failed as well. I thought I might be jumping to conclusions about the source of the problem, so I tried a few other simple tests:
    - I tried g-dxf and g-acad to see if this problem I'm having is specific to g-stl. I had the same memory problem with both exporters.
    - I tried immediately writing both models back to .stl format using g-stl without doing any additional processing. This worked.
    - I tried simply subtracting each of the models from a sphere, and then ran the "facetize" function on the resulting region. This worked when I used my "model1". When I tried doing this with "model2", the memory usage went up to about 6GB, at which point I decided to just kill the process manually.
    I wonder if it could be something wrong with the model itself? Just for reference, it has approximately 32,000 triangles. When I do raytracing to preview the models, they appear correct in terms of what I intended, so I'm assuming it is a closed shape. However, when I draw the models in the GUI, model1 is grey and model2 is red. Is this indicative of anything?

    I will get back to you as soon as I am able about sending the .g file with the problematic model.

    I did have one other question: If I wanted to give credit to BRL CAD in a scientific paper of some sort, how should I go about that? Is there a citation I can use?


  • Sean Morrison

    Sean Morrison - 2012-10-26


    That is very curious and concerning about your 'model2' object gobbling up memory.  That implies it has nothing to do with the boolean evaluation itself but something to do within that object.  So few triangles should be using less than half a MB or thereabouts.

    The colors are indicative but will be one color vs another depending on what context they're being drawn under.  Red is a normal wireframe.  Gray is usually reserved for geometry imported with a gray color or can be geometry used in a subtraction.  There are a ton of things that could be wrong with the model itself, so it's hard to say without seeing the data.

    We have a ton of papers that you can cite:  http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk/doc/BRL-CAD.bib

    Alternatively, some have just given simple thanks calling out specific individuals in the main write-up somewhere.  Whatever suits you works.  Thanks for asking!


  • T Vaughan

    T Vaughan - 2013-05-29

    Hi! It's been a while, but I thought I should get back to you about what ended up happening.

    I tried reducing the number of triangles in my 'model2' by removing all unnecessary regions. I basically just cut off all parts that I didn't need using Blender's boolean mesh operations (subtracting cubes and whatnot). Finally I was able to subtract 'model2' from my modified 'model1'.

    I probably won't be able to do this for all models, unfortunately, but this might just help someone else who runs into this problem.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks