<?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: Why it's not work (About placing library object on floor in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157462#M6152</link>
    <description>&lt;BLOCKQUOTE&gt;Paodekcal wrote:&lt;BR /&gt;I confuse this sentence&lt;BR /&gt;
"library part index is temporary"&lt;BR /&gt;
Can you explain me in detail?&lt;/BLOCKQUOTE&gt;
If you ask for an object with an index of '20', ArchiCAD will return whatever object has that index. But if you change the loaded libraries and ask for the object at index '20', don't be surprised if you get a &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;different&lt;E&gt;&lt;/E&gt; object.&lt;BR /&gt;
&lt;BR /&gt;
Objects do not have a permanent index - refer to the object guid instead, or perhaps the name.</description>
    <pubDate>Tue, 11 Jan 2011 09:42:41 GMT</pubDate>
    <dc:creator>Ralph Wessel</dc:creator>
    <dc:date>2011-01-11T09:42:41Z</dc:date>
    <item>
      <title>Why it's not work (About placing library object on floorplan</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157456#M6146</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;
&lt;PRE&gt;static void Do_MyFunction(void)
{
	API_Element element;
	API_ElementMemo memo;
	BNZeroMemory(&amp;amp;element, sizeof(API_Element));
	BNZeroMemory(&amp;amp;memo, sizeof(API_ElementMemo));
	double A = 0;
	double B = 0;
	Int32 parCount = 0;
	//----
	element.header.typeID = API_ObjectID;
	ACAPI_Element_GetDefaults(&amp;amp;element, NULL);
	ACAPI_LibPart_GetParams(20, &amp;amp;A, &amp;amp;B, &amp;amp;parCount, &amp;amp;memo.params);
	element.object.pos.x = 1;
	element.object.pos.y = 1;
	element.object.xRatio = A;
	element.object.yRatio = B;
	element.object.libInd = 20;
	
	GSErrCode	err = ACAPI_Element_Create(&amp;amp;element, &amp;amp;memo);
	if( err == NoError)
	{
		ACAPI_WriteReport("Ok ",true);
	}
	else
	{
		ACAPI_WriteReport("Error ",true);
	}

	ACAPI_DisposeElemMemoHdls (&amp;amp;memo);
}&lt;/PRE&gt;
It's all return Error only&lt;BR /&gt;&lt;BR /&gt;P.S. I want to test on library index 20.&lt;BR /&gt;I'm coding this on VS2005 and ArchiCAD 14 Demo Version&lt;/DIV&gt;</description>
      <pubDate>Mon, 09 Sep 2024 08:58:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157456#M6146</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-09T08:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why it's not work (About placing library object on floor</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157457#M6147</link>
      <description>&lt;BLOCKQUOTE&gt;Paodekcal wrote:&lt;BR /&gt;It's all return Error only&lt;BR /&gt;
P.S. I want to test on library index 20.&lt;/BLOCKQUOTE&gt;
Are you using &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt; ACAPI_OpenUndoableSession&lt;E&gt;&lt;/E&gt; before calling this function? You should also check the error code returned by &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ACAPI_Element_GetDefaults&lt;E&gt;&lt;/E&gt; and &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ACAPI_LibPart_GetParams&lt;E&gt;&lt;/E&gt;.&lt;BR /&gt;
&lt;BR /&gt;
As an aside, the library part index is temporary, i.e. you can cannot be certain what part it will refer to. I would never hard code an index like that.</description>
      <pubDate>Mon, 10 Jan 2011 20:41:21 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157457#M6147</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2011-01-10T20:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why it's not work (About placing library object on floor</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157458#M6148</link>
      <description>Thanks for your reply&lt;BR /&gt;
