<?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 Python and property manager option sets in Archicad Python API</title>
    <link>https://community.graphisoft.com/t5/Archicad-Python-API/Python-and-property-manager-option-sets/m-p/308168#M836</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have been learning to use Python for some time to enter data for various elements in Archicad.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Now, however, the question has arisen for me about the option sets which can be found and created in the property manager.&amp;nbsp; Is there a way to set predefined value which are located in option sets for elements by using Python?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 1: There is an self created option set called "Wall type" that contains options "Unspecified (this acts as an default value)", "Type 1", "Type 2" and "Type 3". I would like to set this property value in every wall to "Type 3".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 2: There is an self created option set called "Furniture definition set" that contains options "Def. 1", "Def. 2" and "Def. 3" and "allow multiple choices" is on. I would like to set this value in every furniture that is classified to "chair" to "Def. 1" and "Def. 2".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to implement either example at the moment by using Python in Archicad and what kind of code it would need to work right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Oct 2021 11:51:45 GMT</pubDate>
    <dc:creator>JT1986</dc:creator>
    <dc:date>2021-10-04T11:51:45Z</dc:date>
    <item>
      <title>Python and property manager option sets</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Python-and-property-manager-option-sets/m-p/308168#M836</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have been learning to use Python for some time to enter data for various elements in Archicad.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Now, however, the question has arisen for me about the option sets which can be found and created in the property manager.&amp;nbsp; Is there a way to set predefined value which are located in option sets for elements by using Python?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 1: There is an self created option set called "Wall type" that contains options "Unspecified (this acts as an default value)", "Type 1", "Type 2" and "Type 3". I would like to set this property value in every wall to "Type 3".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 2: There is an self created option set called "Furniture definition set" that contains options "Def. 1", "Def. 2" and "Def. 3" and "allow multiple choices" is on. I would like to set this value in every furniture that is classified to "chair" to "Def. 1" and "Def. 2".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to implement either example at the moment by using Python in Archicad and what kind of code it would need to work right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 11:51:45 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Python-and-property-manager-option-sets/m-p/308168#M836</guid>
      <dc:creator>JT1986</dc:creator>
      <dc:date>2021-10-04T11:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Python and property manager option sets</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Python-and-property-manager-option-sets/m-p/314016#M837</link>
      <description>&lt;P&gt;Situation update: I was able to get value type out from the option set with the script below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from Archicad import ACConnection
import Archicad
import sys

from Archicad.releases.ac25.b3000types import ElementId
from enum import Enum
conn = ACConnection.connect()

assert conn

acc = conn.commands
act = conn.types
acu = conn.utilities

elements = acc.GetElementsByType('Zone')
BuildingId = acu.GetUserDefinedPropertyId('BUILDING INFORMATION','BELONGS TO THE BUILDING')
zoneNumberId = acu.GetBuiltInPropertyId('Zone_ZoneNumber')
value1 =acc.GetPropertyValuesOfElements(elements,[BuildingId])
value2 =acc.GetDetailsOfProperties([BuildingId])
value3 =acc.GetPropertyValuesOfElements(elements,[zoneNumberId])


PropListArray = []
for index,element in enumerate(elements):
    element = element.elementId
    Buildinginfo1 = str(value1[index].propertyValues[0].propertyValue.value.displayValue)
    Numberinfo = str(value3[index].propertyValues[0].propertyValue.value)
    print(Numberinfo, "Current value is:", Buildinginfo1)

print("------------")

PropListArray2 = []
for index,element in enumerate(elements):
    element = element.elementId
    Buildinginfo2 = str(value2[0].propertyDefinition.possibleEnumValues)
    str1=Buildinginfo2
    def replaceText(str1,substring_list, new_str):
        for string in substring_list:
            if string in str1:
                str1=str1.replace(string,new_str)
        return str1
    final_string=replaceText(str1,["PossibleEnumValuesArrayItem {'enumValue': {'enumValueId': {'displayValue': '","}","[","]","type","displayValue","'",":",","],"")
    print(" Possible options in the list (first enumValueId, second displayValue)---:",final_string)

print("------------")

for values in value1:
    print("ELEMENT RAW DATA VALUE:",values)

print("------------")

