Create filled regions in generic annotation family

Dynamo 1.3.3
Revit 2018.3

Without getting too far into the details, I am trying to generate filled regions in a generic annotation family to create a key plan. There are some Revit API and python things I’m struggling with, since I’m relatively inexperienced in these areas.

I have used the python script found here in the past:

It works well, creating filled regions with multiple loops. I believe it uses this create method:

The other two python scripts simply collect filled region types and views in the input document. The main problem is filled regions are treated differently in annotative families. Instead of detail items, their category is filled regions. Which makes sense, because this isn’t a detail item family. So I imagine there is another method that can be used to create filled regions in these families, but I’m struggling to find it. If anyone knows how to do this (or if it’s not possible) any feedback is greatly appreciated!

I have attached a simplified version of my script and an image for reference.

Key Plan Family Creation.dyn (13.6 KB)

Thanks, everyone.

(Edit: I actually found the main issue it my original script. I was calling the wrong view element in the family. I believe the view element I was using was the view template. Ironically, the sheet element was the appropriate view for me to feed into the script. I’ll include an image so everyone knows what I mean. With this change the script works in Dynamo 1.3.3 as well as 2.0.x)

1 Like

Hi,
actually you don’t need python, there is a node for it:

It works in an annotation family environment, is it what you needed?

2 Likes

I’ll keep testing, but so far it seems to me that it’s a difference between Dynamo 1.3.3 and Dynamo 2.0.1

I tried the same script in Dynamo 1.3.3 and it failed. Worked fine in 2.0.1. Unfortunately I’ve had so many ongoing issues with scripts in Dynamo 2.0 and have generally avoided using it. Some scripts crash Revit every time I try to upgrade them, and even when I rebuilt them in 2.0 running them crashed Revit. Do you happen to know of a relatively solid daily release of 2.0?

That all probably belongs in another thread though.
For this topic, I’ll keep trying other methods.

I should point out a couple other things. In my particular use case, a big part of the script is allowing for a document input. Also, I need the filled region to have multiple loops (i.e. holes in the region), which is why I initially sought out the python script.

The create method used in the python script asks for a document, a filled region type id, a view id, and the boundary curve list. It seems to me that in Dynamo 1.3.3, since the only available view in a generic annotation family is considered a sheet, it acts the same as it would for a sheet in a project, which does not allow filled regions. However, if the node in Dynamo 2.0 works (in the same version of Revit no less) then obviously there is a way to do it.

Sorry for being so complicated! I really appreciate the help. I’ll probably start testing things out in Dynamo 2.0 to see if I can get it working there.

Thanks!

Thought about this a little more. To handle the “holes” I can generate solid white filled regions for those curves and basically mask the region in those areas.

(Edit: actually, I don’t think you could reliably determine which curveloops should be white or not. However, I used the same python script as above in Dynamo 2.0 and it works wonderfully. As they said in the original post, to use it on multiple regions/views, you should make it a custom node and change the lacing.)

So the main issues now would be allowing for document input and getting my overall script to work entirely in a single version of Dynamo. However, these may have workarounds. Theoretically, I could instruct the user to open the generic annotation family, and run the script once it is active through Dynamo player. Which I believe does not care which version a script was made in, so long as both versions are installed on that computer.

I’ll go ahead and mark your answer as the solution. It answers my general question. I’ll figure the rest out from here.

Thanks!!

Just an addition.

If you are using dynamo (2.13) with Revit 2023, [Element Types] node and [All Element of Type] node
have been renamed to [Element Classes] and [All Elements of Class]