Guid of Favorite, and set default classification
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-02-06
03:33 PM
- last edited on
2023-07-04
01:59 PM
by
Doreena Deng
2020-02-06
03:33 PM
Hello,
I got the default element guid like this:
GS::Array<GS::Pair<API_Guid, API_Guid>> systemItemPairs;
ACAPI_Element_GetClassificationItemsDefault(typeID, variationID, systemItemPairs);
for (auto i = systemItemPairs.Begin(); i != systemItemPairs.End(); ++i) {
system.guid = i->first;
item.guid = i->second;
ACAPI_WriteReport("\nsystem guid: %d\n item guid: %d\n", false, system.guid, item.guid);
}
Not able to get the guid of a favorite. Trying like this:
GS::UniString favName;
favName = "myFav";
API_Favorite favorite (favName);
API_Element& favElement = favorite.element;
ACAPI_WriteReport("favElement.header.guid: %d", false, favElement.header.guid);
The above code outputs the guid as 0.
Tried to get the systemItemPair of the favorite like this:
ACAPI_Element_GetClassificationItems(favElement.header.guid, favorite.classifications.Get());
and fed it into the for-loop like for default, it gave out a huge list of pairs instead of just one for the favorite in question.
I am able to clear the default Classification:
ACAPI_Element_RemoveClassificationItemDefault(typeID, variationID, item.guid);
But the default Classification is not getting set by:
ACAPI_Element_AddClassificationItemDefault(typeID, variationID, favElement.header.guid);
Possibly because this guid is 0.
What am I doing wrong?
Please help!
Thanks,
Dushyant
I got the default element guid like this:
GS::Array<GS::Pair<API_Guid, API_Guid>> systemItemPairs;
ACAPI_Element_GetClassificationItemsDefault(typeID, variationID, systemItemPairs);
for (auto i = systemItemPairs.Begin(); i != systemItemPairs.End(); ++i) {
system.guid = i->first;
item.guid = i->second;
ACAPI_WriteReport("\nsystem guid: %d\n item guid: %d\n", false, system.guid, item.guid);
}
Not able to get the guid of a favorite. Trying like this:
GS::UniString favName;
favName = "myFav";
API_Favorite favorite (favName);
API_Element& favElement = favorite.element;
ACAPI_WriteReport("favElement.header.guid: %d", false, favElement.header.guid);
The above code outputs the guid as 0.
Tried to get the systemItemPair of the favorite like this:
ACAPI_Element_GetClassificationItems(favElement.header.guid, favorite.classifications.Get());
and fed it into the for-loop like for default, it gave out a huge list of pairs instead of just one for the favorite in question.
I am able to clear the default Classification:
ACAPI_Element_RemoveClassificationItemDefault(typeID, variationID, item.guid);
But the default Classification is not getting set by:
ACAPI_Element_AddClassificationItemDefault(typeID, variationID, favElement.header.guid);
Possibly because this guid is 0.
What am I doing wrong?
Please help!
Thanks,
Dushyant
Labels:
- Labels:
-
Add-On (C++)
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-03-20 04:39 PM
2020-03-20
04:39 PM
Hey,
You can get a Favorite by:
http://archicadapi.graphisoft.com/documentation/api_favorite
Does it help your other problem?
You can get a Favorite by:
API_Favorite favorite; favorite.name = "myFav"; ACAPI_Favorite_Get (&favorite);You can read more about favorites here:
Does it help your other problem?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-03-21 10:20 AM
2020-03-21
10:20 AM
Hi, thanks for your reply.
It had got fixed by adding the following:
favorite.classifications.New();
It had got fixed by adding the following:
favorite.classifications.New();