&lt;BR /&gt;
OK I will check it soon.&lt;BR /&gt;
&lt;BR /&gt;
but a little, I confuse this sentence&lt;BR /&gt;
"library part index is temporary"&lt;BR /&gt;
&lt;BR /&gt;
Can you explain me in detail?</description>
      <pubDate>Tue, 11 Jan 2011 01:47:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157458#M6148</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-01-11T01:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why it's not work (About placing library object on floor</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157459#M6149</link>
      <description>&lt;PRE&gt;	API_LibPart part;   
	GSErrCode err;   
	BNZeroMemory(&amp;amp;part, sizeof(API_LibPart));   

	part.index = 20;
	err = ACAPI_LibPart_Search(&amp;amp;part, false);
	err = ACAPI_LibPart_Get(&amp;amp;part);
	API_Element element;
	API_ElementMemo memo;
	BNZeroMemory(&amp;amp;element, sizeof(API_Element));
	BNZeroMemory(&amp;amp;memo, sizeof(API_ElementMemo));
	double A = 0;
	double B = 0;
	Int32 parCount = 0;
	//----
	element.header.typeID = API_ObjectID;
	err = ACAPI_Element_GetDefaults(&amp;amp;element, NULL);
	err = ACAPI_LibPart_GetParams(part.index, &amp;amp;A, &amp;amp;B, &amp;amp;parCount, &amp;amp;memo.params);
	element.object.pos.x = 1;
	element.object.pos.y = 1;
	element.object.xRatio = A;
	element.object.yRatio = B;
	element.object.libInd = part.index;
	
	err = ACAPI_Element_Create(&amp;amp;element, &amp;amp;memo);
	if( err == NoError)
	{
		ACAPI_WriteReport("Ok ",true);
	}
	else
	{
		ACAPI_WriteReport("Error ",true);
	}

	ACAPI_DisposeElemMemoHdls (&amp;amp;memo);&lt;/PRE&gt;

I use above code and it's error too&lt;BR /&gt;
&lt;BR /&gt;
I error only on &lt;BR /&gt;

	&lt;PRE&gt;err = ACAPI_Element_Create(&amp;amp;element, &amp;amp;memo);&lt;/PRE&gt;

err return&lt;BR /&gt;

&lt;PRE&gt;APIERR_REFUSEDCMD -2130312312 81060388 The passed identifier is not subject to the operation. &lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Jan 2011 02:04:03 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157459#M6149</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-01-11T02:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why it's not work (About placing library object on floor</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157460#M6150</link>
      <description>switch (menuParams-&amp;gt;menuItemRef.itemIndex) {&lt;BR /&gt;
					case 1:		Do_MyFunction ();					break;&lt;BR /&gt;
					case 2:		Do_CreateWindowFromHatch ();		break;&lt;BR /&gt;
				}&lt;BR /&gt;
&lt;BR /&gt;
I call it from this.&lt;BR /&gt;
&lt;BR /&gt;
I don't know it's contain undoable session or not?</description>
      <pubDate>Tue, 11 Jan 2011 02:25:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157460#M6150</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-01-11T02:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why it's not work (About placing library object on floor</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157461#M6151</link>
      <description>&lt;PRE&gt;ACAPI_OpenUndoableSession("Test Lib");
	err = ACAPI_Element_Create(&amp;amp;element, &amp;amp;memo);
	ACAPI_CloseUndoableSession();&lt;/PRE&gt;

OK thx.&lt;BR /&gt;
&lt;BR /&gt;
I just place 2 undo line here.&lt;BR /&gt;
&lt;BR /&gt;
It's work!!!&lt;BR /&gt;
&lt;BR /&gt;
I just understand that it "must" use with undo too.</description>
      <pubDate>Tue, 11 Jan 2011 03:27:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157461#M6151</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-01-11T03:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why it's not work (About placing library object on floor</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157462#M6152</link>
      <description>&lt;BLOCKQUOTE&gt;Paodekcal wrote:&lt;BR /&gt;I confuse this sentence&lt;BR /&gt;
"library part index is temporary"&lt;BR /&gt;
Can you explain me in detail?&lt;/BLOCKQUOTE&gt;
If you ask for an object with an index of '20', ArchiCAD will return whatever object has that index. But if you change the loaded libraries and ask for the object at index '20', don't be surprised if you get a &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;different&lt;E&gt;&lt;/E&gt; object.&lt;BR /&gt;
&lt;BR /&gt;
Objects do not have a permanent index - refer to the object guid instead, or perhaps the name.</description>
      <pubDate>Tue, 11 Jan 2011 09:42:41 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157462#M6152</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2011-01-11T09:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Why it's not work (About placing library object on floor</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157463#M6153</link>
      <description>OK I get it.&lt;BR /&gt;
&lt;BR /&gt;
Thank you.</description>
      <pubDate>Tue, 11 Jan 2011 09:51:50 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Why-it-s-not-work-About-placing-library-object-on-floorplan/m-p/157463#M6153</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-01-11T09:51:50Z</dc:date>
    </item>
  </channel>
</rss>

