rem ********************* Ang_2Ln.cdl *********************** rem Copy Right by International Technology Transfer Corp. rem revision 1.0 7/30/99 rem Angle between 2 lines rem Procedure rem 1. Select 1st Line rem 2. Select 2nd Line rem 3. Display angle rem ******************************************************************** clear :start getent "Select First Line",enttype on (@key + 3) goto exit,start, if (enttype!=2) goto start x1 = @fltdat[0] y1 = @fltdat[1] z1 = @fltdat[2] x2 = @fltdat[3] y2 = @fltdat[4] z2 = @fltdat[5] f1 = x2 - x1 g1 = y2 - y1 h1 = z2 - z1 :second getent "Select Second Line",enttype on (@key + 3) goto exit, start, second, if (enttype!=2) goto second x3 = @fltdat[0] y3 = @fltdat[1] z3 = @fltdat[2] x4 = @fltdat[3] y4 = @fltdat[4] z4 = @fltdat[5] f2 = x4 - x3 g2 = y4 - y3 h2 = z4 - z3 r1 = sqrt(f1 * f1 + g1 * g1 + h1 * h1) r2 = sqrt(f2 * f2 + g2 * g2 + h2 * h2) rem from following equation rem cos(angle) = (f1*f2 + g1*g2 + h1*h2) / (r1 * r2) ang = acos( (f1*f2 + g1*g2 + h1*h2) / (r1 * r2) ) if (ang>90) ang = 180 - ang pause "Angle= %.3f", ang goto start :exit