Archicad C++ API
About Archicad add-on development using the C++ API.

[SOLVED] Differentiate between Element and Hotlink Group?

Erenford
Booster
How do you tell if the element is grouped by the user or is merely just inside a hotlink module? What I use is if there is a groupGuid value present although hotlinked elems also have a groupGuid and are being considered by ACAPI_ElementGroup_GetGroupedElems as a legit group even if they weren't grouped by the user and are just part of a hotlink.

Using ACAPI_ElementGroup_GetGroupedElems(groupGuid):
- Grouped elems (hotlinked or not) returns their immediate elems => this is what I need
- Non-grouped non-hotlinked elems have no groupGuid thus ignored => also ok
- Non-grouped hotlinked elems have a groupGuid and will return immediate elems (all fellow hotlinked elems) => not ok, I don't need this

Basically what I need are elements that are grouped only by the user regardless if its in a hotlink module or not, and any non-grouped elems (hotlinked and otherwise) should be ignored. Any Ideas?
Archicad 25 5010 INT FULL
Archicad 26 5002 INT FULL
Visual Studio Professional 2019
Win 10 Pro 64-bit
2 REPLIES 2
Akos Somorjai
Graphisoft
Graphisoft
Erenford wrote:
How do you tell if the element is grouped by the user or is merely just inside a hotlink module? What I use is if there is a groupGuid value present although hotlinked elems also have a groupGuid and are being considered by ACAPI_ElementGroup_GetGroupedElems as a legit group even if they weren't grouped by the user and are just part of a hotlink.

Using ACAPI_ElementGroup_GetGroupedElems(groupGuid):
- Grouped elems (hotlinked or not) returns their immediate elems => this is what I need
- Non-grouped non-hotlinked elems have no groupGuid thus ignored => also ok
- Non-grouped hotlinked elems have a groupGuid and will return immediate elems (all fellow hotlinked elems) => not ok, I don't need this

Basically what I need are elements that are grouped only by the user regardless if its in a hotlink module or not, and any non-grouped elems (hotlinked and otherwise) should be ignored. Any Ideas?
Hotlinked elements also have the hotlinkGuid member set in their element header, whereas user-grouped elements don't.

Best, Ákos
Erenford
Booster
Akos wrote:
Hotlinked elements also have the hotlinkGuid member set in their element header, whereas user-grouped elements don't.

Best, Ákos
Yes, but what I'm having problems with is when it is BOTH grouped and hotlinked. For example:
1) Elems were user-grouped on its original project (lets say its P1)
2) On another project, P2, the project P1 is then hotlinked
3) On P2, elems will now have both valid hotlinkGuid and groupGuid in their headers.


Anyway, I've managed to get a workaround for this issue by comparing the number of levels of the group tree (using groupGuid and a while-looped ACAPI_ElementGroup_GetGroup) and the level number of the hotlink node (using hotlinkGuid and ACAPI_Database() APIDb_GetHotlinkRootNodeGuidID, APIDb_GetHotlinkNodeTreeID, etc).
If they're equal, then its a normal hotlinked elem. If group level is greater, means the elem is user-grouped (if the difference is 1 then it's user-grouped only once, greater than 1 means it's user-grouped multiple times).
Archicad 25 5010 INT FULL
Archicad 26 5002 INT FULL
Visual Studio Professional 2019
Win 10 Pro 64-bit