this post was submitted on 20 Aug 2025
16 points (100.0% liked)

3DPrinting

19855 readers
40 users here now

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

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 ![](URL)

Moderation policy: Light, mostly invisible

founded 2 years ago
MODERATORS
 

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?

you are viewing a single comment's thread
view the rest of the comments
[–] HelloRoot@lemy.lol 6 points 1 month ago* (last edited 1 month ago) (2 children)

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.

[–] tal@lemmy.today 3 points 1 month ago* (last edited 1 month ago) (2 children)

The best methods we have (afaik) basically randomly position the object and then nudge it until it gives up after doing lots of tries

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

In computational geometry, the smallest enclosing box problem is that of finding the oriented minimum bounding box enclosing a set of points. It is a type of bounding volume. "Smallest" may refer to volume, area, perimeter, etc. of the box.

It is sufficient to find the smallest enclosing box for the convex hull of the objects in question.

In 1985, Joseph O'Rourke published a cubic-time algorithm to find the minimum-volume enclosing box of a 3-dimensional point set.

It is also possible to approximate the minimum bounding box volume, to within any constant factor greater than one, in linear time.

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 points 1 month ago* (last edited 1 month ago) (1 children)

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 points 1 month ago (1 children)

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 points 1 month ago* (last edited 1 month ago) (1 children)

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 points 1 month ago (1 children)
[–] HelloRoot@lemy.lol 2 points 1 month ago* (last edited 1 month ago)

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 points 1 month ago

because 3D printers have their own constraints in things like the overhang that they can do.

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 points 1 month ago

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!