06-07-2015, 07:54 PM
06-07-2015, 07:58 PM
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;
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;
06-07-2015, 11:09 PM
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;
06-08-2015, 09:07 AM
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
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
06-08-2015, 05:46 PM
(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;
[attachment=2148]
06-08-2015, 07:28 PM
Hello eried,
this is exactly what i was looking for.
Many Thanks to you and to DrD.
Best Regards Heino
this is exactly what i was looking for.
Many Thanks to you and to DrD.
Best Regards Heino
06-08-2015, 09:23 PM
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;