Dynamo: Multiple Family Types assigned to Multiple Points generation on Revit

Dynamo: Multiple Family Types assigned to Multiple Points generation on Revit

miguelpupocorreia
Participant Participant
630 Views
5 Replies
Message 1 of 6

Dynamo: Multiple Family Types assigned to Multiple Points generation on Revit

miguelpupocorreia
Participant
Participant

Hello World,

 

I am using Dynamo for the first time so sorry if I sound confusing.

 

I wish to automatically install light fixtures into given points on Revit using Dynamo. The plan is to install all the different light fixtures at the same time.

 

I have successfully extracted the x and y coordinates (from a relative point);  and the type of light fixture from Excel.  I have the relative point coordinates as well. 

 

I have joined the x and y coordinates by using "Point.ByCoordinates". I am struggling with the substitution of the type of fixture and their respective families. I opened the different family types with "Family Types" . The type of light fixture that comes from the excel is opened with "List.GetItemAtIndex". 

 

My logic is the following: Replace the type of light fixtures with their respective families. Align them with their corresponding points. The Family types will now have an assigned location thus the corresponding lights will be generated in the Revit sheet.

 

Doubts and Struggles:
-I am struggling to find the correct functions with the desired inputs and outputs in Dynamo. 

-I am struggling with the correct format of different objects.

-Can points be created in the Revit sheet according to a set reference point in Dynamo or do they need always a line?

Thank you for the time and patience taken to read this post. I can't stress enough that I am a beginner and if there is something obvious missing I apologize. I wish to learn and develop my Dynamo skills so any input is good input!

 

Have a great one!

Cordially,

MC
 

 

 

0 Likes
Accepted solutions (1)
631 Views
5 Replies
Replies (5)
Message 2 of 6

lucdoucet_msdl
Advisor
Advisor

@miguelpupocorreia wrote:

I wish to automatically install light fixtures into given points on Revit using Dynamo. The plan is to install all the different light fixtures at the same time.

In other words, you want to program a dynamo script which will place Revit light fixtures according to a list of coordinates in one operation.

 


I have successfully extracted the x and y coordinates (from a relative point);  and the type of light fixture from Excel.  I have the relative point coordinates as well. 

You input for the x, y coordinates were extracted from the Revit project and they are relative to a known point modeled in x,y the Revit project. If the light fixtures are not installed in the ground and/or on multiple levels you may also need z values. Please confirm how to generated the x,y,z coordinates.

The excel file also contains the family and type names of the light fixture you want to use. 

 


I have joined the x and y coordinates by using "Point.ByCoordinates". I am struggling with the substitution of the type of fixture and their respective families. I opened the different family types with "Family Types" . The type of light fixture that comes from the excel is opened with "List.GetItemAtIndex". 

First of all, light fixture families come in a variety of hosting types (wall, ceiling, level). To use x,y,z coordinates, the fixture must be hosted by level. Your Point.ByCoordinates will supply the x,y and the height above the reference level will be z (or z-reference z).

Reading the family name from the excel file is the next step with List.getItemAtIndex resulting in a string of the family name.

My logic is the following: Replace the type of light fixtures with their respective families. Align them with their corresponding points. The Family types will now have an assigned location thus the corresponding lights will be generated in the Revit sheet.


This was not clear at the beginning, did you extract the coordinates of existing instances of light fixtures that you want to move or did you want to create new light fixtures a the points in your file?

If you are moving the existing families bypass the name of the family and extract the Element.Id of the selected light fixtures. You can then use this unique identifier to move the existing instances after processing the coordinates in your excel file.

 


-I am struggling to find the correct functions with the desired inputs and outputs in Dynamo. 

Depending on what the new coordinates need to be with respect to the original coordinates are, it may not be necessary to use an excel file. A simple translation can be realized in the same dynamo script (ex. move 1m up and 2m in the x). If you are working with existing lights, you need to collect their element.id, coordinates in plan (x,y), height above plane (z).

 


-I am struggling with the correct format of different objects.

Experience in Dynamo will come from understanding what type of format is required for each node. Posting your script and error messages will help debug where you are trying to pass incompatible formats.

 


-Can points be created in the Revit sheet according to a set reference point in Dynamo or do they need always a line?

Terminology is important with Revit. You will be probably working from a plan view and not a Revit sheet view. There are no 3D families in a sheet view. What you have on a sheet are a series of 2d views of the 3D model. The plan view is defined by it's reference level on which you can extract relative x,y coordinates.


Rather than a line, it is more correct to say a vector that locates the reference point on the view with respect to Revit's internal origin. This is an important concept because Dynamo allows you to work by default in Revit's internal coordinate system or define and use other coordinate systems. When moving this relative to the x,y,z of a default Revit projects internal coordinate system, it is easier to not have to deal with relative coordinates.

 

