home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 58
/
af058b.adf
/
PV21.lha
/
REXX
/
Measure.pvrx
< prev
next >
Wrap
Text File
|
1991-07-18
|
2KB
|
56 lines
/* Measure.pvrx
Copyright © 1991 by Stylus, Inc.
Author - Ross Cunniff & Jeff Blume
To run from its own User Menu item, add this line to
ProVector.pvrx: 'Define "Measure" "Measure MENU"'
To run from User/Rexxecute type "MENU" after the filename in the
macro file requester. Thus 'File' text gadget
should read "Measure.pvrx MENU".
*/
/* Get the argument list to see whether this is a MENU, or an OK */
arg arglist
Cmd = word(arglist,1)
/* Get the rexxmathlib.library */
if ~exists("LIBS:rexxmathlib.library") then do
'GetBool "Can not find REXXMATHLIB.LIBRARY" "Cancel" "Cancel"'
exit
end
else call addlib "rexxmathlib.library",0,-30,0
/* Always do this for a ProVector AREXX macro */
'Lock'
if RC ~= 0 then exit
if Cmd = 'MENU' then do
/* This was called directly from the menu */
'Prompt "Click points to measure:"'
'GetUserData 1 2 2 "Measure OK" ""'
end
if Cmd = 'OK' then do
/* This was called from GetUserData */
'EndPrompt'
'GetInputPoints Pts'
X0 = Pts.0.X; Y0 = Pts.0.Y
X1 = Pts.1.X; Y1 = Pts.1.Y
/* Next, calculate the parameters for the text string */
DX = X1 - X0; DY = Y1 - Y0
Dist = sqrt( DX*DX + DY*DY )
/* Convert scientific notation to a number mortals can relate to */
Exp = right(Dist,3) /* Exponent is rightmost 3 chars */
Len = length(Dist) /* Length of 'Dist' text string */
Mant = left(Dist,Len-4) /* Mantissa is length less "e" and exponent */
Dist = Mant * (10**Exp)
GetBool '"Distance = '||Dist||'"' OK OK
end
/* All done! Unlock ProVector */
'UnLock'