We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Element ID and other old Properties

Anonymous
Not applicable
I have quite a simple question. But I really could find a simple solution in the documentation. I have check Element and Memo structure and it's not there.

I would like to access element ID and also other Properties which are older than properties like: structural function, position. How can I do it?
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
leilei
Enthusiast
kzaremba wrote:
I have quite a simple question. But I really could find a simple solution in the documentation. I have check Element and Memo structure and it's not there.

I would like to access element ID and also other Properties which are older than properties like: structural function, position. How can I do it?
Hi,
The element id is elemInfoString in memo.You can find what you want in the Do_DumpElem function in the Element_baseic.cpp

View solution in original post

4 REPLIES 4
Solution
leilei
Enthusiast
kzaremba wrote:
I have quite a simple question. But I really could find a simple solution in the documentation. I have check Element and Memo structure and it's not there.

I would like to access element ID and also other Properties which are older than properties like: structural function, position. How can I do it?
Hi,
The element id is elemInfoString in memo.You can find what you want in the Do_DumpElem function in the Element_baseic.cpp
Anonymous
Not applicable
leilei wrote:
elemInfoString
Thanks a lot, I would never found it out Do you have any clue how to access other parameters like position, structural function?

I mean time I did a workaround and put ID into the property with an expression. Probably we will do it with other properties and kind of skip using those old props.
leilei
Enthusiast
Hi,
You can see this in Element_Test example.

// -----------------------------------------------------------------------------
// Dump element category value
// -----------------------------------------------------------------------------
void		Do_DumpElemCategoryValue (const API_ElemCategoryValue& elemCategoryValue)
{
	WriteReport ("   %s   : %s (%s)", GS::UniString (elemCategoryValue.category.name).ToCStr ().Get (), GS::UniString (elemCategoryValue.name).ToCStr ().Get (), APIGuidToString (elemCategoryValue.guid).ToCStr ().Get ());
}


// -----------------------------------------------------------------------------
// Dump element's categories
// -----------------------------------------------------------------------------
void		Do_DumpElemCategories (const API_Guid& elemGuid, const API_ElemTypeID& typeID, const API_ElemVariationID& variationID, bool dumpDefaults)
{
	GSErrCode			err = NoError;

	GS::Array<API_ElemCategory> categoryList;
	ACAPI_Database (APIDb_GetElementCategoriesID, &categoryList);

	categoryList.Enumerate ([&] (const API_ElemCategory& category) {
		if (category.categoryID != API_ElemCategory_BRI) {
			API_ElemCategoryValue	elemCategoryValue;

			if (dumpDefaults) {
				err = ACAPI_Element_GetCategoryValueDefault (typeID, variationID, category, &elemCategoryValue);
				if (err == NoError)
					Do_DumpElemCategoryValue (elemCategoryValue);
				else
					ErrorBeep ("ACAPI_Element_GetCategoryValueDefault ()", err);
			} else {
				err = ACAPI_Element_GetCategoryValue (elemGuid, category, &elemCategoryValue);
				if (err == NoError)
					Do_DumpElemCategoryValue (elemCategoryValue);
				else
					ErrorBeep ("ACAPI_Element_GetCategoryValue ()", err);
			}
		}
	});
}
Anonymous
Not applicable
Thanks a lot. I saw it but when I saw name Categories i thought it Zone related function. Thanks for the right direction.