Required adding a quick and dirty bounding box computation to the
LineMeshGeometry and expose it through LineMesh properties. Make sure
the camera is now looking at that point on file load and is positioned
relatively to it.
Well, this one would potentially de-center the bed because it tries to center on the line mesh bounding cuboid, which is what Lays put in my list of todos. ;-)
Now obviously we can't have it centered on both at the same time.
So this is due to the two points in the path which are way outside the mesh. With the data currently available I have no good way to distinguish them and so yes the bounding cuboid computation includes them. Now the thing is the bed display is wrong anyway, it's currently on fixed coordinates whatever real shape is had, clearly that doesn't help (I expect the model you use assumes a different bed).
So I see two ways out for that one, either:
a) we keep this one as is and see how it goes when we have proper bed metrics in the display, seeing what else needs to be adjusted, or
b) someone gives me a good heuristic for the cuboid computation or even better tries it by adjusting this patch locally ('cause I have in effect a single model to test with) and then we change the patch to use said heuristic (I suspect ignoring the first and last point would be enough, but clearly it's just gut feeling, I don't have enough domain knowledge).
Ah yes, also third option:
c) drop that patch altogether, if there's no good way to have a heuristic to remove the points we don't want for the cuboid computation, despite Lays asking me to recenter the view by default, it's not set in stone and we could stay with the "center of the bed" version currently present
"-> Put camera view on the center of the object being rendered" <- yeah my bad --' (I think that I was following maybe the Cura guy advice about this...)
But I agree with @rizzitello , center on the bed is better than the model. because we can have more than one model on the bed, and that can make the centering a bit confusing.
Sorry about the mess!
Thank your for explaining why the grid is not centered any longer.
We are not really loading a model but instead the path of the tool. Those two outer point are the first home for the tool and the finishing home written in the gcode. I've done some additional tests with this and confirmed that the gcode paths are being rendered correctly but our gcode layer.
You should be able to read the bed info from the current profile if connected however the 3d view is more a generic preview of the paths and does not require you to be connected to a printer at all. To complicate the issue a bit further there is only one 3d view no matter how many printers you connect so how does one decide what profile to preview with . What if we provided a few preview options to let the user change if the bed is round or square and its radius or x and y size (maybe the grid sizes too)? maybe have it just save that info to our config file so the users with only one printer only do it once. And it will default to reading from the first profile made.