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

Edit Hotlink Master ID

Dayiz
Booster

Dear Graphisoft Community,

 

I'm trying to write an AddOn which changes the Hotlink Master ID, but im having trouble to find the property for hotlink elements. Neither the hotlink node nor the hotlink elements seem to have the value.

So i was wondering if someone here knows how to access the Hotlink Master ID and edit it idealy.

Thanks for any Help!

 

Kind Regards

Dayiz

2 REPLIES 2
Dayiz
Booster

A bit more Information:

i was able to find the property (it is a built in property) and if i select an element, get it and then proceed to get the property, i can receive the Hotlink Master-ID. But for some reason I'm not able to set it.

So another question: am I able to edit built in properties with c++ addons?

My Code:

Spoiler
API_SelectionInfo selI;
GS::Array<API_Neig> neig;
ACAPI_Selection_Get(&selI, &neig, false);
if(neig.GetSize() == 0)
{
   break;
}
API_Element elem;
elem.header.guid = neig.GetFirst().guid;
ACAPI_Element_Get(&elem);
Toolbox tb;
API_PropertyDefinition propDef;
tb.findPropertyDefinition(propDef, "Hotlink Master-ID", "ID und Kategorien");
API_Property propValue;
ACAPI_Element_GetPropertyValue(elem.header.guid, propDef.guid, propValue);
API_Property newPropValue;
newPropValue.definition = propValue.definition;
newPropValue.value.singleVariant.variant.type = propValue.definition.valueType;
newPropValue.value.singleVariant.variant.uniStringValue = (GS::UniString)"Renamed MasterID";
newPropValue.isDefault = false;
GS::Array<API_Guid> guidList;
guidList.Push(elem.header.guid);
ACAPI_ElementList_ModifyPropertyValue(newPropValue, guidList);
ACAPI_Element_SetProperty(elem.header.guid, newPropValue);

I tried to set the value with SetProperty and ModifyPropertyList, both didn't work. My guess is, that the Hotlink-Master ID is saved somewhere else and the property of the element just points to the value. But how can i edit that value? Where is it saved?

So i digged a bit deeper and found the following:

quellcode.PNG

As it seems, the Master-ID is saved at filler_3 (to my surprise, there is no mention of it in https://archicadapi.Graphisoft.com/documentation/api_hotlinktype ).
So I converted it to a string and tried to print it out with DG::InformationAlert, but i only receive an empty string. Why does it behave that way? Where is the master-id saved? I'm so confused and there are no ressources that cover the master-id