cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
Dayiz
Booster

Edit Hotlink Master ID

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

1 Solution

Accepted Solutions

I think the comment at filler_3 is a mistake. All fields prefixed with 'filler' are only padding to maintain the structure size and byte alignment - they never contain data and will probably be filled with zeros by default (hence appearing to be an empty string).

 

The listing ID for an element (element info string) is now held in API_ElementMemo::elemInfoString. You can write changes to the memo structure with ACAPI_Element_Change, but be careful to set the mask for this value accordingly. I haven't tried (because I've never had to set the master ID) but I assume this is also true for API_HotlinkType elements.

 

Note that you can read the element info string by calling ACAPI_Element_GetElementInfoString. You can also read the combination of master ID and element info string with ACAPI_Element_GetCompoundInfoString, so you could deduce the master ID by stripping the element info from the compound info.

Ralph Wessel BArch
Central Innovation

Go to post

6 Replies 6
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:

 

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?

Dayiz
Booster

So, I dug 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

cagarruta
Booster

I´m with you, years dealing with this issues and always I ending hand crafting. 

¿have you got the correct script?

 

thanks

Archicad 25 SPA v6000

i9 14900K/32 Gb DDR4/1TB SSD/10GBPS Lan/Windows 11 PRO
Laszlo Nagy
Community Admin
Community Admin

If you select a placed Hotlink in Archicad, right-click and go to the Hotlink Settings Dialog, is the Master ID field filled out with some value? Because if it is not, there is only an empty string that the API can return.

Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac29

I think the comment at filler_3 is a mistake. All fields prefixed with 'filler' are only padding to maintain the structure size and byte alignment - they never contain data and will probably be filled with zeros by default (hence appearing to be an empty string).

 

The listing ID for an element (element info string) is now held in API_ElementMemo::elemInfoString. You can write changes to the memo structure with ACAPI_Element_Change, but be careful to set the mask for this value accordingly. I haven't tried (because I've never had to set the master ID) but I assume this is also true for API_HotlinkType elements.

 

Note that you can read the element info string by calling ACAPI_Element_GetElementInfoString. You can also read the combination of master ID and element info string with ACAPI_Element_GetCompoundInfoString, so you could deduce the master ID by stripping the element info from the compound info.

Ralph Wessel BArch
Central Innovation
Akos Somorjai
Graphisoft
Graphisoft

Hi,

 

The comment is not valid any more; filler_3 used to contain the master ID when it was not filler_3 🙂

 

Best, Akos

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!