rem Written by Brian Ott & Hans Winkler rem Arc_2_V1.cdl rem double v1angtol int ldicke pivalue = 3.141592653589793 array vmx[9] c_cview = @cview modarc = 0 sweeptol = .01 set cview, 1 if (ldicke < 1) ldicke = 1 goto start :newmenu GETMENU "Select Option", "Linewidth", "Chg 0to1°", "-", "-", "-", "-", "-", "-", "Prog Info" if ((@key == -3)||(@key == -2)) goto start if (@key == 1) goto change_linewidth if (@key == 2) goto newplane if (@key == 9) reg_code = 1 if (@key == 9) goto reg_screen if ((@key > 2) && (@key < 9)) goto newmenu :change_linewidth GETINT "Enter a new Linewidth:", ldicke, ldicke if ((@key == -3)||(@key == -2)) goto start if ((ldicke < 1) || (ldicke > 15)) goto witdth_error if ((ldicke == 1) || (ldicke == 3) || (ldicke == 5) || (ldicke == 7) ||\ (ldicke == 9) || (ldicke == 11) || (ldicke == 13) || (ldicke == 15)) goto start :witdth_error pause "Only odd #'s are valid: 1 thru 15.." goto change_linewidth :newplane GETFLT "Enter new Plane Angle for processing Arcs :", v1angtol, v1angtol if ((v1angtol < 0)||(v1angtol > 1)) pause "Angle must be between 0° and 1° " if ((v1angtol < 0)||(v1angtol > 1)) goto newplane :start GETMENU "Choose Arc(s) to be changed",\ "Single", "Chain", "Window", "Polygon", "Group", "Plane", "All Dsp", "-", "Next Page",, 3 if ((@key == -3)||(@key == -2)) goto exit if ((@key >= 1)&&(@key <= 7)) goto selection if (@key == 8) goto start if (@key == 9) goto newmenu :selection SET mask, 3 GETENTM @key, element quant = 0 v1angtol = cos(v1angtol) pause "%.10f is v1angtol", v1angtol :entities if ((quant = quant+1) > element) goto exit GETNEXT enttype, ,id :test vw = @intdat[8] GETVIEW vw,vmx view 100, vmx[0], vmx[1], vmx[2], vmx[3], vmx[4], vmx[5], vmx[6], vmx[7], vmx[8] CALL cdlv2sysv, 100, vw :variables lev = @intdat[4] ltyp = @intdat[5] col = @intdat[3] rem lwid = @intdat[7] c4x = @fltdat[0] c4y = @fltdat[1] c4z = @fltdat[2] rad = @fltdat[3] ang1 = 180.0 *@fltdat[4]/pivalue ang2 = 180.0 *@fltdat[5]/pivalue+ang1 if ((ang2 - ang1) < sweeptol) goto entities if ((vw == 1)&&(ang1 < 0)) goto viewone if ((vw == 1)&&(ang2 < 0)) goto viewone if (((vw == 1)&&(ang1 >= 0)&&(ang2 >= 0))) goto entities rem /* Check angle between Arc and cplane1 */ CALL dotprod, vmx[2],vmx[5],vmx[8], 0, 0, 1, vwang if (abs(vwang) < v1angtol) goto entities if (vwang < 0) goto r_view4 goto r_view1 :viewone if (ang1 < 0) ang1 = 360-(abs(ang1)) if (ang2 < 0) ang2 = 360-(abs(ang2)) DELENT ARC c4x,c4y,c4z,rad,ang1,ang2,,col,lev,ltyp,,,,ldicke modarc = modarc+1 goto entities :r_view4 rem /* Calculate arc endpoint positions using arc view coordinates */ array endpt[2][3] endpt[0][0] = rad*cos(ang1)+@fltdat[0] endpt[0][1] = rad*sin(ang1)+@fltdat[1] endpt[0][2] = @fltdat[2] endpt[1][0] = rad*cos(ang2)+@fltdat[0] endpt[1][1] = rad*sin(ang2)+@fltdat[1] endpt[1][2] = @fltdat[2] rem /* Convert arc endpoints to View 1 coordinates */ CALL xfmvw, vmx, endpt[0][0], endpt[0][1], endpt[0][2], x1, y1, z1 CALL xfmvw, vmx, endpt[1][0], endpt[1][1], endpt[1][2], x2, y2, z2 CALL xfmvw,vmx,c4x,c4y,c4z,wx,wy,wz CALL atan3,y1-wy,x1-wx,angle1 angle1 = abs(180.0 *angle1/pivalue) CALL atan3,y2-wy,x2-wx,angle2 angle2 = abs(180.0 *angle2/pivalue) if (((abs(angle2 - angle1)) < sweeptol) || ((abs((abs(angle2 - angle1)) - 360)) < sweeptol)) goto drawcircle DELENT ARC wx,wy,wz,rad,angle2,angle1,,col,lev,ltyp,,,,ldicke modarc = modarc+1 goto entities :drawcircle DELENT CIRCLE wx,wy,wz,rad,,col,lev,ltyp,,,,ldicke modarc = modarc+1 goto entities :r_view1 rem /* Calculate arc endpoint positions using arc view coordinates */ array endpt[2][3] endpt[0][0] = rad*cos(ang1)+@fltdat[0] endpt[0][1] = rad*sin(ang1)+@fltdat[1] endpt[0][2] = @fltdat[2] endpt[1][0] = rad*cos(ang2)+@fltdat[0] endpt[1][1] = rad*sin(ang2)+@fltdat[1] endpt[1][2] = @fltdat[2] rem /* Convert arc endpoints to View 1 coordinates */ CALL xfmvw, vmx, endpt[0][0], endpt[0][1], endpt[0][2], x1, y1, z1 CALL xfmvw, vmx, endpt[1][0], endpt[1][1], endpt[1][2], x2, y2, z2 CALL xfmvw,vmx,c4x,c4y,c4z,wx,wy,wz CALL atan3,y1-wy,x1-wx,angle1 angle1 = abs(180.0 *angle1/pivalue) CALL atan3,y2-wy,x2-wx,angle2 angle2 = abs(180.0 *angle2/pivalue) DELENT ARC wx,wy,wz,rad,angle1,angle2,,col,lev,ltyp,,,,ldicke modarc = modarc+1 goto entities :exit SET cview, c_cview DRAWENT -1 PAUSE " '%d' Arc(s) processed, '%d' Arc(s) modified", element, modarc :sec_exit v1angtol = acos(v1angtol) CLEAR pivalue, vmx, c_cview, modarc, element, quant, vw, lev, ltyp, col CLEAR rad, ang1, ang2, angle1, angle2, sweeptol, enttype, id CLEAR endpt, x1, y1, z1, x2, y2, z2, wx, wy, wz, c4x, c4y, c4z, vwang exit