<?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 Re: How do i get edit a Property? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-do-i-get-edit-a-Property/m-p/353484#M1585</link>
    <description>&lt;P&gt;Hi Dayiz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may just need to encapsulate in an 'Undo' session.. this has got me a few times.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;DIV&gt;ACAPI_CallUndoableCommand ("your command name",[&amp;amp;] () -&amp;gt; GSErrCode&lt;/DIV&gt;&lt;DIV&gt;// code in here..&lt;/DIV&gt;&lt;P&gt;});&lt;/P&gt;</description>
    <pubDate>Fri, 19 Aug 2022 22:16:53 GMT</pubDate>
    <dc:creator>Ben Cohen</dc:creator>
    <dc:date>2022-08-19T22:16:53Z</dc:date>
    <item>
      <title>How do i get edit a Property?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-do-i-get-edit-a-Property/m-p/353343#M1584</link>
      <description>&lt;P&gt;Dear Graphisoft-Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently trying to build my first C++ AddOn, but I'm struggeling a bit.&lt;/P&gt;&lt;P&gt;I'm trying to set a property for selected elements, but the part where I set doesn't seem to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current code looks/works somewhat like this:&lt;/P&gt;&lt;P&gt;1) I get the selected Elements with&amp;nbsp;ACAPI_Selection_Get&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;P&gt;static void getSelectedElements(GS::Array&amp;lt;API_Neig&amp;gt;&amp;amp; selNeigs)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; GSErrCode err;&lt;BR /&gt;&amp;nbsp; API_SelectionInfo selectionInfo;&lt;/P&gt;&lt;P&gt;&amp;nbsp; err = ACAPI_Selection_Get(&amp;amp;selectionInfo, &amp;amp;selNeigs, true);&lt;BR /&gt;}&lt;/P&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;2) Looking for the Property I want to edit (2 Steps)&lt;/P&gt;&lt;P&gt;This method finds the wanted PropertyGroup by its name&lt;/P&gt;&lt;LI-SPOILER&gt;static void findPropertyGroupByName(GS::UniString name, API_PropertyGroup&amp;amp; target)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; GS::Array&amp;lt;API_PropertyGroup&amp;gt; propertyGroups;&lt;BR /&gt;&amp;nbsp; GSErrCode err{ ACAPI_Property_GetPropertyGroups(propertyGroups) };&lt;BR /&gt;&amp;nbsp; std::list&amp;lt;GS::UniString&amp;gt; groups;&lt;BR /&gt;&amp;nbsp; if (err == NoError)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for (API_PropertyGroup pg : propertyGroups)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (pg.name == name)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; target = pg;&lt;BR /&gt;}&lt;/LI-SPOILER&gt;&lt;P&gt;This method above gets used in the following:&lt;/P&gt;&lt;LI-SPOILER&gt;static void findPropertyDefinition(API_PropertyDefinition&amp;amp; propertyDefinition)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; GSErrCode err;&lt;BR /&gt;&amp;nbsp; GS::UniString groupName{ "Identifizierung" };&lt;BR /&gt;&amp;nbsp; GS::UniString propertyName{ "Bezeichnung" };&lt;BR /&gt;&amp;nbsp; GS::Array &amp;lt;API_PropertyDefinition&amp;gt; propDefs;&lt;BR /&gt;&amp;nbsp; API_PropertyGroup propertyGroup;&lt;BR /&gt;&amp;nbsp; findPropertyGroupByName(groupName, propertyGroup);&lt;BR /&gt;&amp;nbsp; err = ACAPI_Property_GetPropertyDefinitions(propertyGroup.guid, propDefs);&lt;BR /&gt;&amp;nbsp; for (API_PropertyDefinition pd : propDefs)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if (pd.name == propertyName)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; propertyDefinition = pd;&lt;BR /&gt;}&lt;/LI-SPOILER&gt;&lt;P&gt;propertyDefintion will then have the information for our user-defined property ["Identifizierung","Bezeichnung"]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the selected Neigs and the propertyDefinition accuired i wanted to use&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;ACAPI_Element_GetPropertyValue(neig.guid, propertyDefinition.guid, property);&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;to get the property of the Element and edit it&lt;/P&gt;&lt;LI-SPOILER&gt;property.isDefault = false;&lt;BR /&gt;property.value.variantStatus = API_VariantStatusUserUndefined;&lt;BR /&gt;property.definition.collectionType = API_PropertySingleCollectionType;&lt;BR /&gt;property.definition.valueType = API_PropertyStringValueType;&lt;BR /&gt;property.definition.canValueBeEditable = true;&lt;BR /&gt;property.value.singleVariant.variant.uniStringValue = GS::ValueToUniString(i);&lt;BR /&gt;&lt;BR /&gt;//i is an int which gets iterated everytime a new neig is selected through&amp;nbsp;for (API_Neig neig : selNeigs), so the first one gets 1, the second 2 and so forth&lt;/LI-SPOILER&gt;&lt;P&gt;but after I call&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;ACAPI_Element_SetProperty(neig.guid, property);&lt;/LI-SPOILER&gt;&lt;P&gt;none of the selected Elements have a changed their value of Bezeichnung.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So how can i edit a property of an element? What am i missing?&lt;/P&gt;&lt;P&gt;And on a side note, this my very first AC/C++ AddOn, so if you get any recommendations for my code (readability, performance or general things) those are much appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 12:44:52 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-do-i-get-edit-a-Property/m-p/353343#M1584</guid>
      <dc:creator>Dayiz</dc:creator>
      <dc:date>2022-08-18T12:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do i get edit a Property?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-do-i-get-edit-a-Property/m-p/353484#M1585</link>
      <description>&lt;P&gt;Hi Dayiz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may just need to encapsulate in an 'Undo' session.. this has got me a few times.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;DIV&gt;ACAPI_CallUndoableCommand ("your command name",[&amp;amp;] () -&amp;gt; GSErrCode&lt;/DIV&gt;&lt;DIV&gt;// code in here..&lt;/DIV&gt;&lt;P&gt;});&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 22:16:53 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-do-i-get-edit-a-Property/m-p/353484#M1585</guid>
      <dc:creator>Ben Cohen</dc:creator>
      <dc:date>2022-08-19T22:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do i get edit a Property?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-do-i-get-edit-a-Property/m-p/353942#M1586</link>
      <description>&lt;P&gt;Hello Ben,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks four your help, i tried it out and encapsulated the important bits of the addon:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cap.PNG" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/29174iBCFD301B4D2F4A1A/image-size/large?v=v2&amp;amp;px=999" role="button" title="cap.PNG" alt="cap.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the method "numberBezeichnung()" then gets called in MenuCommandHandler.&lt;/P&gt;&lt;P&gt;But when i execute the AddOn, no values get changed. To check if my selection works i added the line&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;DG::InformationAlert(GS::ValueToUniString(selNeigs.GetSize()), "", "Ok");&lt;/P&gt;&lt;P&gt;which returns me after executing the addon the amount of the selected elements, which works.&lt;/P&gt;&lt;P&gt;Any idea why that still happens?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2022 14:17:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-do-i-get-edit-a-Property/m-p/353942#M1586</guid>
      <dc:creator>Dayiz</dc:creator>
      <dc:date>2022-08-24T14:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do i get edit a Property?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-do-i-get-edit-a-Property/m-p/354710#M1587</link>
      <description>&lt;P&gt;For anyone with the same problem as me:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I used the wrong method.&lt;/P&gt;&lt;P&gt;I started using&amp;nbsp;ACAPI_ElementList_ModifyPropertyValue() which resulted in change&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 09:57:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-do-i-get-edit-a-Property/m-p/354710#M1587</guid>
      <dc:creator>Dayiz</dc:creator>
      <dc:date>2022-08-31T09:57:27Z</dc:date>
    </item>
  </channel>
</rss>

