it may be that the model view transform is what's affecting your code.
I was having a similar issue converting a robot cell for our simulation guys, every time it would move the origins and scale it to either inches or metric depending on what the component was originally created.
From what I can tell and what I was told by a few of the older simulation guys is STL does not store or relate the file to things present in the assembly you are working. So for us we saved it as a Parasolid and they then used a third party software that converted it to a format their simulation software could deal with.
Doubt this helps, but hope it helps you figure out your options, I have yet to find a good use for a STL file as far as mechanical design you really can't use them for much other than show and tell. and even then you can't take measurements off of them from what I have found.
I managed to get this working. In the end the components were misplaced because JavaFX and SolidWorks seem to use different coordinate systems (the y and z axes are inverted). When I apply a scale of (1, -1, -1) for each component before applying any other transform, everything is at the right place.