<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to Create a Property Using Add-ons in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-Create-a-Property-Using-Add-ons/m-p/662606#M10348</link>
    <description>&lt;P class=""&gt;Hi all,&lt;BR /&gt;I'm using Archicad API 22 and I want to create a group and a property for the entire model, as shown in the image below:&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NMK195_2-1747305435044.png" style="width: 799px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/86936i507032E85AE13E39/image-dimensions/799x471?v=v2" width="799" height="471" role="button" title="NMK195_2-1747305435044.png" alt="NMK195_2-1747305435044.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;I found the example property_Test, but it only creates a property for the selected object, not for the entire model. I’ve tried modifying it, but haven’t been successful.&lt;BR /&gt;Can anyone help me with this?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;	API_PropertyGroup group;
	ASSERT_NO_ERROR (PropertyTestHelpers::GetCommonExamplePropertyGroup (group));

	API_PropertyDefinition definition;
	definition = PropertyTestHelpers::CreateExampleIntPropertyDefinition (group);
	// ACAPI_ElementList_AddProperty creates the property definition, if it doesn't exist yet
	ASSERT_NO_ERROR (ACAPI_ElementList_AddProperty (definition, PropertyTestHelpers::GetSelectedElements()));
	ASSERT (definition.guid != APINULLGuid);

	// It works for already existing properties too
	ASSERT_NO_ERROR (ACAPI_ElementList_AddProperty (definition, PropertyTestHelpers::GetSelectedElements()));&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NMK195_1-1747305409639.png" style="width: 799px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/86935i015763127558A9CD/image-dimensions/799x471?v=v2" width="799" height="471" role="button" title="NMK195_1-1747305409639.png" alt="NMK195_1-1747305409639.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 May 2025 18:38:05 GMT</pubDate>
    <dc:creator>NMK195</dc:creator>
    <dc:date>2025-05-16T18:38:05Z</dc:date>
    <item>
      <title>How to Create a Property Using Add-ons</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-Create-a-Property-Using-Add-ons/m-p/662606#M10348</link>
      <description>&lt;P class=""&gt;Hi all,&lt;BR /&gt;I'm using Archicad API 22 and I want to create a group and a property for the entire model, as shown in the image below:&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NMK195_2-1747305435044.png" style="width: 799px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/86936i507032E85AE13E39/image-dimensions/799x471?v=v2" width="799" height="471" role="button" title="NMK195_2-1747305435044.png" alt="NMK195_2-1747305435044.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;I found the example property_Test, but it only creates a property for the selected object, not for the entire model. I’ve tried modifying it, but haven’t been successful.&lt;BR /&gt;Can anyone help me with this?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;	API_PropertyGroup group;
	ASSERT_NO_ERROR (PropertyTestHelpers::GetCommonExamplePropertyGroup (group));

	API_PropertyDefinition definition;
	definition = PropertyTestHelpers::CreateExampleIntPropertyDefinition (group);
	// ACAPI_ElementList_AddProperty creates the property definition, if it doesn't exist yet
	ASSERT_NO_ERROR (ACAPI_ElementList_AddProperty (definition, PropertyTestHelpers::GetSelectedElements()));
	ASSERT (definition.guid != APINULLGuid);

	// It works for already existing properties too
	ASSERT_NO_ERROR (ACAPI_ElementList_AddProperty (definition, PropertyTestHelpers::GetSelectedElements()));&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NMK195_1-1747305409639.png" style="width: 799px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/86935i015763127558A9CD/image-dimensions/799x471?v=v2" width="799" height="471" role="button" title="NMK195_1-1747305409639.png" alt="NMK195_1-1747305409639.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 18:38:05 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-Create-a-Property-Using-Add-ons/m-p/662606#M10348</guid>
      <dc:creator>NMK195</dc:creator>
      <dc:date>2025-05-16T18:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create a Property Using Add-ons</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-Create-a-Property-Using-Add-ons/m-p/662713#M10353</link>
      <description>&lt;P&gt;I think the code you want is in the &lt;EM&gt;Property_Text&lt;/EM&gt; example. Take a look at the function&amp;nbsp;&lt;EM&gt;SimpleTestPropertyDefinitions()&lt;/EM&gt; in the file &lt;EM&gt;Property_Test.cpp&lt;/EM&gt;, specifically where it calls&amp;nbsp;&lt;EM&gt;ACAPI_Property_CreatePropertyDefinition&lt;/EM&gt; to create a new property definition.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 10:18:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-Create-a-Property-Using-Add-ons/m-p/662713#M10353</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2025-05-16T10:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create a Property Using Add-ons</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-Create-a-Property-Using-Add-ons/m-p/663087#M10370</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;Thank you for answering my question, but I still haven't been able to do it. Could you help me by adjusting the code below?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;void CreateProperty(API_PropertyGroup group, GS::UniString str, GS::Array&amp;lt;API_Guid&amp;gt; listElement)
{
	GS::Array&amp;lt;API_PropertyDefinition&amp;gt; defs;
	if (ACAPI_Property_GetPropertyDefinitions(group.guid, defs) != NoError) {
		DBPrintf("Cannot retrieve existing property definitions.\n");
		return;
	}
	for (auto&amp;amp; d : defs) {
		if (d.name == str) {
			DBPrintf("Definition \"%ls\" already exists—no need to recreate.\n",
				str.ToCStr());
			return;
		}
	}

	API_PropertyDefinition definition;
	definition.guid = APINULLGuid;
	definition.groupGuid = group.guid;
	definition.name = str;
	definition.description = str;

	definition.collectionType = API_PropertySingleCollectionType;
	definition.valueType = API_PropertyStringValueType;
	definition.measureType = API_PropertyDefaultMeasureType;
	definition.defaultValue.basicValue.singleVariant.variant.type = definition.valueType;
	definition.defaultValue.basicValue.singleVariant.variant.uniStringValue = "";

	ASSERT_NO_ERROR(ACAPI_ElementList_AddProperty(definition, listElement));
	ASSERT(definition.guid != APINULLGuid);

	// It works for already existing properties too
	ASSERT_NO_ERROR(ACAPI_ElementList_AddProperty(definition, listElement));

}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 May 2025 05:18:05 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-Create-a-Property-Using-Add-ons/m-p/663087#M10370</guid>
      <dc:creator>NMK195</dc:creator>
      <dc:date>2025-05-21T05:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create a Property Using Add-ons</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-Create-a-Property-Using-Add-ons/m-p/663179#M10371</link>
      <description>&lt;P&gt;The Archicad 22 API is a bit too old for me - I no longer have it installed. Are you able to work with anything more recent?&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2025 14:07:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-Create-a-Property-Using-Add-ons/m-p/663179#M10371</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2025-05-21T14:07:31Z</dc:date>
    </item>
  </channel>
</rss>

