<?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: How to change Symbol Type using ArchiCAD API? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571734#M8760</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/8527"&gt;@BerndSchwarzenbacher&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Sorry for the inconvenience but can you answer me?&lt;BR /&gt;I created a new label and tried to change its type but I couldn't. Same as the code in the previous comment.&lt;/P&gt;&lt;P&gt;Can you help me?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
    <pubDate>Fri, 20 Oct 2023 04:56:25 GMT</pubDate>
    <dc:creator>Tran Thanh Lo</dc:creator>
    <dc:date>2023-10-20T04:56:25Z</dc:date>
    <item>
      <title>How to change Symbol Type using ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571195#M8730</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know How to change the symbol type when tagging like this in the image below?&lt;/P&gt;
&lt;P&gt;i’m very happy to receive your reply.&amp;nbsp;&lt;BR /&gt;Thank you very much&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="received_289674507279371.png" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/47387iC626269E29BEB601/image-size/large?v=v2&amp;amp;px=999" role="button" title="received_289674507279371.png" alt="received_289674507279371.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 12:28:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571195#M8730</guid>
      <dc:creator>Tran Thanh Lo</dc:creator>
      <dc:date>2024-09-16T12:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Symbol Type using ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571233#M8734</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;You'll have to first know the index of the library part. You can search it with &lt;A href="https://graphisoft.github.io/archicad-api-devkit/group___library_part.html#ga02b37c489558a0eb49c06f677eb86dba" target="_self"&gt;ACAPI_LibPart_Search&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;And then for the label element, you set the libPart index correctly.&lt;/P&gt;
&lt;P&gt;So a rough sketch of the 2 steps:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;API_LibPart libPart{};
GS::ucscpy(libPart.docu_UName, "YourLibPartNameHere");
ACAPI_LibPart_Search(&amp;amp;libPart, false);
labelElement.label.u.symbol.libIndex = libPart.libIndex;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;Also you'll have to use &lt;A href="https://graphisoft.github.io/archicad-api-devkit/group___library_part.html#ga833ffc1cf6077750635ca545e2bc02ac" target="_self"&gt;ACAPI_LibPart_GetParams&lt;/A&gt; to get the parameters of the symbol label.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 18:56:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571233#M8734</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-17T18:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Symbol Type using ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571406#M8741</link>
      <description>&lt;P&gt;Hi bschwb,&lt;/P&gt;
&lt;P&gt;Thank you very much for responding to my question.&lt;/P&gt;
&lt;P&gt;I followed your instructions but it doesn't work. Can you check my code? And tell me where I'm wrong?&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="received_304069542333158.png" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/47685iCE589400B8AC839C/image-size/large?v=v2&amp;amp;px=999" role="button" title="received_304069542333158.png" alt="received_304069542333158.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="received_1021461469190431.png" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/47686iF4C54804E9DB3262/image-size/large?v=v2&amp;amp;px=999" role="button" title="received_1021461469190431.png" alt="received_1021461469190431.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;  &lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 20:51:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571406#M8741</guid>
      <dc:creator>Tran Thanh Lo</dc:creator>
      <dc:date>2023-10-22T20:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Symbol Type using ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571441#M8744</link>
      <description>&lt;P&gt;Please provide the code in a code block for us to copy from. Screenshots of code are very cumbersome to use.&lt;BR /&gt;And also please provide more details of what is not working. What are the error codes you get in which lines etc.&lt;BR /&gt;&lt;BR /&gt;After a quick look on your screenshot, I'm confused why you are using both &lt;STRONG&gt;ACAPI_Element_Change&lt;/STRONG&gt; and &lt;STRONG&gt;ACAPI_Element_Create&lt;/STRONG&gt;. Are you trying to create a label or change an existing label?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 20:43:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571441#M8744</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-18T20:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Symbol Type using ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571473#M8746</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/8527"&gt;@BerndSchwarzenbacher&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;This is my code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;static void	ReplaceEmptyTextWithPredefined(API_ElementMemo&amp;amp; memo)
{
	const char* predefinedContent = "Default text was empty.";

	if (memo.textContent == nullptr || Strlen32(*memo.textContent) &amp;lt; 2) {
		BMhKill(&amp;amp;memo.textContent);
		memo.textContent = BMhAllClear(Strlen32(predefinedContent) + 1);
		strcpy(*memo.textContent, predefinedContent);
		(*memo.paragraphs)[0].run[0].range = Strlen32(predefinedContent);
	}
}


