*get,prkey_,active,0,prkey
/nopr
multipro,'start',2
*cset,1,3,kpt_,'Enter KP
*cset,4,6,ln_,'Enter Line
*cset,61,62,'Calculates the distance bet','ween a KP and a line, along'
*cset,63,64,'the path of a line attach','ed to the KP.'
multipro,'end'
tol_=0.0001
prec_=4
entity_group
ksel,s,kp,,kpt_
lslk,s,0
*get,numlns_,line,,count
*if,numlns_,gt,1,then
multipro,'start',1
*cset,1,3,pthln_,'Line
*cset,61,62,'The number of lines attached',' to the KP is > 1.'
*cset,63,64,'Enter the line
multipro,'end'
*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
*msg,ui,%kpt_%,%ln_%,%pthln_%,%dpath_%
Distance Between ( KP %i , L %i, along path L %i ) = %g
*endif
entity_group,1
*set,tol_,
*set,prec_,
*set,ln_,
*set,kpt_,
*set,dpath_,
*set,kpLn1_,
*set,kpLn2_,
*set,pthln_,
*set,s_,
*set,alpha_,
*set,beta_,
*set,gamma_,
*set,kppath1_,
*set,kppath2_,
*set,num_,
*set,endkp_,
*set,numlns_,
*if,prkey_,eq,1,then
/go
*endif