3DPrinting
3DPrinting is a place where makers of all skill levels and walks of life can learn about and discuss 3D printing and development of 3D printed parts and devices.
The r/functionalprint community is now located at: or !functionalprint@fedia.io
There are CAD communities available at: !cad@lemmy.world or !freecad@lemmy.ml
Rules
-
No bigotry - including racism, sexism, ableism, homophobia, transphobia, or xenophobia. Code of Conduct.
-
Be respectful, especially when disagreeing. Everyone should feel welcome here.
-
No porn (NSFW prints are acceptable but must be marked NSFW)
-
No Ads / Spamming / Guerrilla Marketing
-
Do not create links to reddit
-
If you see an issue please flag it
-
No guns
-
No injury gore posts
If you need an easy way to host pictures, https://catbox.moe/ may be an option. Be ethical about what you post and donate if you are able or use this a lot. It is just an individual hosting content, not a company. The image embedding syntax for Lemmy is 
Moderation policy: Light, mostly invisible
view the rest of the comments
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
trimesh
that 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.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.
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.
It's not the nudging that you referred to. You edited your comment after I responded to remove that part of your comment.
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.
Fair enough, sorry.
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
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.
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!