/* LAYZMBRD (LAY) -- Zoom to Layout Board Outline */ /* LAYZMBRD (LAY) -- Zoom auf Layout-Platinenumrandung */ /* -- INTENDED FOR KEY-CALL USE -- */ /* // Copyright (c) 1994-2012 Oliver Bartels F+E, Muenchen // Author: Manfred Baumeister // Changes History: // rl (120427) RELEASED FOR BAE V7.8. // rl (101019) RELEASED FOR BAE V7.6. // rl (091021) RELEASED FOR BAE V7.4. // rl (081014) RELEASED FOR BAE V7.2. // rl (071029) RELEASED FOR BAE V7.0. // rl (060829) RELEASED FOR BAE V6.8. // rl (050906) RELEASED FOR BAE V6.6. // rl (040811) RELEASED FOR BAE V6.4. // rl (030110) BUGFIX: // Fixed problem with call within menu functions. // rl (030904) RELEASED FOR BAE V6.2. // rl (021209) RELEASED FOR BAE V6.0. // rl (021021) ENHANCEMENT: // Improved zoom to arc shaped boundaries. // rl (020823) BUGFIX: // Fixed problem with outline arcs exceeding element boundary. // rl (020618) RELEASED FOR BAE V5.4. // rl (010625) RELEASED FOR BAE V5.0. // rl (010320) ENHANCEMENT: // Added optional parameter settings from bae.ini file. // rl (000509) RELEASED FOR BAE V4.6. // rl (000113) BUGFIX: // Fixed pick problem for layouts without outline. // rl (990625) RELEASED FOR BAE V4.4. // rl (980910) RELEASED FOR BAE V4.2. // rl (970929) RELEASED FOR BAE V4.0. // mb (960919) RELEASED FOR BAE V3.4. // mb (95) RELEASED FOR BAE V3.2. // mb (94) RELEASED FOR BAE V3.0. // mb (94) ORIGINAL CODING; to replace GEDZMBRD, CAMZMBRD. // // DESCRIPTION // // The layzmbrd User Language program accomplishes a zoom // to the board outline of the currently loaded layout. */ // Includes #include "lay.ulh" // User Language layout utilities // Disable undo state request #pragma ULCALLERNOUNDO // INI file parameter name definitions #define PAR_WSSHRINK "WSSHRINK_LAY" // Workspace shrink value [m] // Global definitions double WSSHRINK = bae_inidblval(PAR_WSSHRINK,0.0001) /* Workspace shrink value */; // Main program void main() { double lx,ly,ux,uy /* Zoom boundaries */; double px = 0 /* Previous X coordinate */; double py = 0 /* Previous Y coordinate */; double r /* Arc radius */; index L_POLY poly /* Polygon index */; index L_POINT point /* Point index */; int firstflag = 1 /* First polygon point flag */; int rangedis /* Range check disabled flag */; // Set default boundaries lx=bae_planwslx(); ly=bae_planwsly(); ux=bae_planwsux(); uy=bae_planwsuy(); // Loop for polygons (board outline is always first polygon) forall (poly) { // Abort if no board outline if (poly.TYP!=L_POLYBRDOUT) break; if (bae_getactmenu()==(-1) || (bae_getactmenu()>=100 && bae_getactmenu()<200)) { // Loop for polygon points bae_clearpoints(); forall (point of poly) // Store point to internal list bae_storepoint(point.X,point.Y,point.TYP); // Get the polygon range bae_getpolyrange(lx,ly,ux,uy); } else { // Loop for polygon points forall (point of poly) { // Test if this is the first point if (firstflag) { // Init boundaries; lx=point.X; ly=point.Y; ux=point.X; uy=point.Y; // Reset first point flag firstflag=0; } else { // Get arc radius and ajust boundaries r= point.TYP==0 ? 0.0 : dist(px,py,point.X,point.Y); if (lx>(point.X-r)) lx=point.X-r; if (ux<(point.X+r)) ux=point.X+r; if (ly>(point.Y-r)) ly=point.Y-r; if (uy<(point.Y+r)) uy=point.Y+r; } // Buffer coordinates px=point.X; py=point.Y; } } // Done break; } // Check the boundaries if (lx<(bae_planwslx()+WSSHRINK)) lx=bae_planwslx()+WSSHRINK; if (ly<(bae_planwsly()+WSSHRINK)) ly=bae_planwsly()+WSSHRINK; if (ux>(bae_planwsux()-WSSHRINK)) ux=bae_planwsux()-WSSHRINK; if (uy>(bae_planwsuy()-WSSHRINK)) uy=bae_planwsuy()-WSSHRINK; // Disable range check bae_getintpar(0,rangedis); bae_setintpar(0,1); // Zoom to calculated boundaries bae_clriactqueue(); bae_storemouseiact(1,lx,ly,0,LMB); bae_storemouseiact(1,ux,uy,0,LMB); call(MNU_BAEZOOMWND); // Restore old range check state bae_setintpar(0,rangedis); } // User Language program end