Hello,
I’m trying to get the value of a family type parameter with Dynamo using the Element.GetParameterValueByName block. However, when I plug in the correct element and parameter name, the block outputs nothing. When I output the Element.Parameters to verify, it looks like they are null as well
To piggyback on what @Draxl_Andreas suggested, if you’ve been working on the same script for a while, maybe try saving and restarting the Dynamo Editor.
yes it definitely looks like it’s running since I’m getting output at almost every block. As shown in my screenshot, it’s really only the Element.GetParameterValueByName that appears as blank even though I’m not getting any errors or warnings.
Also the Element.Parameters doesn’t look right either.
oh I see. My “Get Element ID from FamilyDoc Parameters” essentially gets a FamilyParameter Element (Autodesk.Revit.DB.FamilyParameter) then outputs the .Id of the FamilyParameter as shown below. I then GetElement with that ID.
@Draxl_Andreas I guess my question now becomes: is there a way to get just an Element from my family Parameter as required for the Element.GetParameterValueByName block? I feel like this is what I’ve been struggling with as I’m new to Dynamo
I essentially want to extract the value associated with the family type parameter. So for the Depth example, I would want to get back 1750.00
This being the case I thought Element.GetParameterValueByName would be the best block to use, but to do so I need the Element, not the Parameter element as you indicated. So I would need the element related to the Depth family type parameter
@Draxl_Andreas I took a look, but I’m not sure if this is exactly what I need to get Value from a family type parameter. I tried using the line of code FilteredElementCollector(doc).OfClass(FamilyElement).WherePasses(filter).FirstElement() but it still returns IDs that again give me ParameterElement.
Is there a way to go Family Type Parameter or FamilyDoc to Element and not ParameterElement?
You’re sort of mixing processes. Where are you getting the family document from? Why do you need to get the value from the document and not an instance of the family or type? If we had more information on your process we might be able to suggest a better solution.
Your Id is for a parameter which you already have in the first python node. What’s your intent with getting the element from the Id again? Are you trying to get it from a different document? If you have the parameter you should be able to get the value from it.
@Nick_Boyts I essentially want to open Revit files and read the Values of its Family Types Parameters (Modify > Family Types in Revit). Here is the full block diagram.
Using the Crumple package, I managed to read the file, open the FamilyDoc, and read the FamilyDoc.Parameters. The FamilyDoc.Parameters returns the correct names of the parameters I’m interested in, and their corresponding FamilyParameter elements which it seems is where I’m running into trouble. Is it possible to get the FamilyType Parameter Values from FamilyParameter elements? Or do I need to change my approach with other blocks?
Also thank you to everyone for their help so far. I really appreciate it!
I see. You’re opening Family files and wanting to essentially return all parameters and their values. The problem right now is that the ParameterElement is the “definition” of the parameter, which can be applied to multiple elements. It’s not necessarily the parameter with reference to that element or family type.
Orchid has some nodes for dealing with family documents, including one for parameter values. With those and a little python node to get the names of the parameter elements, you should be able to get exactly what you want.
@Nick_Boyts thank you so much this worked for me!!
Just a follow-up question I thought of: I used FamilyDocument.Current to feed the FamilyDocument to FamilyType.InDocument and FamilyDocument.Parameters since they require a Revit.Application.Document object, not a DB.Document.
Does this mean that if I wanted to extract all parameter values from many .rfa files in a folder on my computer, I would have to manually open every single file and run this dynamo script one by one? Is there a way to run this script on many .rfa files in the same folder as I’ve been doing (in other words batch extract parameter values)?
You should be able to get the document from the file (Orchid’s Document.BackgroundOpen) and then open all those families in the background to process one by one. Be careful though, as this can eat up a lot of resources and slow your machine. Depending on how many families you have, it can be best to batch process your families in workable chunks.