<?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: APIERR_REFUSEDCMD when delete story in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-REFUSEDCMD-when-delete-story/m-p/254140#M2023</link>
    <description>Probably it doesn't work because you try to run a command that modifies the database, and the command is not in a command scope. Try to do it like this:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;ACAPI_CallUndoableCommand ("Delete Story", [&amp;amp;] () -&amp;gt; GSErrCode {
    // call APIEnv_ChangeStorySettingsID here
});
&lt;/PRE&gt;

It's your choice if you create a separate undo step for all stories, or to do the whole modification in one undo step.&lt;BR /&gt;
&lt;BR /&gt;
More information here (under the undo scope section):&lt;BR /&gt;
&lt;A href="https://archicadapi.graphisoft.com/archicad-maze-generator-add-on-tutorial-part-1" target="_blank"&gt;&lt;LINK_TEXT text="https://archicadapi.graphisoft.com/arch ... ial-part-1"&gt;https://archicadapi.graphisoft.com/archicad-maze-generator-add-on-tutorial-part-1&lt;/LINK_TEXT&gt;&lt;/A&gt;</description>
    <pubDate>Wed, 24 Mar 2021 16:41:35 GMT</pubDate>
    <dc:creator>Viktor Kovacs</dc:creator>
    <dc:date>2021-03-24T16:41:35Z</dc:date>
    <item>
      <title>APIERR_REFUSEDCMD when delete story</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-REFUSEDCMD-when-delete-story/m-p/254139#M2022</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;
&lt;PRE&gt;		API_StoryInfo storyInfo;
		BNZeroMemory(&amp;amp;storyInfo, sizeof(API_StoryInfo));
		GSErrCode err = ACAPI_Environment(APIEnv_GetStorySettingsID, &amp;amp;storyInfo, nullptr);
		API_StoryType** storyType= storyInfo.data;
		API_StoryType* temAdress = (*storyType);
		
		//删除楼层
		for (int i=storyInfo.firstStory;i&amp;lt;= storyInfo.lastStory; i++)
		{
			API_StoryCmdType changeType;
			BNZeroMemory(&amp;amp;changeType, sizeof(API_StoryCmdType));
			changeType.action = APIStory_Delete;
			changeType.index = temAdress-&amp;gt;index;
			changeType.dispOnSections = true;
			changeType.dontRebuild = true;
			changeType.elevation = temAdress-&amp;gt;level;
			//changeType.uName = temAdress-&amp;gt;uName;
			err= ACAPI_Environment(APIEnv_ChangeStorySettingsID, &amp;amp;changeType, nullptr);
			temAdress++;
		};&lt;/PRE&gt;
I try to delete story by the code above ，but it didn‘t work , and the error code was "APIERR_REFUSEDCMD -2130312312 81060388 The passed identifier is not subject to the operation. ".I can not find why.&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Sep 2021 07:51:16 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-REFUSEDCMD-when-delete-story/m-p/254139#M2022</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-14T07:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: APIERR_REFUSEDCMD when delete story</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-REFUSEDCMD-when-delete-story/m-p/254140#M2023</link>
      <description>Probably it doesn't work because you try to run a command that modifies the database, and the command is not in a command scope. Try to do it like this:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;ACAPI_CallUndoableCommand ("Delete Story", [&amp;amp;] () -&amp;gt; GSErrCode {
    // call APIEnv_ChangeStorySettingsID here
});
&lt;/PRE&gt;

It's your choice if you create a separate undo step for all stories, or to do the whole modification in one undo step.&lt;BR /&gt;
&lt;BR /&gt;
More information here (under the undo scope section):&lt;BR /&gt;
&lt;A href="https://archicadapi.graphisoft.com/archicad-maze-generator-add-on-tutorial-part-1" target="_blank"&gt;&lt;LINK_TEXT text="https://archicadapi.graphisoft.com/arch ... ial-part-1"&gt;https://archicadapi.graphisoft.com/archicad-maze-generator-add-on-tutorial-part-1&lt;/LINK_TEXT&gt;&lt;/A&gt;</description>
      <pubDate>Wed, 24 Mar 2021 16:41:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/APIERR-REFUSEDCMD-when-delete-story/m-p/254140#M2023</guid>
      <dc:creator>Viktor Kovacs</dc:creator>
      <dc:date>2021-03-24T16:41:35Z</dc:date>
    </item>
  </channel>
</rss>

