I've made some prints fit in my printer by printing them at a diagonal. I work it out by spinning it until I don't get an error from the slicer.
I'd rather be able to calculate exactly what will fit beforehand instead of spinning the model around in CAD or the slicer.
Has anyone found/used a calculator that can do this?
10 Comments
HelloRoot@lemy.lol · 6 pts · 348d
You won't believe it but thats actually a very hard problem to solve algorithmically.
If you want to search further, it is called the “containment under free rotation” problem.
Edit:
There is a tool called
trimeshthat lets you load in meshes, compute convex hulls, and compute oriented minimum bounding boxes. https://trimesh.org/quick_start.html search for "bounding box" on that page.tal@lemmy.today · 3 pts · 348d
I'm skeptical. I can think of some problems that do work like that, like graphviz's node-cluster-and-fit-to-a-plane layout stuff. But here, you should just need to be working with the convex hull. It should be possible to eliminate a lot of classes of potential solutions by reducing it to looking at edge cases, like some face of the convex hull is in-plane with the bounding box or something.
kagis
Yeah.
https://en.wikipedia.org/wiki/Minimum_bounding_box_algorithms
EDIT: Though if OP is rotating along anything other than just the up-and-down axis (is that, by convention, Z for 3D printing? Been a while since I've printed anything), it's more complicated than just determining whether a rotated object will fit in the bounding box, because 3D printers have their own constraints in things like the overhang that they can do.
HelloRoot@lemy.lol · 3 pts · 348d
Technically my statement is incorrect, I agree.
But have you read the algo?
It basically takes the global minimum over all edge pairs (and their zero-curves) and return the orientation and extents with the smallest encountered volume. Which is basically like trying every possible position along the edges of the convex hull around your obect.
But I edited my comment to remove that part, because that bit is honestly irrelevant for OPs question.
tal@lemmy.today · 2 pts · 348d
It's not the nudging that you referred to. You edited your comment after I responded to remove that part of your comment.
HelloRoot@lemy.lol · 2 pts · 348d
True, the random positioning and nudging is something I saw in gamedev for some reason a long time ago.
I edited it before I read your reply and after I found a tool that can do what OP asked for.
tal@lemmy.today · 2 pts · 348d
Fair enough, sorry.
HelloRoot@lemy.lol · 2 pts · 348d
No need to be sorry, I'm actually happy that people on lemmy give their best to uphold Cunningham’s Law by correcting wrong statements.
It's a me problem, cause I think more after I write, so I end up posting, then editing the same comment a lot until it is "right".
Cheers! :D
Blue_Morpho@lemmy.world · 1 pts · 348d
That's what supports are for. :) In my case I made a custom sprue because autogen supports sagged unless it was 0 clearance.
I was just looking for something like a rectangular prism or cylinder to fit in a cube. I was surprised by the replies that it's mathematically hard. I expected it to be a geometry problem with a bit of calculus to find the convergence.
MysteriousSophon21@lemmy.world · 2 pts · 347d
trimesh is actually perfect for this - i've used it to auto-rotate models for optimal print orientation without supports and it works great for volume fitting too!
roofuskit@lemmy.world · 2 pts · 348d
Never seen one, doesn't seem universally useful considering how difficult and impractical it can make printing certain things.