<?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 Right-justify 3D text? in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/right-justify-3d-text/m-p/13504521#M18904</link>
    <description>&lt;P&gt;&lt;I&gt;[ FlexSim 21.2.4 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;I use 3D "Text" under the "Visual" panel of the Library tab for an easy way to display counters, like showing the content of a queue going up, down, etc. next to the queue itself, stuck to the floor (Z=0) like a sticker. I sometimes use that trick as an alternative to the default floating block of 2D text info below each object, since the 3D text stays where I put it.&lt;/P&gt;
 &lt;P&gt;I do something like this in the Text Display code:&lt;/P&gt;
 &lt;P&gt;int numBoxes = Model.find("Box Queue").as(Object).stats.content.value;&lt;BR /&gt;string numBoxesStr = string.fromNum(numBoxes);&lt;BR /&gt;return numBoxesStr;&lt;/P&gt;
 &lt;P&gt;My question: By default, 3D text is left-justified. Thus as the number gets larger (from 1's to 10's to 100's to 1000's) it "grows" to the right, being anchored (justified) on the left.&lt;/P&gt;
 &lt;P&gt;Can 3D text be right-justified, i.e., as the number gets bigger it grows to the left?&lt;/P&gt;
 &lt;P&gt;I could probably come up with a blank padding trick (increase/decrease the text string front padding spaces on the fly depending on how many digits in the number are being displayed), but I wondered if there was an easier way.&lt;/P&gt;
 &lt;P&gt;Thanks to all.&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Thu, 04 Nov 2021 19:19:17 GMT</pubDate>
    <dc:creator>mike_mayer</dc:creator>
    <dc:date>2021-11-04T19:19:17Z</dc:date>
    <item>
      <title>Right-justify 3D text?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/right-justify-3d-text/m-p/13504521#M18904</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 21.2.4 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;I use 3D "Text" under the "Visual" panel of the Library tab for an easy way to display counters, like showing the content of a queue going up, down, etc. next to the queue itself, stuck to the floor (Z=0) like a sticker. I sometimes use that trick as an alternative to the default floating block of 2D text info below each object, since the 3D text stays where I put it.&lt;/P&gt;
 &lt;P&gt;I do something like this in the Text Display code:&lt;/P&gt;
 &lt;P&gt;int numBoxes = Model.find("Box Queue").as(Object).stats.content.value;&lt;BR /&gt;string numBoxesStr = string.fromNum(numBoxes);&lt;BR /&gt;return numBoxesStr;&lt;/P&gt;
 &lt;P&gt;My question: By default, 3D text is left-justified. Thus as the number gets larger (from 1's to 10's to 100's to 1000's) it "grows" to the right, being anchored (justified) on the left.&lt;/P&gt;
 &lt;P&gt;Can 3D text be right-justified, i.e., as the number gets bigger it grows to the left?&lt;/P&gt;
 &lt;P&gt;I could probably come up with a blank padding trick (increase/decrease the text string front padding spaces on the fly depending on how many digits in the number are being displayed), but I wondered if there was an easier way.&lt;/P&gt;
 &lt;P&gt;Thanks to all.&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Nov 2021 19:19:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/right-justify-3d-text/m-p/13504521#M18904</guid>
      <dc:creator>mike_mayer</dc:creator>
      <dc:date>2021-11-04T19:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Right-justify 3D text?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/right-justify-3d-text/m-p/13504522#M18905</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;The 3D text draws one character at a time, left-to-right, advancing the position based on the size of the character. There isn't an easy way to make it right-justified right now.&lt;/P&gt;&lt;P&gt;You could draw each character in your string right-to-left though instead of drawing the entire string:&lt;/P&gt;&lt;PRE&gt;fglTranslate(1, 0, 0);
drawtomodelscale(current);
fglTranslate(0, 0.1, 0.2);
string text = string.fromNum(current.text);
for (int c = text.length; c &amp;gt;= 1; c--) {
&lt;SPAN style="white-space:pre;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;fglTranslate(-0.12, 0, 0);
&lt;SPAN style="white-space:pre;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;drawtext(view, text.charAt(c), 0, 0, 0);
}&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1636062562902.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1507945i596AB430CAAD90DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="1636062562902.png" alt="1636062562902.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1636062572703.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1507946i29F839964D1A6C92/image-size/large?v=v2&amp;amp;px=999" role="button" title="1636062572703.png" alt="1636062572703.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/45603-text-right-to-left.fsm" target="_blank"&gt;text_right_to_left.fsm&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Nov 2021 21:49:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/right-justify-3d-text/m-p/13504522#M18905</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2021-11-04T21:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Right-justify 3D text?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/right-justify-3d-text/m-p/13504523#M18906</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;Thank you Phil - that's pretty clever.&lt;/P&gt;
 &lt;P&gt;I see one character at a time gives best control over what gets printed and where. This means I could also change the angle of the text reading direction if needed, and perhaps even compound angles in 3D space.&lt;/P&gt;
 &lt;P&gt;After my original post (and before I saw yours), I came up with a brute-force hack that seems to do the trick, for up to a 5-digit number (I'm not displaying any values greater than 99999).&lt;/P&gt;
 &lt;P&gt;It's rather limited though, and likely not entirely dependable for different fonts, sizes, etc. The font size I'm using is 1000 (model is in mm), so 1m i.e., the FlexSim default.&lt;/P&gt;
 &lt;PRE&gt;&lt;SPAN style="font-size: 14px; font-family: Verdana, Geneva, sans-serif;"&gt;int strlen = numBoxesStr.length;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 14px; font-family: Verdana, Geneva, sans-serif;"&gt;string strPad;
if (strlen == 1) strPad = "        "; // 8 blank spaces.
if (strlen == 2) strPad = "      "; &lt;SPAN style="color: rgb(65, 65, 65); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"&gt;// 6 blank spaces.&lt;/SPAN&gt;
if (strlen == 3) strPad = "    "; &lt;SPAN style="color: rgb(65, 65, 65); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"&gt;// 4 blank spaces.&lt;/SPAN&gt;
if (strlen == 4) strPad = "  "; &lt;SPAN style="color: rgb(65, 65, 65); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"&gt;// 2 blank spaces.&lt;/SPAN&gt;
if (strlen == 5) strPad = ""; &lt;SPAN style="color: rgb(65, 65, 65); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"&gt;// 0 blank spaces.&lt;/SPAN&gt;
return strPad + numBoxesStr;&lt;/SPAN&gt;&lt;/PRE&gt;
 &lt;P&gt;A "switch" statement based on strlen would have been another way to structure the same logic (and probably more efficient).&lt;/P&gt;
 &lt;P&gt;I also discovered string.padStart, which I played around with too.&lt;/P&gt;
 &lt;P&gt;Thanks.&lt;/P&gt;
 &lt;P&gt;Mike Mayer&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 Nov 2021 12:34:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/right-justify-3d-text/m-p/13504523#M18906</guid>
      <dc:creator>mike_mayer</dc:creator>
      <dc:date>2021-11-05T12:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Right-justify 3D text?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/right-justify-3d-text/m-p/13504524#M18907</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;&lt;A rel="user" href="#"&gt;@Mike Mayer&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;If you toggle your code with the code button &amp;lt;&amp;gt; it preserves formatting, including multiple spaces, and as a bonus gives you some syntax highlighting as well.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 Nov 2021 19:25:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/right-justify-3d-text/m-p/13504524#M18907</guid>
      <dc:creator>Ben_WilsonADSK</dc:creator>
      <dc:date>2021-11-05T19:25:00Z</dc:date>
    </item>
  </channel>
</rss>