void CreateLable(API_Guid guid, API_Coord coord)
{

	bool	bAutoText;
	ACAPI_Goodies(APIAny_GetAutoTextFlagID, &amp;amp;bAutoText);

	if (bAutoText) {
		bool _bAutoText = false;
		ACAPI_Goodies(APIAny_ChangeAutoTextFlagID, &amp;amp;_bAutoText);
	}

	GSErrCode		err;
	API_Element		element = {};
	API_ElementMemo	memo = {};
	API_ElemType	type;
	type.typeID = API_ZoneID;
	element.header.type = API_LabelID;
	element.label.parentType = type;

	err = ACAPI_Element_GetDefaults(&amp;amp;element, &amp;amp;memo);

	if (bAutoText) {
		ACAPI_Goodies(APIAny_ChangeAutoTextFlagID, &amp;amp;bAutoText);
	}

	if (err != NoError) {
		ErrorBeep("ACAPI_Element_GetDefaults", err);
		return;
	}

	element.label.begC = coord;
	element.label.endC = coord;
	element.label.createAtDefaultPosition = false;
	element.label.parent =guid;

	if (element.label.labelClass == APILblClass_Text) {
		ReplaceEmptyTextWithPredefined(memo);
		element.label.u.text.nonBreaking = true;
	}

	// Create lable
	err = ACAPI_Element_Create(&amp;amp;element, &amp;amp;memo);
	if (err != NoError)
		ErrorBeep("ACAPI_Element_Create (Associative Label)", err);


	// Change Lable Type
	API_LibPart libPart{};
	BNZeroMemory(&amp;amp;libPart, sizeof(API_LibPart));
	CHCopyC(drawingGuid, libPart.parentUnID);
	GS::ucscpy(libPart.docu_UName, GS::UniString("Zone Label 26").ToUStr());
	ACAPI_LibPart_Search(&amp;amp;libPart, false);
	element.label.u.symbol.ltypeInd = libPart.index;


	//API_Element mask;
	//ACAPI_ELEMENT_MASK_CLEAR(mask);
	//ACAPI_ELEMENT_MASK_SET(mask, API_LabelType, u.symbol.libInd);
	//element.label.u.symbol.libInd = libPart.index;
	//if (ACAPI_Element_Change(&amp;amp;element, &amp;amp;mask, nullptr, 0, true) != NoError);

	ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 04:39:11 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571473#M8746</guid>
      <dc:creator>Tran Thanh Lo</dc:creator>
      <dc:date>2023-10-20T04:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Symbol Type using ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571734#M8760</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/8527"&gt;@BerndSchwarzenbacher&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Sorry for the inconvenience but can you answer me?&lt;BR /&gt;I created a new label and tried to change its type but I couldn't. Same as the code in the previous comment.&lt;/P&gt;&lt;P&gt;Can you help me?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 04:56:25 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571734#M8760</guid>
      <dc:creator>Tran Thanh Lo</dc:creator>
      <dc:date>2023-10-20T04:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to change Symbol Type using ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571755#M8763</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Your code has a few errors and unnecessary lines, so I changed it quite a bit.&lt;BR /&gt;First, you don't need to create and then change the label.&lt;/P&gt;
&lt;P&gt;I think it's easier to set it up correctly first and then just create it.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Here's an example code for an independent label (it was faster for me to program),&lt;/P&gt;
&lt;P&gt;but your parts for the associativity were correct I think, so you will be able to adapt it.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;void CreateLabel (API_Coord coord)
{
  GSErrCode err;
  API_Element element{};
  element.header.type = API_LabelID;
  // We don't get the memo here, since it depends on the library part!
  err = ACAPI_Element_GetDefaults (&amp;amp;element, nullptr);
  if (err != NoError) {
    ACAPI_WriteReport ("Error in GetDefaults: %d", true, err);
    return;
  }

  element.label.begC = coord;
  element.label.endC = coord;
  element.label.createAtDefaultPosition = false;
  // In case a text label is selected in label tool defaults, we switch to a symbol label.
  if (element.label.labelClass == APILblClass_Text) {
    element.label.labelClass = APILblClass_Symbol;
  }

  API_LibPart libPart{};
  GS::ucscpy (libPart.docu_UName, GS::UniString ("Zone Label 26").ToUStr ());
  err = ACAPI_LibPart_Search (&amp;amp;libPart, false);
  if (err != NoError) {
    ACAPI_WriteReport ("Error in LibPart_Search: %d", true, err);
    return;
  }
  element.label.u.symbol.libInd = libPart.index;

  // We need to get the parameters of the actual library part!
  // They are stored in memo.params
  API_ElementMemo	memo{};
  Int32 addParNum = 0;
  err = ACAPI_LibPart_GetParams (libPart.index, nullptr, nullptr, &amp;amp;addParNum, &amp;amp;memo.params);
  if (err != NoError) {
    ACAPI_WriteReport ("Error in LibPart_GetParams: %d", true, err);
    return;
  }

  // Create label
  err = ACAPI_Element_Create (&amp;amp;element, &amp;amp;memo);
  if (err != NoError) {
    ACAPI_WriteReport ("Error in Element_Create: %d", true, err);
    return;
  }

  ACAPI_DisposeElemMemoHdls (&amp;amp;memo);
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Hope that helps!&lt;BR /&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 06:17:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-change-Symbol-Type-using-ArchiCAD-API/m-p/571755#M8763</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-20T06:17:27Z</dc:date>
    </item>
  </channel>
</rss>

