<?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 Create a new Model View Options in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Create-a-new-Model-View-Options/m-p/306520#M1746</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In a custom Add-On i try to create a new custom Model View Options. Using the "ACAPI_Attribute_Get" i can get access the API_Attribute properties and in that properties i can get any specific Model View Options related properties. But when i try to use the "ACAPI_Attribute_Create" method to create a new Model View Options. I get an error (-2130313115 "The passed identifier is not a valid one, or valid, but not proper for the given operation.") . Is there any possible way to create a new Model View Options?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My current coding approach to do this task is given bellow .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;API_Attribute     attrib;
API_AttributeDef		defs;
API_AttributeIndex ModelIndex;
GSErrCode err;

BNZeroMemory(&amp;amp;attrib, sizeof(API_Attribute));
BNZeroMemory(&amp;amp;defs, sizeof(API_AttributeDef));

attrib.header.typeID = API_ModelViewOptionsID;
attrib.header.index = 3;

err = ACAPI_Attribute_Get(&amp;amp;attrib);

GS::UniString name = attrib.modelViewOpt.head.name;

short temp2 = 0;
char customName[API_AttrNameLen] = "New Custom ";
strcpy(attrib.modelViewOpt.head.name, customName); // Set the new name

err = ACAPI_Attribute_Create(&amp;amp;attrib, &amp;amp;defs); &lt;/LI-CODE&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>Mon, 20 Sep 2021 06:18:46 GMT</pubDate>
    <dc:creator>Jahidur</dc:creator>
    <dc:date>2021-09-20T06:18:46Z</dc:date>
    <item>
      <title>Create a new Model View Options</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Create-a-new-Model-View-Options/m-p/306520#M1746</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In a custom Add-On i try to create a new custom Model View Options. Using the "ACAPI_Attribute_Get" i can get access the API_Attribute properties and in that properties i can get any specific Model View Options related properties. But when i try to use the "ACAPI_Attribute_Create" method to create a new Model View Options. I get an error (-2130313115 "The passed identifier is not a valid one, or valid, but not proper for the given operation.") . Is there any possible way to create a new Model View Options?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My current coding approach to do this task is given bellow .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;API_Attribute     attrib;
API_AttributeDef		defs;
API_AttributeIndex ModelIndex;
GSErrCode err;

BNZeroMemory(&amp;amp;attrib, sizeof(API_Attribute));
BNZeroMemory(&amp;amp;defs, sizeof(API_AttributeDef));

attrib.header.typeID = API_ModelViewOptionsID;
attrib.header.index = 3;

err = ACAPI_Attribute_Get(&amp;amp;attrib);

GS::UniString name = attrib.modelViewOpt.head.name;

short temp2 = 0;
char customName[API_AttrNameLen] = "New Custom ";
strcpy(attrib.modelViewOpt.head.name, customName); // Set the new name

err = ACAPI_Attribute_Create(&amp;amp;attrib, &amp;amp;defs); &lt;/LI-CODE&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>Mon, 20 Sep 2021 06:18:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Create-a-new-Model-View-Options/m-p/306520#M1746</guid>
      <dc:creator>Jahidur</dc:creator>
      <dc:date>2021-09-20T06:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new Model View Options</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Create-a-new-Model-View-Options/m-p/306655#M1747</link>
      <description>&lt;P&gt;Hi Jahidur,&lt;BR /&gt;&lt;BR /&gt;I think to create a new Model View Option, you would also have to change the index. Right now you are retrieving an MVO with index=3 and then you try to create an MVO with index=3. So for the ACAPI_Attribute_Create function you should choose an index that is not already existing. I would try ACAPI_Attribute_GetNum and use an index higher than the count you get from that function.&lt;BR /&gt;&lt;BR /&gt;Another error could be, that it could also be that MVO with index=3 is not existing so your ACAPI_Attribute_Get function already has an error and &amp;amp;attrib doesn't contain sensible data.&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 08:35:53 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Create-a-new-Model-View-Options/m-p/306655#M1747</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2021-09-20T08:35:53Z</dc:date>
    </item>
  </channel>
</rss>