To continue getting help, you may need to post screen shots of you script in development. If it starts becoming very technical, you may find better help in the "Revit API Forum" or with the Revit DynamoBim forum.

 

Hope this helps,

 

-luc

Message 3 of 6

RLY_15
Advisor
Advisor

Input: Excel File containing X/Y/(Z?) data, and a list of names of Lighting Fixture Family Types.

 

Without custom packages, there's a handful of methods that you can use to place a family. It is primarily going to depend if the family is hosted to another element (like a ceiling), or not.

RLY_15_0-1776451818285.png

It sounds like you already have a sense on how to assemble the points list. The points list for all of these are in X/Y/Z format.

 

If you're using host-based families, you're going to need to get the host element (wall, ceiling, face of 'something', etc.). There's different ways to go about this, but for a beginner the least complicated way would be to get the Geometry of all of those possibilities, and run a clash detection against your list of points (or a sphere centered on each point if you want a small window of forgiveness). If you aren't using host-based families, skip this step.

 

Depending on the exactness of your excel file's naming scheme for the lighting fixtures, you can do the following:

  • Collect a list of all the lighting fixture families and types loaded into your project. Make one list containing the actual family elements, another list containing the name values.
  • Do a string comparison of the names against your excel file input (assuming every fixture has unit names and your excel file has exact matches, this would be something like an IndexOf node)
  • Use the index matches to getitematindex from the element list.

RLY_15_1-1776452334219.png

Message 4 of 6

obulesub
Community Manager
Community Manager

Hello @miguelpupocorreia,

It looks like you have received a lot of advice on this thread. Did any of the replies by @lucdoucet_msdl @RLY_15 answer your question? 

If you are still needing more help, please share an update here. The community will be happy to jump in and suggest more steps to help you get where you need to be.

Best,

Obulesu | Community Manager

Obulesu | Community Manager
Message 5 of 6

miguelpupocorreia
Participant
Participant
Accepted solution

Thank you  ,

 

I will try to answer as best as I can and provide the necessary resources in order to be as correct as possible.

 


 wrote:

In other words, you want to program a dynamo script which will place Revit light fixtures according to a list of coordinates in one operation.


Yes, that is precisely what I wish to do. Sorry if I was confusing on the original post.

 

The coordinates found on the excel were extracted from a dwg and are relative to a point in that dwg. I found the location of that point in Revit and I am keeping the  scales and units coherent between CAD and Revit.  The Excel has multiple columns and on the Revit_family it contains more than one family:

Screenshot 2026-04-22 175546.png

 

 

 

Regarding the fixture families,  I did not know that the fixture needed to be hosted by level.  Does the level also assign a floor plan?   I am not interested in the 3d model. The main purpose is to have a clear floor plan and corresponding sheet.

 


 wrote:


This was not clear at the beginning, did you extract the coordinates of existing instances of light fixtures that you want to move or did you want to create new light fixtures a the points in your file?


I wish to create them at the location given by the points of the excel. 

 

I will share what I have so far. Thanks for your input and guidance.  

 

This is the Dynamo Script:

 

revit1.png

 

 

This is one of the errors that I am having:

revit2.png

 

 

 

Have a great one!

Cordially,

MC

 

0 Likes
Message 6 of 6

miguelpupocorreia
Participant
Participant

Hi @RLY_15 , 

 

Thank you for taking the time to reply to my post.

 

Thank you for the suggested packages, I have already used some. The families have different heights. Some lighting fixtures are placed on the walls and, ceiling or even floor.

 

The families are not host based.


@RLY_15 wrote:

Depending on the exactness of your excel file's naming scheme for the lighting fixtures, you can do the following:

  • Collect a list of all the lighting fixture families and types loaded into your project. Make one list containing the actual family elements, another list containing the name values.
  • Do a string comparison of the names against your excel file input (assuming every fixture has unit names and your excel file has exact matches, this would be something like an IndexOf node)
  • Use the index matches to getitematindex from the element list.

RLY_15_1-1776452334219.png


I think I understood this part.
"FamilyInstance ID numbers" has the IDs of the Revit families that I wish to assign to the excel points.

"List.IndexOf" filters the "Names - String" (which in my case is a column of the excel in strig format) by the Code Block (In my case the code block would be something like: ["Generic_Light","LED_Strip","Wall_Fixture","Floor_Light"];).

"List.GetItemAtIndex" will then merge "FamilyInstance ID numbers" with their corresponding "List.IndexOf". 

Then is just a matter of assigning the points coordinates to their items. 

 

Is this logic correct? I could be confusing something. 

Thank you o much for your help,

Have a great one!

Cordially,

MC




0 Likes