! TITLE: ang_convert.mac (CALCULATION) ! ! ! OBJECTIVE: ! ! This sub-macro converts an angle value, or an angle value contained by ! a parameter, from its absolute positive value to its negative-valued ! equivalent; or vice-versa. ! ! ! COMMAND SYNTAX: ! ! (1) (2) (3) ! ANG_CONVERT, angle, cnvr_typ, new_parm ! ! ! ARGUMENTS: ! ! (1) angle = the angle dimension numerical value or angle parameter. ! ! (If it is desired to return the converted value back to ! the parameter entered into this argument, then this ! parameter must be enetered in this argument in single ! quotes.) ! ! (2) cnvr_typ = conversion type: ! ! 0 (or blank) = converts a negative valued angle to ! its positive-valued equivalent. ! ! 1 = converts a positive valued angle to its negative ! -valued equivalent. ! ! (3) new_parm = the new parameter name to assign the converted ! value. (input in single quotes) ! ! ! DESCRIPTION: ! ! An angle value, or parameter that is an angle value, is converted and ! returned through the parameter, ANG; the input parameter name or a new ! parameter name (argument 3). ! ! a.) If the 1st argument is a scalar parameter (not in quotes) or a ! numerical value (not a parameter), and argument 3 is not specified, ! the parameter ANG returns the converted angle value. ! ! b.) If the 1st argument is the character name of a parameter, and ! argument 3 is not specified, then the value (angle) of that ! parameter is converted and is returned to that parameter. ! ! NOTE: The character name must be input in single quotes in order to ! return the converted value back to the original paramter. ! ! If argument 3, the new parameter character name, is specified, then the ! converted value of argument 1 is returned in this new parameter. ! ! ! *get,prkey_,active,0,prkey /nopr ! ang1_=arg1 ! angle parameter/value to be converted dir_conv=arg2 ! direction of conversion newprm_=arg3 ! new parameter name ! *get,ptyp1_,parm,ang1_,type ! angle parameter type *get,ptyp2_,parm,newprm_,type ! new angle parameter type ! *if,ptyp1_,eq,3,then a1_=%ang1_% *endif ! *if,ptyp1_,eq,3,then ! *if,dir_conv,eq,0,then *if,a1_,lt,0,then ang=a1_+360 *else ang=a1_ *endif *else *if,a1_,gt,0,then ang=-(360-a1_) *else ang=a1_ *endif *endif ! *if,ptyp2_,ne,3,then %ang1_%=ang *else %newprm_%=ang *endif ! *set,ang, ! *elseif,ptyp1_,eq,0,then ! *if,dir_conv,eq,0,then *if,ang1_,lt,0,then ang=ang1_+360 *else ang=ang1_ *endif *else *if,ang1_,gt,0,then ang=-(360-ang1_) *else ang=ang1_ *endif *endif ! *if,ptyp2_,eq,3,then %newprm_%=ang *set,ang, *endif *endif ! *set,a1_, *set,ang1_, *set,dir_conv, *set,ptyp1_, *set,newprm_, ! *if,prkey_,eq,1,then /go *endif