Copy and Place Light Fixtures
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a macro that places copies of a light fixture on a lighting plan. It works great if the light to be copied is a face based light that is placed on a ceiling grid using the "Place on Face" option. The copies are placed on the same ceiling grid.
However, it doesn't work if the original light fixture is placed on a level using the "Place on Work Plane" option. I know I need to use a different overload for placing these lights, but I have tried multiple times, and I can't figure out how to get this to work. Can anyone help?
For the lights placed on a ceiling grid, I use this to get the host face:
Reference hostFace = lightFamilyInstance.HostFace;Then to place the lights I use this overload:
FamilyInstance lightFamilyInstance2 = doc.Create.NewFamilyInstance(hostFace, pointtoplace, rotation,lightFamilySymbol );
How do I modify these two lines to make then work for a light fixture placed on a level? I know from stepping through the code that for the lights placed on a level, hostFace remains null. I've tried changing that line to
Element host = lightFamilyInstance.Host;but I can't find any way to insert a light using the host, and I can't figure out how to get a hostFace from that element.