Getting a shape to be automatically positioned to be inside the donut

Hello guys, first-timer in this forum.

I am trying to automatically position this doughnut shape to completely encapsulate a form or 3d volume or model. It is about a 3d clay printing robot but instead of making the shape fit the workspace of the clay 3d printer I want to position the 3d printer in a specific designated area.

I don’t have any GH script because honestly, I have no idea where to start, first, I was experimenting with collision detection but can’t make it work for the shape to be inside the donut or the workspace volume without manually positioning it.

Any help would be greatly appreciated.

Form volume.3dm (511.4 KB)

type or paste code here

It’s easy manually, just do that. There are many positions that work, how does one choose the best as an algorithm goal?

I’ve been doing it manually, but I want to automate this process and models are in different forms. and yes algorithmically the best position.Any way to that?

I asked a question. What criteria are used to determine the best position?

the criteria is for the model to fit inside the workspace, and the model and workspace have to be locked in the Z-axis, and not rotate when checking if the model fits inside! and it doesn’t have to best position as long as it fits inside

Yeah, that doesn’t add anything to answer my question. Fits by how much? AKA tolerance? Because it’s easy to see better and worse positions when doing it manually, not so easy by algorithm.

ok let’s say we array the donut in x and y positions across the model, and we check which ones don’t collide and cull the remaining that collide, would that work?

it doesn’t have to be the best position as long as we don’t have collisions.

Then I would decide wich position to pick later as long as its “green” non collision

You can probably look into filling volumes using Kangaroo, or maybe adapt one of the things shared here:

This is very interesting. Could you maybe suggest anything else too, I wanna try to think about other methods as well.

1 Like

If I understood correctly, the movement of the object is to be restricted to XY plane. In addition, the object cannot be rotated around any axis. The doughnut is a constant shape and stays put.

So you can move the object in XY plane and when it does not collide with the doughnut surface, and is inside the doughnut, the placement can be accepted? So there are millions of solutions to this, but you just need one.

Try Mesh Clash in Grasshopper. Turn the doughnut into a mesh and the object also. Then use something like an MD Slider to move the object in XY plane. Create a panel or some indicator in Grasshopper or Rhino that triggers when there is a collision (this can be anything, a Symbol or turn the object red when colliding…) Then just fiddle with that MD slider until you are satisfied.

Kangaroo solutions are also possible, but maybe start with this semi-automatic thingy to get the hang of it.

1 Like

You understood correctly 1000 %, semi-automatic would work too, but I have tons of models that need to be printed on location, and finding that sweet spot every time would be a huge time saver.

Would you be able to help with a more hands-on approach with the script I’ve just started learning Grasshopper.
if you have the time ofc?

I’m sure that handling a variety of parts is much more complicated than this, which tests only the X axis. Y and Z also need to be checked. And this happens to return only one result where there would often be many to choose from. Parts are internalized, no need for Rhino file. (296.0 KB)

Yes the axis doesn’t have to be checked because the height is always the same and both models don’t have to be moved on the axis.

But Y axis would have to be checked

But instead of moving the model, i would try to move the donut.

Thank you for your help @Joseph_Oster

The only prob is te model has moved on the z axis

I heard you say that before but why? The donut represents the tool, correct? Makes more sense to move the part. As to Z axis, the method I used aligns their volumetric centers which may not be good? So Z position should not change?

P.S. Need more parts to test please?

Here’s an ‘in-between’ using kangaroo, plus some variations.
(larger object ‘donut’ moved to smaller object) (299.1 KB)


constraining ‘Z’ movement (or you can constraint X and/or Y):

adding gravity:

Maybe it helps.
You can edit ‘forces’ to avoid inside shape passing through the donut.

Agree but maybe won’t matter?

the donut is the tool the parts are in different locations, which is why it makes sense to move the donut since the parts would be in an already set position relative to each other

The parts are predefined their locations are predefined, and only the robot will have to be moved in position to start the printing.

OK, that makes more sense but as @_RC says, maybe it doesn’t matter? What will matter is if you expect to provide a list of parts instead of solving for one at a time… :thinking:

In any case, this version is WAY BETTER :exclamation: The ‘UV Count’ slider (dark blue group) determines the X and Y “resolution” of positions checked. It gets slow with many positions. As you can see, three possibilities are presented in this case. Which one to choose?

There is a single point at the blue part and three points inside the donut corresponding to three possible solutions. (305.8 KB)

The parts are still being modeled, The part that I’ve provided is just a place holder the end product will be wavy and parametric, think of it like a jigsaw puzzle, in the end, the positions will be printed out on a big paper format or I will use augmented reality to position the robot in those places.

I will provide you with a few more models right now and maybe you will understand better.

The distance between each part has to be precise when the robot will be moved into the exact place to start printing.

Multiple donuts will have to be positioned relative to each other and ten all of the donuts will be exported as a 3d model containing some extra positioning points for AR or they will be printed out in a big paper format later on.


placeholder parts.3dm (894.0 KB)

The z constraint is what I’m looking for, but no need for actual gravity or anything like that, i wonder if it can be made so that the donut moves but not the part?

1 Like