Can someone tell me, please, how I can find out if a Group (Type) has an Attached Detail Group (Type) via the API?
Thanks.
Dear Aminius,
I am enquiring with the development team for you.
Best regards,
Jeremy
Hi,
a Group of Category OST_IOSAttachedDetailGroups has a BuiltInParameter.GROUP_ATTACHED_PARENT_NAME.
This way, you will find matching Model groups.
Best regards,
Revitalizer
Thanks for the answer.
So this would mean that instead of just "asking" a Group Abc for its Attached Detail Groups, I'd have to go over all groups of the right category in the project and check if their parent is group Abc... right?
Well I guess I could do that, just seems a bit complicated. I mean, how comes that an element knows its parent but not its children (or not even if it has children in the first place, which would suffice to know in my case)?
Hi Aminius,
I usually create Dictionaries to store relationships like these so I can access them quickly when needed.
Another point:
As you can see, this parameter is of type string; I wonder why they store names instead of IDs.
I don't know why...
Best regards,
Revitalizer
Dear Aminius,
Sorry I did not reply earlier.
I never did receive a reply on this from the development team.
Many relationships and tips and tricks like this are actually not known by us, and the real experts are other peer developer colleagues of yours, like Revitalizer.
The approach described by him actually corresponds exactly to the standard way of storing relationships in Revit.
For instance, a door or window hosted by a wall maintains a pointer to the hosting wall via the Element.Host property.
The inverse relationship is not available directly from the API, which is why one of the very early discussions on The Building Coder discusses the issue of implementing a dictionary as suggested by Revitalizer to determine the inverse relationship from host to hosted elements:
http://thebuildingcoder.typepad.com/blog/2008/10/relationship-in.html
In fact, that is blog post number 16 from 2008 🙂
It makes sense for the Revit model to store the relationship one way only, not both ways, to minimise the model data, possibilities for errors and synchronisation issues.
I hope this helps explain.
Best regards,
Jeremy
Hi guys,
I summarised this discussion on The Building Coder:
Thank you!
Cheers,
Jeremy