Element.GetParameterValueByName failure

Any idea why the top part of this sequence is executing properly, but the bottom part is not? It’s essentially the same, I’m just trying to get elements of differing categories and parameter name from the same link.

Can you show the outputs of the nodes?

I mean, can you show what the Element.GetFromLinkedFile’s outputting for the title block category. There is a good chance that is where the issue is.

The error is in the yellow node from your first screenshot. By default the OOTB GetParameterValueByName node only works on your current document when it is attempting to return elements. In your case, you are trying to return a FamilyType and since that does not exist in your current file, then Dynamo can’t return it (with the green element id).

1 Like

Oops, sorry @kennyb6.

Based on what @john_pierson has said, the OOTB node won’t work but an API call should. Are the only things you need from the title blocks are the type names/occurrences?

For that first node I need the title block type name (marked as #1) for a node further down the line I need title block sheet number (marked as #2).

I’m still confused on why I don’t have an issue using the OOTB node to get the sheet numbers of the sheets in a linked file in this same graph?

The issue is that the first parameter you are trying to get (#1) returns an element. I am guessing behind the scenes, Dynamo is giving you the ElementId of the type of the titleblock (judging by the warning in the OP). The problem is that the node is trying to find that ElementId that is unique to the Linked Project in your Current Project, which doesn’t exist.

Basically, it is looking for the Linked Project’s title block type’s ElementId on the Current Project where that type doesn’t exist.

The top GetParameter node works because it is just returning a number/string.

To get around this, you just need to get the ElementId on the Linked Project’s doc. There might be a node for this in a package but you can also accomplish this with a python node and an API call.

1 Like

Thanks for the explanation, that does clarify it quite a bit! I’m still learning my way around Dynamo, let alone knowing anything about Python yet (hopefully someday though). I’ll see if I can find another way around this with a custom node. Your time is much appreciated!

You can use a snippet of python :

import clr
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager

if isinstance(IN[0], list) : elements = UnwrapElement(IN[0])
else : elements = [UnwrapElement(IN[0])]
doc = IN[1]

types= []

for elem in elements:
	types.append(doc.GetElement(elem.GetTypeId()))

OUT = types

2 Likes

I managed to make this work by using the LinkElement.OfCategory & LinkElement.GetParameterValueByName nodes from the BimorphNodes package.

It appears to cycle “slowly” through every sheet in the linked project to obtain the proper data. However, I suppose this is better than it not working at all!

@john_pierson & @kennyb6, thanks again for the thoughtful insight!

@Alban_de_Chasteigner, thank you for this! This is the final resolution, because it works hand-in-hand with the Python script you prepared for me last week (Duplicate family from linked model into host model) which takes the title block contained within a linked sheet and copies it to a sheet within the host project.

Thank you once again!

1 Like