Check for Attached Detail Group

Check for Attached Detail Group

Aminius
Enthusiast Enthusiast
1,186 Views
9 Replies
Message 1 of 10

Check for Attached Detail Group

Aminius
Enthusiast
Enthusiast

Can someone tell me, please, how I can find out if a Group (Type) has an Attached Detail Group (Type) via the API?

 

Thanks.

 

0 Likes
1,187 Views
9 Replies
Replies (9)
Message 2 of 10

jeremytammik
Autodesk
Autodesk

Dear Aminius,

 

I am enquiring with the development team for you.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 10

Aminius
Enthusiast
Enthusiast

Cool, thanks. 🙂

0 Likes
Message 4 of 10

Aminius
Enthusiast
Enthusiast

Any news on this?

0 Likes
Message 5 of 10

Revitalizer
Advisor
Advisor

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




Rudolf Honke
Software Developer
Mensch und Maschine





Message 6 of 10

Aminius
Enthusiast
Enthusiast

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)?

 

 

 

0 Likes
Message 7 of 10

Revitalizer
Advisor
Advisor

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

 




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 8 of 10

Aminius
Enthusiast
Enthusiast

Good question indeed...

 

Once again thanks for the answer! 🙂

0 Likes
Message 9 of 10

jeremytammik
Autodesk
Autodesk

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



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 10 of 10

jeremytammik
Autodesk
Autodesk

Hi guys,

 

I summarised this discussion on The Building Coder:

 

http://thebuildingcoder.typepad.com/blog/2014/10/attached-detail-groups-and-inverse-relationships.ht...

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder