# How To Pick Random Object From Folder or Collection and Placed in Blender [closed]

what I need is the change of items in certain points in a room. For example, in the determined x, y, z coordinates in the upper left corner, the closet will be the bed in the next scene. How can I achieve this with python.

Edit: I tried the code and the items take each other's positions, but there is a problem that some objects are buried because they are different in height.

Edit 2 : Based on your comments, I have progressed a lot. There will be 10 objects in my collection and there will be only 5 objects in the room. I want these items to change constantly, the locations will be the same, the items will change.

• What have you tried so far? Where the objects come from? Blend, obj, fbx? How do you specify the coords? Can you elaborate? Sep 13 at 11:57
• I have a room and I have imported my other objects in fbx format. Since one of my objects will be on the wall, I took it into a separate collection and the other objects in a collection, so I have 2 collections. I'm researching right now, I've written a few lines, that's all. Sep 13 at 12:00
• Re last edit. Suggest that having a logical origin to your objects would make sense in this case. See blender.stackexchange.com/questions/73698/… With an origin on the bottom setting a loc'n on the floor places them on floor, not half their height above / below. IMO would add empties or vertex groups to your room, to give some rules to this. akin to feng shui A closet would most likely not be in center of a room. A bed probably doesn't go in the toilet. Sep 13 at 14:03
• ... also posted this as a duplicate blender.stackexchange.com/questions/212266/… of a previous question. The OP there has a number of question and answers related to doing exactly this. Sep 13 at 14:23

import bpy, random