<?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 changing visibility of an element in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/changing-visibility-of-an-element/m-p/32933#M7036</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I've updated my code to work with the ArchiCAD 9 API_StoryVisibility structure. Its working fine for slabs, but not for objects.&lt;BR /&gt;&lt;BR /&gt;I basicly force my library parts to be set to the story settings I require. This is an integral part of my apx and has always worked fine using showAbove, showBelow in version 7.&lt;BR /&gt;&lt;BR /&gt;Here code that should set an object to be 'show above and below', but doesn't work for me. I can't understand why:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;err = ACAPI_Element_Get(&amp;amp;element);
if(err == noErr)
{
   element.object.visibility.showRelAbove = 1;
   element.object.visibility.showRelAbove = 1;
   ACAPI_ELEMENT_MASK_SET(mask, API_ObjectType, visibility);
   err = ACAPI_Element_Change(&amp;amp;element, mask, nil, 0, true);
   if(err == noErr)
   {
      err = ACAPI_Element_Get(&amp;amp;element);
      if(err == noErr)
      {
         // The function gets here, but showRelAbove &amp;amp; showRelAbove are set back to zero
      }
   }
}

   }
}
&lt;/PRE&gt;
As a test I tried this (which also doesn't work):
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;err = ACAPI_Element_Get(&amp;amp;element);
if(err == noErr)
{
   element.object.visibility.showRelAbove = 1;
   element.object.visibility.showRelAbove = 1;
   ACAPI_ELEMENT_MASK_SETFULL(mask);
   err = ACAPI_Element_Change(&amp;amp;element, mask, nil, 0, true);
   if(err == APIERR_BADPARS)
   {
         // The function gets here and I can't see what would casue this
   }
}
&lt;/PRE&gt;
The only way I can think to do it is to deletes and recreate the element. It seems vey ineffecient. If I am forced to use this method I will have to do lots of extra work to recreate links to this element from dimensions, etc.&lt;BR /&gt;&lt;BR /&gt;Has anyone had this working?&lt;BR /&gt;Any idea what I'm doing wrong?&lt;BR /&gt;Are there other parts of elements that I won't be able to edit now in version 9?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Adam&lt;/DIV&gt;</description>
    <pubDate>Mon, 07 Aug 2023 09:21:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-08-07T09:21:57Z</dc:date>
    <item>
      <title>changing visibility of an element</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/changing-visibility-of-an-element/m-p/32933#M7036</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I've updated my code to work with the ArchiCAD 9 API_StoryVisibility structure. Its working fine for slabs, but not for objects.&lt;BR /&gt;&lt;BR /&gt;I basicly force my library parts to be set to the story settings I require. This is an integral part of my apx and has always worked fine using showAbove, showBelow in version 7.&lt;BR /&gt;&lt;BR /&gt;Here code that should set an object to be 'show above and below', but doesn't work for me. I can't understand why:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;err = ACAPI_Element_Get(&amp;amp;element);
if(err == noErr)
{
   element.object.visibility.showRelAbove = 1;
   element.object.visibility.showRelAbove = 1;
   ACAPI_ELEMENT_MASK_SET(mask, API_ObjectType, visibility);
   err = ACAPI_Element_Change(&amp;amp;element, mask, nil, 0, true);
   if(err == noErr)
   {
      err = ACAPI_Element_Get(&amp;amp;element);
      if(err == noErr)
      {
         // The function gets here, but showRelAbove &amp;amp; showRelAbove are set back to zero
      }
   }
}

   }
}
&lt;/PRE&gt;
As a test I tried this (which also doesn't work):
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;err = ACAPI_Element_Get(&amp;amp;element);
if(err == noErr)
{
   element.object.visibility.showRelAbove = 1;
   element.object.visibility.showRelAbove = 1;
   ACAPI_ELEMENT_MASK_SETFULL(mask);
   err = ACAPI_Element_Change(&amp;amp;element, mask, nil, 0, true);
   if(err == APIERR_BADPARS)
   {
         // The function gets here and I can't see what would casue this
   }
}
&lt;/PRE&gt;
The only way I can think to do it is to deletes and recreate the element. It seems vey ineffecient. If I am forced to use this method I will have to do lots of extra work to recreate links to this element from dimensions, etc.&lt;BR /&gt;&lt;BR /&gt;Has anyone had this working?&lt;BR /&gt;Any idea what I'm doing wrong?&lt;BR /&gt;Are there other parts of elements that I won't be able to edit now in version 9?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Adam&lt;/DIV&gt;</description>
      <pubDate>Mon, 07 Aug 2023 09:21:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/changing-visibility-of-an-element/m-p/32933#M7036</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-07T09:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: changing visibility of an element</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/changing-visibility-of-an-element/m-p/32934#M7037</link>
      <description>&lt;BLOCKQUOTE&gt;adambutler wrote:&lt;BR /&gt;I've updated my code to work with the ArchiCAD 9 API_StoryVisibility structure. Its working fine for slabs, but not for objects.
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;   err = ACAPI_Element_Change(&amp;amp;element, mask, nil, 0, true);
   if(err == APIERR_BADPARS)
   {
         // The function gets here and I can't see what would casue this
   }
&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;

The error APIERR_BADPARS can be returned if you haven't preceeded ACAPI_Element_Change with ACAPI_OpenUndoableSession. Could this be the problem?</description>
      <pubDate>Fri, 24 Feb 2006 08:04:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/changing-visibility-of-an-element/m-p/32934#M7037</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2006-02-24T08:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: changing visibility of an element</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/changing-visibility-of-an-element/m-p/32935#M7038</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
This is done in the new element database handler which the docs say 'cannot open undoable sessions because they are called from an already opened undo step'.&lt;BR /&gt;
&lt;BR /&gt;
I tried putting this code behind a menu item with the openundo call and still get the same problem.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Adam</description>
      <pubDate>Mon, 27 Feb 2006 00:54:26 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/changing-visibility-of-an-element/m-p/32935#M7038</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-02-27T00:54:26Z</dc:date>
    </item>
  </channel>
</rss>

