[Addon] Copy Object to Selected

Howdy, this is my first post on blenderartists.org forums and my first attempt at addon creation with python. As you
should already guessed from the preceding lines, I’m new to python and to the blender programming world in general.
I just hope for you to take it easy with me :D. I know the code could be vastly optimized and condensed, but for me
was a great exercise as a beginner. Feel free to make any changes to the code and use it in any project as you like.
I don’t know if the GPL license is the the most appropriate for this but I think will be OK for now. Please, implementing
your own ideas and/or code variations is highly welcomed and encouraged. I should also add that I have taken a few
bits here and there from several places around the internet and modify them a little bit for my own purposes. Special
thanks to CodeXman for his bits and ideas that you can find everywhere around the web (literally), and Tom Rethaller
for his addon: “Align by faces”. The latter gave me the idea for this one.

The addon “Align by faces” is excellent for what it does but it didn’t give me the results I was looking for. I tried
using quaternions rotations exclusively and what not, but had no luck with matching the math involved with the
outcome I wanted to from this. I went the other route and use the parenting hack; you know, because the parent is a
plane (actually a triangle called “Circle”) it was easier to manipulate.

It should be OK for mechanical modeling and to accomplish some tasks associated with the placement of an object
onto another mesh object’s faces or vertices. I have tested it by placing a mesh, curve, lamp, camera, monkey onto
the faces or vertices of another mesh object on under Blender v2.75 at the moment. To install it, just place the python
file inside your addons folder and enable it under your preferences settings. I have not tested it under all possible
scenarios. Please, don’t use it on critical projects for now. I don’t warrant a perfect outcome.

A short demo:
[video]https://youtu.be/NO55BrEFHr4[/video]

The link to download the file.py from Google Drive:
https://drive.google.com/file/d/0BxpQX0r5Rs8XNzJNS2d2cEw5RjQ/view?usp=sharing

Or, if you prefer:
object_copy_to_selected.zip (2.97 KB)

And; well, this is how it works:

1- Select the source object:* This object will be copy on the faces or vertices of the target object.
* This object could be a mesh, curve, empty, lamp, camera, etc.
2- If the object is a mesh or curve, enter edit mode and select the polygon or control point accordingly.* Just one face or one control point should be selected.
* This is what will get aligned with the other faces or vertices.
3- Select the target object:* This object will be the recipient of the copy or copies.
* This object have to be a mesh.
4- Enter edit mode and select the faces or vertices:* The source object will be copied to these selected faces or vertices.

  • The tool edit mode state (vertex or face) will determine where the object will be copied to.
    5- Press spacebar, search and choose “Copy Object to Selected”:* This can be done from edit mode or object mode.
    6- Move, rotate, resize or make changes to the original mesh at this step if you wish to:* Everything will be selected under edit mode.
  • Because the copies are linked to the source object, any mesh edit will be replicated.
  • The most appropriate pivot and transform orientation will be apply for you at this stage.
  • Use local for transformations (xx, yy, zz). Transform axis will be your best guide (experiment).
  • Notice that all this should be done under edit mode.

If everything went according to these steps, you should get the object copied and aligned to the normal of the faces
or vertices selected on the target. If you select more than two objects (source and target), none or more than one
face on the source object or no face on the target object, an error info will pop up indicating this. The object with the
error will be in edit mode and you will be able to correct the issue. It is recommended that the two objects be on the
same layer, but it will create the objects if not so anyways. I still have to test it for different scenes, animation and
under a few others conditions, but the addon is functional for what it is. Again, just add, delete, change, use any code
inside as you see suitable. Enjoy…

3 Likes

The new link to download the file.py for 2.7* from Google Drive. The old link is broken:

It works and still has its purposes, but it continues to be an unpolished script.

The link to download the Folder for 2.80 from Google Drive:

Or the 2.80 file direct download:
copy_object_to_selected.py (12.4 KB)

4 Likes

Hi roly,

the easiest addon far and wide, unfortunately I have an error message in the Blender (2.8) version from today.

  File "E:\Blender-28\scripts\addons\copy_object_to_selected.py", line 152, in e
xecute
    cursor_location = scene.cursor_location.copy()
AttributeError: 'Scene' object has no attribute 'cursor_location'

location: <unknown location>:-1

location: <unknown location>:-1
1 Like

Hi, Same error

Hi there,
I uploaded a fixed (I hope) version of the addon. Try to download again. Python API for blender seems like it’s still in a state of flux, so it could happen again.

3 Likes

Yes…
Super fast fix.
Many thanks roly!

Working now :smile:

Super cool addon too bad your video link is dead or you need to remove video afert /

Bump Quick tutorial / review for the add-on Copy Object to selected

2 Likes

This addon is simple and awsome!
I’m just wondering if it could also use the pivot/origin of the first object instead using a selected face. This would be pretty handy.
Thanks for this addon!

2 Likes

Thanks for the addon. I’v a problem: I’ll use the spacebar for the tools (not the search),where I could have access for the addon without the search spacebar? Thanks by advance for the help.

I’ll had a response: I’ll must use F3 to have the search option if spacebar is using for tools.
Thanks For the help. Great Addon!

Using this addon in 2.81 is a real joy! I love it. I have been looking for something like this, and this fits the bill perfectly! Thank you! Thank you as well to BlenderNation and OnlineRender for their wonderful review that brought this addon to my attention.

It no longer works in 2.9 Alpha.
It is simply no longer found with F3.

Edit:
If others are facing the same problem, here is the solution.
In Blender 2.9 you have to activate the Developer Extras in Preferences->Interface->Developer Extras.
Then you have the Operator Search in the Edit menu (Top Menu).

2 Likes

It has been a long time since I visited this addon. I’m glad that some of you find it useful. I could find it with F3 after it was enabled. Maybe it’s just the way I have it configured on my system. But, anyways, I updated it with a “free” keyboard shortcut ( Alt X ). Possible it’ll be easier than to use search every time.

object_copy_to_selected.zip (3.2 KB)

3 Likes