<?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 Help with text orientation in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/Help-with-text-orientation/m-p/247427#M4440</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;Hello everyone! I'm new to GDL and i'm working on a simple object that consist in a 2D symbol.&lt;BR /&gt;&lt;BR /&gt;The idea is to have a circle with a letter in it. I'd love to make the letter always horizontal, but always inside the circle. I guess I should move the rotation point to so the letter rotates on its center, and not in the origin (0,0), but I just could not manage to do so. Is there a way to do this? any help would be awesome!&lt;BR /&gt;&lt;BR /&gt;&lt;IMG src="https://dl3.pushbulletusercontent.com/OxRt5tl2tbPGSZnxwWMl6ptmQXnhtiPC/Screenshot_1.png" border="0" /&gt;&lt;BR /&gt;&lt;BR /&gt;PS: on the image the blue symbol is the one with no text orientation rule, so you see the text upside down. The red one is with the always horizontal rule, and you see that the object rotates but the letter stays.&lt;BR /&gt;This is the code I used for the red one:&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;DEFINE STYLE "estilo" Arial, txtsize, 7, 0
STYLE estilo

! ------------------------------------------------------------------------------
! Text Rotation - Readable / Always Horizontal / Align with Symbol
! ------------------------------------------------------------------------------
r = request ("View_Rotangle", "", _angleViewRot)

! Actual rotation of the 2D symbol:	
_totalRotate	= (SYMB_ROTANGLE + _angleViewRot) MOD 360

! Count the number of transformations of the 
! coordinate system in different cases
_nTrans = 0					  
 
if iTypeTextRotation = 2 then					! Readable
    if (_totalRotate &amp;gt; (90 + EPS) &amp;amp; _totalRotate &amp;lt; (270 + EPS)) then
        rot2 180
        _nTrans = _nTrans + 1
    endif
else
    if iTypeTextRotation = 1 then				! Horizontal
        rot2 _totalRotate * (SYMB_MIRRORED - not(SYMB_MIRRORED))
        _nTrans = _nTrans + 1
    endif
endif

! ------------------------------------------------------------------------------
! Text
! ------------------------------------------------------------------------------

TEXT2 -0.035,0.04, txt

! ------------------------------------------------------------------------------
! Delete transformation after Text Rotation
! ------------------------------------------------------------------------------
del _nTrans
&lt;/PRE&gt;
&lt;/DIV&gt;</description>
    <pubDate>Mon, 26 Sep 2022 20:51:54 GMT</pubDate>
    <dc:creator>matleonii</dc:creator>
    <dc:date>2022-09-26T20:51:54Z</dc:date>
    <item>
      <title>Help with text orientation</title>
      <link>https://community.graphisoft.com/t5/GDL/Help-with-text-orientation/m-p/247427#M4440</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello everyone! I'm new to GDL and i'm working on a simple object that consist in a 2D symbol.&lt;BR /&gt;&lt;BR /&gt;The idea is to have a circle with a letter in it. I'd love to make the letter always horizontal, but always inside the circle. I guess I should move the rotation point to so the letter rotates on its center, and not in the origin (0,0), but I just could not manage to do so. Is there a way to do this? any help would be awesome!&lt;BR /&gt;&lt;BR /&gt;&lt;IMG src="https://dl3.pushbulletusercontent.com/OxRt5tl2tbPGSZnxwWMl6ptmQXnhtiPC/Screenshot_1.png" border="0" /&gt;&lt;BR /&gt;&lt;BR /&gt;PS: on the image the blue symbol is the one with no text orientation rule, so you see the text upside down. The red one is with the always horizontal rule, and you see that the object rotates but the letter stays.&lt;BR /&gt;This is the code I used for the red one:&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;DEFINE STYLE "estilo" Arial, txtsize, 7, 0
STYLE estilo

! ------------------------------------------------------------------------------
! Text Rotation - Readable / Always Horizontal / Align with Symbol
! ------------------------------------------------------------------------------
r = request ("View_Rotangle", "", _angleViewRot)

! Actual rotation of the 2D symbol:	
_totalRotate	= (SYMB_ROTANGLE + _angleViewRot) MOD 360

! Count the number of transformations of the 
! coordinate system in different cases
_nTrans = 0					  
 
if iTypeTextRotation = 2 then					! Readable
    if (_totalRotate &amp;gt; (90 + EPS) &amp;amp; _totalRotate &amp;lt; (270 + EPS)) then
        rot2 180
        _nTrans = _nTrans + 1
    endif
