<?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: Draw Text in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Draw-Text/m-p/285843#M3603</link>
    <description>OK -- I found the example in Element_test under mutistyle text and found the paragraph stuff to be immensely  confusing.  I'd appreciate some direction for an explanation of paragraphs  in the documentation -- if someone could direct me to that section. I could not find any pertinent documentation to explain paragraphs in the API? &lt;BR /&gt;
&lt;BR /&gt;
In the mean time, I think I'll just stick to the non-associated label example for just one/lines of text.</description>
    <pubDate>Sun, 17 Feb 2019 23:17:11 GMT</pubDate>
    <dc:creator>poco2013</dc:creator>
    <dc:date>2019-02-17T23:17:11Z</dc:date>
    <item>
      <title>Draw Text</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Draw-Text/m-p/285842#M3602</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Trying to draw some simple text at the origin. I'm guessing I need to use the function API_Element_Create() but I'm obviously doing something wrong as I get a compile message of 'no suitable conversion function from API_TextType to API_Element'&lt;BR /&gt;&lt;BR /&gt;Can't seem to find a example in the Examples files. Here's the code I'm using -- Obviously wrong -- Any one have a example?
&lt;PRE&gt;API_TextType element;
	BNZeroMemory(&amp;amp;element , sizeof(API_TextType));
	API_ElementMemo memo;
	BNZeroMemory(&amp;amp;memo, sizeof(API_ElementMemo));
	element.head.typeID = API_TextID;
	element.head.hasMemo = true;
	element.head.guid = APINULLGuid;
	element.loc.x = 0;
	element.loc.y = 0;
	element.font = 131;
	CHCopyC(*memo.textContent , "some text");
	ACAPI_Element_Create(&amp;amp;element, &amp;amp;memo);&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Oct 2022 14:39:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Draw-Text/m-p/285842#M3602</guid>
      <dc:creator>poco2013</dc:creator>
      <dc:date>2022-10-04T14:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Draw Text</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Draw-Text/m-p/285843#M3603</link>
      <description>OK -- I found the example in Element_test under mutistyle text and found the paragraph stuff to be immensely  confusing.  I'd appreciate some direction for an explanation of paragraphs  in the documentation -- if someone could direct me to that section. I could not find any pertinent documentation to explain paragraphs in the API? &lt;BR /&gt;
&lt;BR /&gt;
In the mean time, I think I'll just stick to the non-associated label example for just one/lines of text.</description>
      <pubDate>Sun, 17 Feb 2019 23:17:11 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Draw-Text/m-p/285843#M3603</guid>
      <dc:creator>poco2013</dc:creator>
      <dc:date>2019-02-17T23:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Draw Text</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Draw-Text/m-p/285844#M3604</link>
      <description>You have to bother with paragraphs only if you want to create a text with multi style.&lt;BR /&gt;
Here is a simple function to create text element (extracted from Communication_Client example Add-On):&lt;BR /&gt;

&lt;PRE&gt;static GSErrCode	CreateAText (const char* content, short pen, double size, double xPos, double yPos)
{
	API_Element element = {};
	element.header.typeID = API_TextID;

	GSErrCode err = ACAPI_Element_GetDefaults (&amp;amp;element, nullptr);
	if (err != NoError) {
		ErrorBeep ("ACAPI_Element_GetDefaults (text)", err);
		return err;
	}

	element.text.pen    = pen;
	element.text.size   = size;
	element.text.anchor = APIAnc_LT;
	element.text.just   = APIJust_Left;
	element.text.loc.x = xPos;
	element.text.loc.y = yPos;
	element.text.nonBreaking = true;
	element.text.nLine = 1;

	API_ElementMemo	memo = {};
	memo.textContent = BMAllocateHandle (Strlen32 (content) + 1, ALLOCATE_CLEAR, 0);

	strcpy (*memo.textContent, content);

	err = ACAPI_CallUndoableCommand ("Create text",
		[&amp;amp;] () -&amp;gt; GSErrCode {
			return ACAPI_Element_Create (&amp;amp;element, &amp;amp;memo);
		});
	if (err != NoError)
		ErrorBeep ("ACAPI_Element_Create (text)", err);

	ACAPI_DisposeElemMemoHdls (&amp;amp;memo);

	return err;
}		// CreateAText&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Feb 2019 08:56:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Draw-Text/m-p/285844#M3604</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2019-02-18T08:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: Draw Text</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Draw-Text/m-p/285845#M3605</link>
      <description>Ákos also wrote a nice "Hello World" example on the API blog that shows how to place a text element: &lt;A href="http://archicadapi.graphisoft.com/hello-world" target="_blank"&gt;http://archicadapi.graphisoft.com/hello-world&lt;/A&gt;</description>
      <pubDate>Mon, 18 Feb 2019 15:37:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Draw-Text/m-p/285845#M3605</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-02-18T15:37:46Z</dc:date>
    </item>
  </channel>
</rss>

