Activate Attached Detail Groups

Does someone know if it is possible with Dynamo to activate Attached Detail Groups in Model Groups?

I have a lot of Groups, each one with just an Attached Detail Groups and I would like to make it visible in several views.

All I found about this topic was:

Thanks!!

It just got asked yesterday, I got around to it a few minutes ago.

1 Like

I did not found it. Thanks!!

Hello!
Do you notice anything wrong with my script?
I can see that I am inputing exactly the group and attached detail group that I want. The final output results in null, but it does not show any warning. And it doesn’t change anything in the model, obviously.
I can’t figure out what the problem is.

I ran into the same problem. So I checked the API docs and for what I can find is the “.ShowAttachedDetailGroups Method” a method that is only available for Revit 2020. So I’m curious how @Bjorn_Keulemans1 got his script working in Revit 2019.
https://www.revitapidocs.com/2020/2e4d7640-92fa-fc3b-83a2-e492bc8b0269.htm (link to ShowAttachedDetailGroups Method in the API docs)

The method got introduced in R2019.1 or .2 that’s why.

Hi,
I added a screenshot of my script. It doesn’t work, but i can’t find why. I tried changing the lacing, creating a for loop around the loop wich apply’s the attached detail groups and tried using a single view group and detail group combination that should’ve worked, None of them worked. I checked my revit verson and I am running Revit 2019.2.


Edit: don’t pay atention to the annotations above the custom nodes, that was from when i thought it wouldn’t work in revit 2019.

The reason why it does not work is in the description of the Node.

2020-06-24_17-54-57

It is set up to do 1 Detail Group each for Multiple Model Groups in 1 View. Check the link earlier in the topic for my example script. I’ve set it up this way for my own workflows where I control the Annotations in a master plan and all the unit plans are dependant views from that plan.

It looks like you want to do 1 Detail Group in 1 Model Group in 1 View each, so you should alter the Python code. This should work:

import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

modelGroups = UnwrapElement(IN[0])
detailGroups = UnwrapElement(IN[1])
views = UnwrapElement(IN[2])

doc = DocumentManager.Instance.CurrentDBDocument

TransactionManager.Instance.EnsureInTransaction(doc)

for m,d,v in zip(modelGroups,detailGroups,views):
	m.ShowAttachedDetailGroups(v,d.Id)
	
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = IN[0]
1 Like

@Bjorn_Keulemans1

This is what i need also (need to turn them off again later, hence my previous question).
I replaced the Python code with the code in the above post, but it doesn’t work.
Am i doing something wrong?

PS
I am using Revit 2019.2.

The code above was for 1 Model Group - 1 Detail Group in 1 View EACH. Not the same view, it expects a list of views.

Your case look like my original use case where I control the Detail Groups in 1 View for multiple Model Groups. You might want to take a look at the original version.

You can probably also fix this by List.Count and List.OfRepeatedItem to make a list of your View the same length as the others.

I’ve been struggling with the different use cases for this workflow and how to catch all of those without demanding insane list structures from the users.

Is it a lot of MG with 1 DG each in 1 view, is it multiple MG with multiple each in 1 view, is it multiple MG with 1 different DG in different Views etc. Someone a lot more experienced in Python can probably handle that a lot better.

Thanks for your reply.

Tried the List and Repeat solution you suggested, but that didn’t do the trick either.

I fiddle around a bit more and see if i can get something to work (which suits my needs).

To answer your question. I have a bunch of apartments on multiple levels and in multiple buidlings (in the same model). I need to make a View for every apartment (i already made a script for that) and need to turn on the attached Detail Group for each of those Views. Some Views will have the same apartment (type) but are on a different level and / or building.

1 Like

Got it to work using this.

What did you do for list mangagement? Because i run into the same problem that “views are not itterable”.

@Cas

This worked for my case (at least in my test project).

The script expects a list of Views, you are probably giving it 1 View.

@bvs1982 Thanks!

@Bjorn_Keulemans1 First I tried your suggested code,

and when that didn’t work I tried changing it to make the for loop inside a for loop:

TransactionManager.Instance.EnsureInTransaction(doc)

for i in views:
    for m,d in zip(modelGroups,detailGroups):
	    m.ShowAttachedDetailGroups(i,d.Id)
	
TransactionManager.Instance.TransactionTaskDone()

That didn’t work eighter… So I think it has something to do with my list management.

What I want it to do is make DG with te prefix UO- show in all floorplans I specify.

Because your View is only 1 View you cannot make a for loop.

for m,d in zip(modelGroups,detailGroups):
         m.ShowAttachedDetailGroups(views,d.Id)

Did not test this, but this would be the first thing I would try.

I don’t know what you wanna achieve, but in my case i have;

1 View with 1 Group i can turn on (or off) a Attached Detail Group for.

With a small change i can turn on (or off) a Attached Detail Group for multiple Groups in 1 View.

.

My guess is that your issue is that your groups aren’t filtered per View.