<?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: Changing memo.TextContent causes text scale issues? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-memo-TextContent-causes-text-scale-issues/m-p/232310#M3769</link>
    <description>&lt;B&gt;Found the solution.&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
Turns out, you need to write the &lt;B&gt;memo.Paragraph&lt;/B&gt; back into the element to keep the text the same scale, even if you are only altering the &lt;B&gt;textContent&lt;/B&gt;.&lt;BR /&gt;
&lt;BR /&gt;
So changing the &lt;B&gt;APIMemoMask_TextContent&lt;/B&gt; being passed into the Get memo call as well as the ElementChange call fixes the issue if the mask instead includes the paragraph.&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;UInt32 memoMask = 0;
memoMask |= APIMemoMask_TextContent;
memoMask |= APIMemoMask_Paragraph;
&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Jun 2019 21:43:54 GMT</pubDate>
    <dc:creator>cfranklin</dc:creator>
    <dc:date>2019-06-12T21:43:54Z</dc:date>
    <item>
      <title>Changing memo.TextContent causes text scale issues?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-memo-TextContent-causes-text-scale-issues/m-p/232309#M3768</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I'm attempting to change the content of a text object, and can alter it successfully like so:&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;GSErrCode JHP_TextToCase(JHP_Text_Case textCase)
{
	GSErrCode				err;
	API_Neig				**selNeigs;
	API_ElementMemo		memo;
	API_Element				element, mask;

	selNeigs = (API_Neig**)BMAllocateHandle(sizeof(API_Neig), ALLOCATE_CLEAR, 0);
	err = JHP_GetSelectionOrSelect_Mult(&amp;amp;selNeigs);

	UInt32 nSel = BMGetHandleSize((GSHandle)selNeigs) / sizeof(API_Neig);

	err = ACAPI_Element_Select(selNeigs, nSel, true);

	for (UInt32 i = 0; i &amp;lt; nSel; ++i) {

		BNZeroMemory(&amp;amp;element, sizeof(API_Element));
		BNZeroMemory(&amp;amp;memo, sizeof(API_ElementMemo));

		element.header.guid = (*selNeigs)&lt;I&gt;.guid;

		element.header.typeID = Neig_To_ElemID((*selNeigs)&lt;I&gt;.neigID);

		if (element.header.typeID != API_TextID) { continue; }

		if (!ACAPI_Element_Filter(element.header.guid, APIFilt_IsEditable))
		{
			WriteReport_Alert("Object not editable");
			break;
		}

		if (ACAPI_Element_Get(&amp;amp;element) != NoError) {  continue; }

		ACAPI_ELEMENT_MASK_CLEAR(mask);
		
		if (ACAPI_Element_GetMemo(element.header.guid, &amp;amp;memo, APIMemoMask_TextContent) != NoError) {  continue; }

		JHP_ModifyTextCase(textCase, &amp;amp;memo);
		
		err = ACAPI_Element_Change(&amp;amp;element, &amp;amp;mask, &amp;amp;memo, APIMemoMask_TextContent, true);

		ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
	}

	BMKillHandle((GSHandle*)&amp;amp;selNeigs);

	return err;
}
&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;
This code was created following examples in the &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;Element_Modify.cpp, but when I use this code to change the &lt;STRONG&gt;TextContent&lt;/STRONG&gt;, the text object's scale becomes far smaller without altering the element.text.size or anything similar. &lt;BR /&gt;&lt;BR /&gt;The function
&lt;PRE&gt;JHP_ModifyTextCase(textCase, &amp;amp;memo);&lt;/PRE&gt;
merely changes the textContent of the memo to upper or lowercase. &lt;BR /&gt;&lt;BR /&gt;When the function is called on text that has &lt;STRONG&gt;Fixed State: Scale Independent(Paper Size)&lt;/STRONG&gt; setting, the text does not change size. However, if the text is set to &lt;STRONG&gt;Fixed State: Scale with plan (Model Size)&lt;/STRONG&gt;, then the text reduces in size greatly. Currently, the text goes from &lt;STRONG&gt;2 1/2"&lt;/STRONG&gt; to &lt;STRONG&gt;15/64"&lt;/STRONG&gt; using the above code, when it seems nothing should resize it. &lt;BR /&gt;&lt;BR /&gt;If I try to get the current text size using
&lt;PRE&gt;element.text.size&lt;/PRE&gt;
, it appears to report the size and if I set the element.text.size in the mask, it still sets the size to a number far lower than it currently is. &lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Is this a bug?&lt;/STRONG&gt; does text scale have to be recalculated somehow every time the content alone is changed?&lt;BR /&gt;&lt;BR /&gt;In none of the examples did I see this written any differently or bothering with scale.&lt;BR /&gt;&lt;BR /&gt;Any information would be great, &lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Oct 2022 14:30:05 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-memo-TextContent-causes-text-scale-issues/m-p/232309#M3768</guid>
      <dc:creator>cfranklin</dc:creator>
      <dc:date>2022-10-04T14:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Changing memo.TextContent causes text scale issues?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Changing-memo-TextContent-causes-text-scale-issues/m-p/232310#M3769</link>
      <description>&lt;B&gt;Found the solution.&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
Turns out, you need to write the &lt;B&gt;memo.Paragraph&lt;/B&gt; back into the element to keep the text the same scale, even if you are only altering the &lt;B&gt;textContent&lt;/B&gt;.&lt;BR /&gt;
&lt;BR /&gt;
So changing the &lt;B&gt;APIMemoMask_TextContent&lt;/B&gt; being passed into the Get memo call as well as the ElementChange call fixes the issue if the mask instead includes the paragraph.&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;UInt32 memoMask = 0;
memoMask |= APIMemoMask_TextContent;
memoMask |= APIMemoMask_Paragraph;
&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jun 2019 21:43:54 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Changing-memo-TextContent-causes-text-scale-issues/m-p/232310#M3769</guid>
      <dc:creator>cfranklin</dc:creator>
      <dc:date>2019-06-12T21:43:54Z</dc:date>
    </item>
  </channel>
</rss>

