The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (API DevKit) for independent software developers

Moderators: ejrolon, Barry Kelly, Karl Ottenstein, LaszloNagy, gkmethy, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik, Tibor Lorántfy, rmasaki

#306607
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