*get,prkey_,active,0,prkey
/nopr
csnum_=arg1
skp_=arg2
prec_=arg3
prm_=arg4
*get,acs1_,active,,csys
*get,ptyp_,parm,csnum_,type
*if,ptyp_,eq,3,then
*if,csnum_,eq,'a',then
csnum_=acs1_
*else
csnum_=0
*endif
*endif
*if,prec_,eq,0,then
prec_=3
*endif
cm,lnset_,line
*get,numlns_,line,,count
ksll,s
*get,kpcnt_,kp,,count
tol_=10**(-(prec_+1))
csys,csnum_
/output,pf_coord,mac
*msg,info
/output
*if,prm_,eq,0,then
/output,pf_coord,mac,,append
*msg,info,%csnum_%
Keypoint Coordinates Measured From: C.S. = %i
/output
*elseif,prm_,eq,1,then
/output,pf_coord,mac,,append
*msg,info,%csnum_%
Keypoint Coordinate Parameters Measured From: C.S. = %i
/output
*endif
/output,pf_coord,mac,,append
*msg,info
*msg,info
KP
*msg,info
/output
*set,kp_1st_,
*do,aaa_,1,numlns_,1
ksel,s,kp,,skp_
dx__=kx(skp_)
*if,abs(dx__),lt,tol_,then
dx__=0
*else
round_num,dx__,prec_
dx__=num_
*endif
dy__=ky(skp_)
*if,abs(dy__),lt,tol_,then
dy__=0
*else
round_num,dy__,prec_
dy__=num_
*endif
dz__=kz(skp_)
*if,abs(dz__),lt,tol_,then
dz__=0
*else
round_num,dz__,prec_
dz__=num_
*endif
*if,skp_,ne,kp_1st_,then
*if,prm_,eq,0,then
/output,pf_coord,mac,,append
*msg,info,skp_,%dx__%,%dy__%,%dz__%
%i --- k,,%g, %g, %g
/output
*elseif,prm_,eq,1,then
/output,pf_coord,mac,,append
*msg,info,skp_
Keypoint
*msg,info,%dx__%
Dx0 =%g
*msg,info,%dy__%
Dy0 =%g
*msg,info,%dz__%
Dz0 =%g
*msg,info
/output
*endif
*endif
ln_skip=mod(aaa_,5)
*if,ln_skip,eq,0,then
*if,aaa_,ne,1,then
/output,pf_coord,mac,,append
*msg,info
/output
*endif
*endif
cmsel,s,lnset_
lslk,r,0
*if,aaa_,eq,1,then
kp_1st_=skp_
get_max_entity
prfln_=lm
*else
lsel,u,line,,prfln_
get_max_entity
prfln_=lm
*endif
*get,kp11_,line,prfln_,kp,1
*get,kp12_,line,prfln_,kp,2
*if,skp_,eq,kp11_,then
juncpt_=kp12_
*else
juncpt_=kp11_
*endif
skp_=juncpt_
*set,juncpt_
*if,aaa_,eq,numlns_,then
*if,skp_,ne,kp_1st_,then
dx__=kx(skp_)
*if,abs(dx__),lt,tol_,then
dx__=0
*else
round_num,dx__,prec_
dx__=num_
*endif
dy__=ky(skp_)
*if,abs(dy__),lt,tol_,then
dy__=0
*else
round_num,dy__,prec_
dy__=num_
*endif
dz__=kz(skp_)
*if,abs(dz__),lt,tol_,then
dz__=0
*else
round_num,dz__,prec_
dz__=num_
*endif
*if,prm_,eq,0,then
/output,pf_coord,mac,,append
*msg,info,skp_,%dx__%,%dy__%,%dz__%
%i --- k,,%g, %g, %g
/output
*elseif,prm_,eq,1,then
/output,pf_coord,mac,,append
*msg,info,skp_
Keypoint
*msg,info,%dx__%
Dx0 =%g
*msg,info,%dy__%
Dy0 =%g
*msg,info,%dz__%
Dz0 =%g
*msg,info
/output
*endif
*endif
*endif
*enddo
init_entity_num
*if,prm_,eq,1,then
/output,pf_coord,mac,,append
*msg,info
/output
*do,aaa_,1,kpcnt_,1
/output,pf_coord,mac,,append
*msg,info
k,,Dx0 ,Dy0 ,Dz0
/output
ln_skip=mod(aaa_,5)
*if,ln_skip,eq,0,then
*if,aaa_,ne,1,then
/output,pf_coord,mac,,append
*msg,info
/output
*endif
*endif
*enddo
*endif
cmsel,s,lnset_
csys,acs1_
lplot
*set,csnum_,
*set,acs1_,
*set,skp_,
*set,prfln_,
*set,juncpt_,
*set,aaa_,
*set,kp11_,
*set,kp12_,
*set,kp_1st_,
*set,dx__,
*set,dy__,
*set,dz__,
*set,ptyp_,
*set,num_,
*set,tol_,
*set,prec_,
*set,numlns_,
*set,prm_,
*set,ln_skip,
*set,kpcnt_,
cmdele,lnset_
*if,prkey_,eq,1,then
/go
*endif