Post Reply 
Result justified?
06-07-2015, 07:54 PM
Post: #1
Result justified?
Hello all,

how can i make that result justified.
See at the Picture!

Best Regards
Heino


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
06-07-2015, 07:58 PM
Post: #2
RE: Result justified?
EXPORT KorTrans()
BEGIN
LOCAL X,Y,φ,Xs,Ys;
RECT_P();

INPUT({{X,[0],{20,15,0}},
{Y,[0],{20,15,1}},
{φ,[0],{20,15,2}}},
"Koordinatentransformation",
{"X [KN]","Y [KN]","φ [°]"},
{"","",""});

Xs:=ROUND((X*COS(φ)-Y*SIN(φ)),2);
Ys:=ROUND((X*SIN(φ)+Y*COS(φ)),2);

TEXTOUT_P(Xs,150,25);
TEXTOUT_P(Ys,150,50);

FREEZE;

END;
Find all posts by this user
Quote this message in a reply
06-07-2015, 11:09 PM
Post: #3
RE: Result justified?
Not sure if anything here will answer your question:

Code:

EXPORT KorTrans()
BEGIN
  LOCAL X,Y,φ,Xs,Ys;
  local black:=rgb(0,0,0);

//  Home variable settings
  HAngle:=1;  //  Set angle mode to degrees
  HDigits:=2; //  Set Digits to 2

  RECT_P();

  INPUT({{X,[0],{20,15,0}},
        {Y,[0],{20,15,1}},
        {φ,[0],{20,15,2}}},
        "Koordinatentransformation",
        {"X [KN]","Y [KN]","φ [°]"},
        {"","",""});

  Xs:=ROUND((X*COS(φ)-Y*SIN(φ)),2);  //  Angle mode is degrees
  Ys:=ROUND((X*SIN(φ)+Y*COS(φ)),2);

  TEXTOUT_P(Xs,150,25);  
  TEXTOUT_P(Ys,150,50);

//  Generate the right side vertical bar
  line_p(183,22,183,65);  
  line_p(184,22,184,65);
  line_p(185,22,185,65);

  FREEZE;
END;


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
06-08-2015, 09:07 AM
Post: #4
RE: Result justified?
Hello DrD,

thank for your answer.

You are right it`s degree.

But I mean:

The output figures should be aligned to the right side, no matter if they have a positive or negative sign.
Which settings have to be changed to achieve that?

Best Regards
Heino


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
06-08-2015, 05:46 PM (This post was last modified: 06-08-2015 05:49 PM by eried.)
Post: #5
RE: Result justified?
(06-08-2015 09:07 AM)Heino Wrote:  Hello DrD,

thank for your answer.

You are right it`s degree.

But I mean:

The output figures should be aligned to the right side, no matter if they have a positive or negative sign.
Which settings have to be changed to achieve that?

Best Regards
Heino

There is no setting to do that, but you can measure the output first:
Code:
TEXTOUTR(txt,x,y)
BEGIN LOCAL v2,c,b,w,v1;v2:=100;c:=RGB(255,0,0);b:=RGB(255,255,0);w:=RGB(0,255,0);
dimgrob_p(G1,v2,1,c);TEXTOUT_P(txt,G1,0,0,0,b,v2,w);FOR v1 FROM 3 TO v2 DO 
if GETPIX_P(G1,v1,0)==c then break;END;END;TEXTOUT_P(txt,x-v1,y);END;

EXPORT KorTrans()
BEGIN
  LOCAL X,Y,φ,Xs,Ys;
  local black:=rgb(0,0,0);
  
  //  Home variable settings
  HAngle:=1;  //  Set angle mode to degrees
  HDigits:=2; //  Set Digits to 2
  
  RECT_P();
  
  INPUT({{X,[0],{20,15,0}},
  {Y,[0],{20,15,1}},
  {φ,[0],{20,15,2}}},
  "Koordinatentransformation",
  {"X [KN]","Y [KN]","φ [°]"},
  {"","",""});
  
  Xs:=ROUND((X*COS(φ)-Y*SIN(φ)),2);  //  Angle mode is degrees
  Ys:=ROUND((X*SIN(φ)+Y*COS(φ)),2);
  
  
  TEXTOUTR(Xs,150,25);
  TEXTOUTR(Ys,150,50);
  
  FREEZE;
END;

   

My website: erwin.ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
06-08-2015, 07:28 PM
Post: #6
RE: Result justified?
Hello eried,

this is exactly what i was looking for.
Many Thanks to you and to DrD.

Best Regards Heino
Find all posts by this user
Quote this message in a reply
06-08-2015, 09:23 PM
Post: #7
RE: Result justified?
Perhaps you can use the size() to advantage:
Code:

EXPORT KorTrans()
BEGIN
  LOCAL X,Y,φ,Xs,Ys;
  local c,d;               // Temps for string converted values
  local black:=rgb(0,0,0);
  
  //  Home variable settings
  HAngle:=1;  //  Set angle mode to degrees
  HDigits:=2; //  Set Digits to 2
  
  RECT_P();
  
  INPUT({{X,[0],{20,15,0}},
  {Y,[0],{20,15,1}},
  {φ,[0],{20,15,2}}},
  "Koordinatentransformation",
  {"X [KN]","Y [KN]","φ [°]"},
  {"","",""});
  
  Xs:=ROUND((X*COS(φ)-Y*SIN(φ)),2);  //  Angle mode is degrees
  Ys:=ROUND((X*SIN(φ)+Y*COS(φ)),2);

  c:=string(Xs); d:=string(Ys); 

  TEXTOUT_P(c,150-4.3*size(c),25);     //  Offset by size of string
  TEXTOUT_P(d,150-4.3*size(d),50);
  
  
  //TEXTOUTR(Xs,150,25);
  //TEXTOUTR(Ys,150,50);
  
  FREEZE;
END;


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)