else
    if iTypeTextRotation = 1 then				! Horizontal
        rot2 _totalRotate * (SYMB_MIRRORED - not(SYMB_MIRRORED))
        _nTrans = _nTrans + 1
    endif
endif

! ------------------------------------------------------------------------------
! Text
! ------------------------------------------------------------------------------

TEXT2 -0.035,0.04, txt

! ------------------------------------------------------------------------------
! Delete transformation after Text Rotation
! ------------------------------------------------------------------------------
del _nTrans
&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Sep 2022 20:51:54 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Help-with-text-orientation/m-p/247427#M4440</guid>
      <dc:creator>matleonii</dc:creator>
      <dc:date>2022-09-26T20:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help with text orientation</title>
      <link>https://community.graphisoft.com/t5/GDL/Help-with-text-orientation/m-p/247428#M4441</link>
      <description>Use &lt;B&gt;Add2&lt;/B&gt; for your transformation before your &lt;B&gt;Text2&lt;/B&gt; command, then set your text to [0, 0]?&lt;BR /&gt;
&lt;BR /&gt;
You might also need to use a &lt;B&gt;Style&lt;/B&gt; command to set your text anchor to center.&lt;BR /&gt;
&lt;BR /&gt;

&lt;PRE&gt;ADD2 -0.035, 0.04
TEXT2 0 ,0, txt
DEL 1&lt;/PRE&gt;

&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ling.</description>
      <pubDate>Mon, 25 May 2020 05:12:17 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Help-with-text-orientation/m-p/247428#M4441</guid>
      <dc:creator>Lingwisyer</dc:creator>
      <dc:date>2020-05-25T05:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help with text orientation</title>
      <link>https://community.graphisoft.com/t5/GDL/Help-with-text-orientation/m-p/247429#M4442</link>
      <description>&lt;BLOCKQUOTE&gt;Lingwisyer wrote:&lt;BR /&gt;
Use &lt;B&gt;Add2&lt;/B&gt; for your transformation before your &lt;B&gt;Text2&lt;/B&gt; command, then set your text to [0, 0]?&lt;BR /&gt;
&lt;BR /&gt;
You might also need to use a &lt;B&gt;Style&lt;/B&gt; command to set your text anchor to center.&lt;BR /&gt;
&lt;BR /&gt;

&lt;PRE&gt;ADD2 -0.035, 0.04
TEXT2 0 ,0, txt
DEL 1&lt;/PRE&gt;

&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ling.
&lt;/BLOCKQUOTE&gt;

Thanks for your reply! But it did not work. the issue kept the same.</description>
      <pubDate>Mon, 25 May 2020 15:39:37 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Help-with-text-orientation/m-p/247429#M4442</guid>
      <dc:creator>matleonii</dc:creator>
      <dc:date>2020-05-25T15:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help with text orientation</title>
      <link>https://community.graphisoft.com/t5/GDL/Help-with-text-orientation/m-p/247430#M4443</link>
      <description>Found it!&lt;BR /&gt;
&lt;BR /&gt;
I was testing some with the codes and found a solution.&lt;BR /&gt;
&lt;BR /&gt;
changed the text part so that the origin would rotate with the object and the "unrotate" for the text to get on the right position.&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;ROT2 -SYMB_ROTANGLE

ADD2 0, 0.1

ROT2 SYMB_ROTANGLE

TEXT2 0 ,0, txt
DEL 1
&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 May 2020 15:56:11 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Help-with-text-orientation/m-p/247430#M4443</guid>
      <dc:creator>matleonii</dc:creator>
      <dc:date>2020-05-25T15:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help with text orientation</title>
      <link>https://community.graphisoft.com/t5/GDL/Help-with-text-orientation/m-p/247431#M4444</link>
      <description>&lt;BLOCKQUOTE&gt;matleonii wrote:&lt;BR /&gt;
But it did not work. the issue kept the same.
&lt;/BLOCKQUOTE&gt;

&lt;BR /&gt;
Works fine for me. I guess I simplified my explanation too much for you as the code line I wrote there is not a straight substitution as you did not provide the full code.&lt;BR /&gt;
&lt;BR /&gt;
See my test object enc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ling.</description>
      <pubDate>Tue, 26 May 2020 02:02:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Help-with-text-orientation/m-p/247431#M4444</guid>
      <dc:creator>Lingwisyer</dc:creator>
      <dc:date>2020-05-26T02:02:58Z</dc:date>
    </item>
  </channel>
</rss>

