! TITLE: kp_path_ln.mac (CALCULATION) ! ! ! OBJECTIVE: ! ! This GUI command macro calculates the linear distance between a keypoint ! and a line along the path of the crossing line. (The crossing path line ! is attached to the keypoint) ! ! ! COMMAND SYNTAX: ! ! (1) (2) (3) (4) (5) ! KP_PATH_LN, kp, line, path_ln, tol, prec ! ! ! ARGUMENTS: ! ! (1) kp = keypoint to measure distance from line. ! ! (2) line = line to measure distance from. ! ! (3) path_ln = the line along whose path the distance to the point ! of crossing is to be measured. ! ! (4) tol = zero tolerance value. If the calculated distance is ! less than this threshold value, the distance is assumed ! to be 0. (Default value is 0.0001) ! ! (5) prec = the decimal precision of 'dpath_'. This value is an ! integer value between 3 and 8, and is the number of ! decimal places of precision to output the value of ! 'dpath_'. (Default value is 4) ! ! ! DESCRIPTION: ! ! This macro calculates the linear distance between a keypoint and a line ! along a line attached to the keypoint, and crossing the specified line. ! This distance is to the point where the 2 lines cross (intersect), but ! do not share a keypoint at the point of intersection. Therefore, this ! macro is valid only for lines that cross/overlap each other, but are not ! attached; and the input lines are straight. This allows the user to calc- ! ulate the distance of any of the 4 endpoints of the 2 crossing lines from ! the point of crossing of the lines. ! ! If the specified keypoint is attached to more than 1 line, then the par- ! ticular line whose path crosses the line specified in the 2nd argument must ! be specified in 3rd prompt. ! ! The distance is output to the parameter: dpath_ ! ! ! ! *get,prkey_,active,0,prkey /nopr kpt_=arg1 ln_=arg2 tol_=arg4 prec_=arg5 ! *if,tol_,eq,0,then tol_=0.0001 *endif ! *if,prec_,eq,0,then prec_=4 *endif ! cm,kset_,kp cm,lset_,line ! ksel,s,kp,,kpt_ lslk,s,0 *get,numlns_,line,,count ! *if,numlns_,gt,1,then pthln_=arg3 *elseif,numlns_,eq,1,then get_max_entity pthln_=lm *endif ! cmsel,s,kset_ cmsel,s,lset_ ! *if,pthln_,ne,0,then *get,kppath1_,line,pthln_,kp,1 *get,kppath2_,line,pthln_,kp,2 ! *if,kppath1_,eq,kpt_,then endkp_=kppath2_ *else endkp_=kppath1_ *endif ! *get,kpLn1_,line,ln_,kp,1 *get,kpLn2_,line,ln_,kp,2 ! alpha_=anglek(kpt_,endkp_,kpLn1_) beta_=anglek(kpLn1_,kpLn2_,kpt_) gamma_=(180-((alpha_*dconv)+(beta_*dconv)))*rconv ! s_=distkp(kpt_,kpLn1_) ! dpath_=s_*(sin(beta_))/(sin(gamma_)) ! *if,abs(dpath_),lt,tol_,then dpath_=0 *else round_num,dpath_,prec_ dpath_=num_ *endif *endif ! init_entity_num cmsel,s,kset_ cmsel,s,lset_ ! lplot ! *set,tol_, *set,prec_, *set,ln_, *set,kpt_, *set,kpLn1_, *set,kpLn2_, *set,pthln_, *set,s_, *set,alpha_, *set,beta_, *set,gamma_, *set,kppath1_, *set,kppath2_, *set,num_, *set,endkp_, *set,numlns_, cmdele,kset_, cmdele,lset_, *if,prkey_,eq,1,then /go *endif