Can't get MEP Ductwork family

Why are these two nodes acting different?!?
Get Parameter for some reason won’t get family even though Parameter by name will.

The Parameter.ParameterByName node is returning the parameter element, while Element.GetParameterValueByName is returning the data stored in that parameter itself.

It’s easier to review this with a simple example (as with most anything - you’ll have much more success if you break the problem down into something readily comprehendible and comparable with human eyes before you look into one thousand four hundred and thirty elements). Let’s say you wanted to find out how much insulation would be provided by a SIPs panel, by getting it’s thickness and multiplying by the R value. We’ll assume we already have the panel type selected, so all we need to do is get the “Thickness” parameter.

Element.GetParameterValueByname for “Thickness” will return a value like 25and from there we need to multiply by the insulation factor of 5 to get the total thermal resistence, in this case R5 so we just do the math with something like 5*x; in a code block and recieve an overall value of 125.

With Parameter.ParameterByName the result is something like Thickness: 25. Note didn’t say "Thickness: 25" as the resulting value isn’t a string, but a parameter element. That’s right - the data associated to an element is actually stored in another type of element, but I digress. If we trya nd multiply Thickness: 25 by the R value of 5 we get a result of null and a warning results. This is because we don’t yet have the value, but the parameter element and we can’t multiply Thickness: 25 by 5 any more than we can take the color teal and raise it to the Londonderry power… If we want the value stored in the parameter we have to go a step further and ask the parameter element for it’s value using a Parameter.Value node, the output of which would be 25 and that double can be multiplied by 5 to get us the value of 125.

In your case the Parameter.Value would likely return a list of Families just like you have in the Element.GetparameterValueByName node.

So why use a Parameter.ParameterByName? Well there are a few reasons that come to mind:

  • What if you wanted to know if that parameter was Read Only?
  • What if you wanted to know what type of data was stored in the parameter?
  • What if you wanted to know if that parameter value was returning an area or a volume or a distance?
  • What if you wanted to know anything in the Inspect section of the Parameter class?
  • What if you weren’t sure if the same parameter existed on two elements?

However generally speaking Element.GetParameterValueByName is the node you want to use as it’s a direct path to the value in question.

Hopefully this clears up the issue some. :slight_smile:

Thanks, that does help a bit.
The main question I have now is why Element.GetParameterValueByname is not returning the family name.
When I use the exact node set up for another category I get the actual family name, but with MEP Ductwork category I get the output as shown.

I tried the the Element.Parameter node and it does list the family as it would for other categories but this also list a lot more things adding to run time and I need to run this on a full model.

My goal is to group and sort all MEP Fabrication parts in the job by family name and size so it would be nice to get the family name.
I guess I can do this by the “Fabrication Part Type” but this is less intuitive to look at. I can in the end use Parameter.ParameterByName to export to excel.

Fabrication elements are odd ducks unfortunately… they’re controlled in a different way than usual methods, which is true for just about every aspect of how they work (try and author one in the family environment to confirm).

Their family value is reporting oddly. I believe that this is because the direct root knows what the actual family is - the same as all fabrication parts, default - while the Parameter itself knows you’re actually looking for the detailed info. Sadly their odd-duck status means many (myself included) don’t have a model to test with relative to what the value you are after is.

Try running an Element.Parameters node into a Parameter.Name node into an Element.GetParameterValueByName node as the ‘name’ field to see if another value aligns, or just use a Parameter.Value node for (perhaps) immediate results.

I tried I Element.Parameters node into a Parameter.Name node into an element.GetParameterValueByName node and got the same results, so yeah it’s just goofy. Thanks again for guiding me a bit here.

I ended up just grouping by family without seeing the true results, then sorting and grouping by size. I then pulled the family name with FamilyType.FamilyName along with the other data I needed.

1 Like