1
$\begingroup$

I am just starting out with blender and could use some help. I imported an .fbx from Revit and it works great. I have some streetlights in this project and when i change one of them in blender then all of them change.

Exactly like I want. But now I want to add a lightsource to all of the streetlights, and blender won't add them to all streetlights. I set the lightsource as a child of the streetlight. So when I duplicate the streetlight the lightsource will also copy with it's parrent. However I allready have all the streetlights placed (in original model). So this doesn't help me.

Is there some way to copy the location of the lightsource in relation to the streetlight, and then paste a new lightsource to a different streetlight using those coordinates? Or is there a different way to add the lightsources to all the streetlights?enter image description here

$\endgroup$
1
2
$\begingroup$

Something along these lines may work. This version assumes that your lamp-posts are instances, and the only transforms responsible for putting them where they are, are their own, without the interference of parenting or constraints. You may need to arrange that, by, for instance, clearing their parenting, keeping their transforms.

  • Make a backup of your file
  • Alt D create an instance of one of your lamp-posts
  • (Probably, you'll want to isolate it / hide everything else, so you can see what you're doing)
  • Ctrl A, or via the Header > Object menu, > Clear all its transforms
  • Position your light where you would like it, relative to the lamp-post
  • M Add the light and the lamp-post to a new collection, called, say, 'Practical'
  • With Shift C the 3D cursor at World 0, Shift A add a new Collection Instance to the scene, based on the new collection.
  • Unhide your original lamp-posts, select them, and then your 'Practical' Collection Instance, so it is the active object.

Now we want to make a copy of the Collection Instance in the place of all the existing lamp-posts. I'm surprised there isn't an operator / add-on to do this without scripting, but unless someone finds one for us, here goes.. run this script:

import bpy

C = bpy.context
D = bpy.data

src = C.active_object
src.select_set(False)
sel = C.selected_objects

cp_col  = D.collections.new('Practicals')
C.scene.collection.children.link(cp_col)

for ob in sel: 
    cp = src.copy()
    cp.matrix_world = ob.matrix_world
    cp_col.objects.link(cp)

it should create the copies in place, and put them in a new collection called 'Practicals'. (plural)

Hopefully, you should now be able to hide the original lamp-posts, and see them replaced with practical, light-bearing instances. And be left in a state from which you can change all the lights / do whatever you like, by editing the objects in the 'Practical' collection from which the Collection Instance is derived.

$\endgroup$
2
  • $\begingroup$ Hello Robin Betts, Thank you for your response! and sorry I am reacting so late. But I just got back to this. I followed your steps as best as I could. And it seems to work mostly. It copied the light and object to the right location, and with the right orientation. However the scale doesnt translate well. Both the light and the object where too small. It also left the old objects. So I have to delete those. All in all this is not a bad result. I just have to scale the objects with their own origin and delete the old ones. But maybe you know why the scale is wrong? Thanks so much!! $\endgroup$ – Rens Feb 9 at 12:58
  • $\begingroup$ OK, sorry, maybe bullet 4 should have been: 'Clear Translation and Rotation, and Apply Scale'. When modelling, I'm always careful not to leave any object-level scale transform hanging around. I scale in Edit mode, or apply scale as soon as possible. The old lamp-posts were left in place intentionally, for safety. If they are all in, or all linked to, a collection of their own, it's not hard to delete them all at once, when you know you're good to go. $\endgroup$ – Robin Betts Feb 9 at 13:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.