Set Title Sheet Nested Label Parameter for Generic Annotation

I’m trying to create a script which will allow me to set a Status Code for each title sheet in my project. The parameter I’m trying to set is a Label Parameter (Generic Annotation).

I’m using Data shapes to make this a bit more user friendly, I have a list feeding into this for all the possible Codes which is how each family is also named. This part I’m ok with, I can get right up to the point where I need to apply the parameter. This I can’t seem to figure out, maybe I’m going about it wrong?

It would probably be better to collect all the title sheet types, then all the nested families for the Status Code and feed those into the Data Shapes but I haven’t figure out how to do that either as I can only get the families from the project. Either way, the nested families are all named the same and we only have a fixed number of them in the title sheet families.

I’ve managed to spend a few mins at this since posting.

If I feed a Element ID into the SetParameterByName node it will change the title block status.

Which leaves me to figure out how to get the element ID of all the nested components for my title block families.
One way I found, which I’m not so keen on, is to point Dynamo at a folder, open all title sheet families in the background and extract the nested families this way. I couldn’t full get it to work but I would rather be able to read the families direct from the project.

I don’t have the option of making the nested families Shared either, does anyone know how to get this to work?

Some more progress made, I managed to get the nested families from all the sheets and get their ID’s.

The only thing I can’t get is how to apply the selected Element ID applied to the Titlblock parameter?

Anyone able to shed some light or spot where I might be making an error and how to resolve this?

Showing your node previews would be helpful so we don’t have to mentally work out all that logic in our heads. :wink: The error would be nice too.

I’ve updated the above and the error is as follows:

Warning: Element.SetParameterByNameTypeOrInstance operation failed.
The call is ambiguous between the following methods or properties: ‘Revit.Elements.InternalUtilities.ElementUtils.SetParameterValue(Autodesk.Revit.DB.Parameter, Revit.Elements.Element)’ and 'Revit.Elements.InternalUtilities.ElementUtils.SetParameterValu

I’d first start by skipping the Element Id portion at the very end. You get the Id from the element and then try to select the element from the Id. You might also need to fix the list structure of that same list

I tried so many combination I probably forgot to tidy that part up.

When I go from the BoolMask into Select.ByElementId I get the following error as well as Nulls:

Warning: Select.ByElementId operation failed.
Unable to cast object of type ‘Revit.Elements.Family’ to type ‘Autodesk.Revit.DB.ElementId’

image

When you say fix the list structure, what do you mean?

You don’t need to select the element. Just set that as the input to your SetParameter node.

I mean clean up your list structure to work with the rest of your input lists. Unnecessary sublists will cause lacing issues.

You’ve lost me, I can kinda do some Dynamo things but I don’t understand what you mean by cleaning up the list structure. I put in a List.Flatten but no matter what combination of nodes I use I haven’t found the one which works yet.

—EDIT—

When I link the List.Flatten into the Element.SetParameter I get a Revit error that the family is breaking

I think you’re getting close. Your warning “storage type is not a number” is what I’m talking about with your element Ids. The value input should be the family, not the Id. Your List.Flatten node should go straight into the value input.

@JoziB as i said earlier, drop title block family. It will help others who’s trying to help you.

Out of interest, I took two titleblocks which have different status codes and had no problem swapping them around. Maybe the family (or ID) I’m feeding into the final SetParameter node is receiving the wrong nested family ID?

@Kulkul I should have done thi easrlier, attached is a titleblock family family. The Landscape or different size versions are the same other than their size/orientation, the nested families (I guess) have different ID’s but the same family names.

Titleblock_A1_Landscape.rfa (468 KB)Titleblock_A1_Landscape_Rotated.rfa (468 KB) Set Sheet Status Codes.dyn (139.0 KB)

— EDIT—

Added additional title sheet and script.

I just noticed when runnign the script for multiple (more than 2) sheets that something is wrong towards the end, it’s only listing 2x families while there should be 4x (with 2x being for a landscape sheet). Presumably this is why I get the Revit warning when setting new status codes.

I think I might know where I’m going wrong or the step I’m missing, not sure how to explain though…

I’ve retrieved all the titleblocks which are in the project and through DataShapes picked the ones which I want to change the status of.

What I’m not doing it creating a new list matching up the Titlesheets in the project to the one for each sheet - if that makes sense.

So, if I could take my filtered list of Titlesheets and match that to the one used in each sheet then I can remove all but the correct nested status family. My new list will consist of the Titlesheet families I need for each sheet and I can then filter out the relevant status code

I’m not sure if that makes sense? Anyone know which node I would have to use to do this?

— EDIT —

I have two lists,
1 - All the families Titlesheet in the project
2 - All the sheets I need to change status code of

I need to make a new list that takes the Titlesheets I need from list 1 and matches them up to the order in list 2

—EDIT—
I think I’ve figured out how to make the new list with correct order of sheets, however, I might have stumbled upon another problem, the ID’s from the nested families (in the sheet title block) don’t seem to match the ID for the nested family in the project.

The upper watch node shows the ID for the Status family ID within the Titleblock family.
The bottom show the ID for Titleblock status code family used in the project.

Anyone able to shed some insight in to this or a possible solution?

Is there a node available which can access nested (non-shared) nested families on a label parameter?