for values2 in value2:
    print("BELONGS TO THE BUILDING OPTION SET RAW DATA VALUES:",values2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here's the result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;C1.001 Current value is: Undenified
C1.003 Current value is: Part of the building 1
C1.002 Current value is: Undenified
C1.004 Current value is: Undenified
C1.005 Current value is: Undenified
C1.006 Current value is: Undenified
C1.007 Current value is: Undenified
------------
 Possible options in the list (first enumValueId, second displayValue)---: Undenified    Undenified Part of the building 1    Part of the building 1 Part of the building 2    Part of the building 2
 Possible options in the list (first enumValueId, second displayValue)---: Undenified    Undenified Part of the building 1    Part of the building 1 Part of the building 2    Part of the building 2
 Possible options in the list (first enumValueId, second displayValue)---: Undenified    Undenified Part of the building 1    Part of the building 1 Part of the building 2    Part of the building 2
 Possible options in the list (first enumValueId, second displayValue)---: Undenified    Undenified Part of the building 1    Part of the building 1 Part of the building 2    Part of the building 2
 Possible options in the list (first enumValueId, second displayValue)---: Undenified    Undenified Part of the building 1    Part of the building 1 Part of the building 2    Part of the building 2
 Possible options in the list (first enumValueId, second displayValue)---: Undenified    Undenified Part of the building 1    Part of the building 1 Part of the building 2    Part of the building 2
 Possible options in the list (first enumValueId, second displayValue)---: Undenified    Undenified Part of the building 1    Part of the building 1 Part of the building 2    Part of the building 2
------------
ELEMENT RAW DATA VALUE: PropertyValuesWrapper {'propertyValues': [{'propertyValue': {'value': {'displayValue': 'Undenified', 'type': 'displayValue'}, 'type': 'singleEnum', 'status': 'normal'}}]}
ELEMENT RAW DATA VALUE: PropertyValuesWrapper {'propertyValues': [{'propertyValue': {'value': {'displayValue': 'Part of the building 1', 'type': 'displayValue'}, 'type': 'singleEnum', 'status': 'normal'}}]}  
ELEMENT RAW DATA VALUE: PropertyValuesWrapper {'propertyValues': [{'propertyValue': {'value': {'displayValue': 'Undenified', 'type': 'displayValue'}, 'type': 'singleEnum', 'status': 'normal'}}]}
ELEMENT RAW DATA VALUE: PropertyValuesWrapper {'propertyValues': [{'propertyValue': {'value': {'displayValue': 'Undenified', 'type': 'displayValue'}, 'type': 'singleEnum', 'status': 'normal'}}]}
ELEMENT RAW DATA VALUE: PropertyValuesWrapper {'propertyValues': [{'propertyValue': {'value': {'displayValue': 'Undenified', 'type': 'displayValue'}, 'type': 'singleEnum', 'status': 'normal'}}]}
ELEMENT RAW DATA VALUE: PropertyValuesWrapper {'propertyValues': [{'propertyValue': {'value': {'displayValue': 'Undenified', 'type': 'displayValue'}, 'type': 'singleEnum', 'status': 'normal'}}]}
ELEMENT RAW DATA VALUE: PropertyValuesWrapper {'propertyValues': [{'propertyValue': {'value': {'displayValue': 'Undenified', 'type': 'displayValue'}, 'type': 'singleEnum', 'status': 'normal'}}]}
------------
BELONGS TO THE BUILDING OPTION SET RAW DATA VALUES: PropertyDefinitionWrapper {'propertyDefinition': {'group': {'name': 'BUILDING INFORMATION'}, 'name': 'BELONGS TO THE BUILDING', 'description': '', 'possibleEnumValues': [{'enumValue': {'enumValueId': {'displayValue': 'Undenified', 'type': 'displayValue'}, 'displayValue': 'Undenified'}}, {'enumValue': {'enumValueId': {'displayValue': 'Part of the building 1', 'type': 'displayValue'}, 'displayValue': 'Part of the building 1'}}, {'enumValue': {'enumValueId': {'displayValue': 'Part of the building 2', 'type': 'displayValue'}, 'displayValue': 'Part of the building 2'}}]}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I can understand from the results is that it seems option set values contains both display- and enumValue&amp;nbsp;&lt;SPAN&gt;types per one choice. I have tried to use "act_&lt;/SPAN&gt;&lt;SPAN&gt;SingleEnumPropertyValue" -type to change the value of the zones from "undenified" to "part of the building 1" with no luck.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 17:05:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Python-and-property-manager-option-sets/m-p/314016#M837</guid>
      <dc:creator>JT1986</dc:creator>
      <dc:date>2021-10-28T17:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Python and property manager option sets</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Python-and-property-manager-option-sets/m-p/320007#M838</link>
      <description>&lt;P&gt;After a few trial and error rounds I got the script working as I wanted! The solution was to use&amp;nbsp;&lt;EM&gt;act.DisplayValueEnumId()&lt;/EM&gt;&amp;nbsp; and&amp;nbsp;&lt;EM&gt;act.NormalSingleEnumPropertyValue() &lt;/EM&gt;(or&lt;EM&gt; act.NormalMultiEnumPropertyValue() &lt;/EM&gt;) types to change values&amp;nbsp; in the option set lists.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 18:59:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Python-and-property-manager-option-sets/m-p/320007#M838</guid>
      <dc:creator>JT1986</dc:creator>
      <dc:date>2021-11-07T18:59:24Z</dc:date>
    </item>
  </channel>
</rss>

