<?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 Change the Layer of Elements - in Archicad Python API</title>
    <link>https://community.graphisoft.com/t5/Archicad-Python-API/Change-the-Layer-of-Elements/m-p/585780#M968</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;i wrote a script to change the layer-values of elements in the model.&lt;/P&gt;
&lt;P&gt;But i got the result&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FailedExecutionResult {'success': False, 'error': {'code': 6800, 'message': 'Value of property definition is read-only (property definition guid: "812CD483-40FB-4E75-966F-E76C3E68B9F7")'}}&lt;/P&gt;
&lt;P&gt;for every element.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is wrong?&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;DIV&gt;elements = acc.GetAllElements()&lt;/DIV&gt;
&lt;DIV&gt;# get GUID for ModelView_LayerName&lt;/DIV&gt;
&lt;DIV&gt;propertyId = acu.GetBuiltInPropertyId('ModelView_LayerName')&lt;/DIV&gt;
&lt;PRE&gt;&lt;BR /&gt;# get list with Element-Layers&lt;/PRE&gt;
&lt;DIV&gt;actValues = acc.GetPropertyValuesOfElements(elements,[propertyId])&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;#create list with new values&lt;BR /&gt;TestValue = "10 WAND - innen.Wand"&lt;BR /&gt;NewPropertyValues = []&lt;BR /&gt;for i in range(len(elements)) :&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NewPropertyValues.append(act.ElementPropertyValue(elements[i].elementId,propertyId,act.NormalStringPropertyValue(TestValue)))&lt;BR /&gt;&lt;BR /&gt;# sent changes to Archicad&lt;BR /&gt;result = acc.SetPropertyValuesOfElements(NewPropertyValues)&lt;BR /&gt;print(result)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Thu, 26 Sep 2024 10:17:07 GMT</pubDate>
    <dc:creator>smathiebe</dc:creator>
    <dc:date>2024-09-26T10:17:07Z</dc:date>
    <item>
      <title>Change the Layer of Elements -</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Change-the-Layer-of-Elements/m-p/585780#M968</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;i wrote a script to change the layer-values of elements in the model.&lt;/P&gt;
&lt;P&gt;But i got the result&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FailedExecutionResult {'success': False, 'error': {'code': 6800, 'message': 'Value of property definition is read-only (property definition guid: "812CD483-40FB-4E75-966F-E76C3E68B9F7")'}}&lt;/P&gt;
&lt;P&gt;for every element.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is wrong?&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;DIV&gt;elements = acc.GetAllElements()&lt;/DIV&gt;
&lt;DIV&gt;# get GUID for ModelView_LayerName&lt;/DIV&gt;
&lt;DIV&gt;propertyId = acu.GetBuiltInPropertyId('ModelView_LayerName')&lt;/DIV&gt;
&lt;PRE&gt;&lt;BR /&gt;# get list with Element-Layers&lt;/PRE&gt;
&lt;DIV&gt;actValues = acc.GetPropertyValuesOfElements(elements,[propertyId])&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;#create list with new values&lt;BR /&gt;TestValue = "10 WAND - innen.Wand"&lt;BR /&gt;NewPropertyValues = []&lt;BR /&gt;for i in range(len(elements)) :&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NewPropertyValues.append(act.ElementPropertyValue(elements[i].elementId,propertyId,act.NormalStringPropertyValue(TestValue)))&lt;BR /&gt;&lt;BR /&gt;# sent changes to Archicad&lt;BR /&gt;result = acc.SetPropertyValuesOfElements(NewPropertyValues)&lt;BR /&gt;print(result)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 26 Sep 2024 10:17:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Change-the-Layer-of-Elements/m-p/585780#M968</guid>
      <dc:creator>smathiebe</dc:creator>
      <dc:date>2024-09-26T10:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Change the Layer of Elements -</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Change-the-Layer-of-Elements/m-p/585819#M969</link>
      <description>&lt;P&gt;Hi smathiebe,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I know, currently you can only check the layer name (property value) of an element and use it as one condition inside a script to delimit a group of elements, for example.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But moving an element completely to another layer is unfortunately not possible with the python API. This is why the script returns a "&lt;SPAN&gt;Value of property definition is read-only&lt;/SPAN&gt;" -error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-JT&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 18:47:20 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Change-the-Layer-of-Elements/m-p/585819#M969</guid>
      <dc:creator>JT1986</dc:creator>
      <dc:date>2024-01-29T18:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: Change the Layer of Elements -</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Change-the-Layer-of-Elements/m-p/585832#M970</link>
      <description>&lt;P&gt;FYI: a layer is a fundamental built in property, created by Graphisoft, which controls a attribute of the plan. It is hard coded by Archicad which is why it is read only (at least at this time?). However, you can change the layer through the API function: ACAPI_Element_Change( ). You can also reach and program this function from a Python script by using the Python function ExecuteAddOnCommand and passing the appropriate parameters. But this would also involve creating and installing the relative specific AddOn. The developer's Kit has examples for both the interface and Element Change.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 21:15:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Change-the-Layer-of-Elements/m-p/585832#M970</guid>
      <dc:creator>poco2013</dc:creator>
      <dc:date>2024-01-29T21:15:31Z</dc:date>
    </item>
  </channel>
</rss>

