I'm trying to lie a object on a surface for 3D printing it afterwards.

In other words, I want to find a way to automatically position a complex object the best way on a printing table. Here is a sample picture of an object:

Therefore my idea was to use the gravity aimation of blender:

ctx = bpy.context

obj = ctx.scene.objects.active
ob.select = True

obj.location = (0,0,0)
bpy.ops.object.transform_apply(location=True, rotation=True, scale=False)

obj.rigid_body.type = 'ACTIVE'
mod_col = obj.modifiers.new('col', 'COLLISION')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier='col')

plane = bpy.ops.mesh.primitive_plane_add(radius=(obj.dimensions[0]+obj.dimensions[1]), location=(0,0,(obj.dimensions[2]/(-2))-1))
plane = bpy.context.active_object
plane.name = 'Plane'
plane.rigid_body.type = 'PASSIVE'
mod_col = plane.modifiers.new('col', 'COLLISION')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier='col')

ctx.scene.frame_start = 0
ctx.scene.frame_end = 250

bpy.data.scenes['Scene'].gravity[2] = -50

if scene.frame_current == 249:

obj = ctx.scene.objects.active
bpy.ops.object.transform_apply(location=True, rotation=True, scale=False)
plane.select = True


Till now the animation won't stop at the last frame.

Is there a better way to lie the object flat and if not, how can I stop the animation at the last frame?

  • $\begingroup$ De facto tool for something like this is shrinkwrap modifier, but I don't know how it'll work for your case. Can you provide screenshots for clarification of what your models look like and what you're trying to do? $\endgroup$
    – JakeD
    Nov 16 '16 at 17:27
  • $\begingroup$ Thanks for your reply, I uploaded a screenshot. How could I use the shrinkwrap modifier to do this? $\endgroup$
    – Basti
    Nov 17 '16 at 10:50
  • $\begingroup$ So you want it just want it snapped to the surface of another object? Have you looked at this? $\endgroup$
    – JakeD
    Nov 17 '16 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.