/* SCMPCR (SCM) -- SCM Report */ /* SCMPCR (SCM) -- SCM-Report */ /* -- INTENDED FOR KEY-CALL USE -- */ /* // Copyright (c) 1993-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 (090803) ENHANCEMENT: // Added standard sheet size recognition to report. // 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 (030904) RELEASED FOR BAE V6.2. // rl (021209) RELEASED FOR BAE V6.0. // rl (020618) RELEASED FOR BAE V5.4. // rl (010625) RELEASED FOR BAE V5.0. // rl (000509) RELEASED FOR BAE V4.6. // rl (990625) RELEASED FOR BAE V4.4. // rl (980910) RELEASED FOR BAE V4.2. // mb (980713) ENHANCEMENT: // Dynamic multi-language support introduced. // rl (970929) RELEASED FOR BAE V4.0. // mb (960919) RELEASED FOR BAE V3.4. // mb (951004) IMPROVEMENT: // Introduced Symbol/Label/Pin count to report header. // Providing SORTED symbol/pin lists. // mb (95) RELEASED FOR BAE V3.2. // mb (94) RELEASED FOR BAE V3.0. // mb (93) RELEASED FOR BAE V2.6. // mb (93) ORIGINAL CODING. // // DESCRIPTION // // The scmpcr User Language program provides detailed information // on the currently loaded SCM element such as DDB file name, // element name, block name of hierarchical sheet, plan origin // coordinates, element boundary coordinates, element size, reference // listing (symbols/labels on sheet, markers on symbol/label). // The report output is directed to a popup menu with file output // option. */ // Includes #include "pop.ulh" // User Language popup utilities #include "scm.ulh" // User Language SCM utilities // Disable undo state request #pragma ULCALLERNOUNDO // Messages string REPHEADER = M("%s Report :","%s Report :"); string REPFILE = M("Datei-Name .........: '%s'", "File Name ..........: '%s'"); string REPELEM = M("Element-Name .......: '%s'", "Element Name .......: '%s'"); string REPBLOCK = M("Block-Name .........: '%s'", "Block Name .........: '%s'"); string REPBLOCKREF = M("Block-Referenzname .: '%s'", "Block Reference Name: '%s'"); string REPNAMEPAT = M("Symbolname Muster ..: '%s'", "Part Name Pattern ..: '%s'"); string REPTAGMODE = M("Symbol Tagmode .....: '%s'", "Symbol Tag Mode ....: '%s'"); string REPSAVE = M("Plan gesichert .....: %s", "Element saved ......: %s"); string REPORIG = M("Null-Punkt .........: %8.3f,%8.3f %s", "Origin .............: %8.3f,%8.3f %s"); string REPUBND = M("Obere Grenze .......: %8.3f,%8.3f %s", "Upper Boundary .....: %8.3f,%8.3f %s"); string REPLBND = M("Untere Grenze ......: %8.3f,%8.3f %s", "Lower Boundary .....: %8.3f,%8.3f %s"); string REPSIZE = M("Plan-Groesse .......: %8.3f,%8.3f %s", "Element Size........: %8.3f,%8.3f %s"); string REPSYMCNT = M("Anzahl Symbole .....: %d", "Symbol Count .......: %d"); string REPLABCNT = M("Anzahl Labels ......: %d", "Label Count ........: %d"); string REPPINCNT = M("Anzahl Pins ........: %d", "Pin Count ..........: %d"); string REPA4P = M("A4 Hochformat","A4 Portrait"); string REPA4L = M("A4 Querformat","A4 Landscape"); string REPA3P = M("A3 Hochformat","A3 Portrait"); string REPA3L = M("A3 Querformat","A3 Landscape"); string REPA2P = M("A2 Hochformat","A2 Portrait"); string REPA2L = M("A2 Querformat","A2 Landscape"); string REPA1P = M("A1 Hochformat","A1 Portrait"); string REPA1L = M("A1 Querformat","A1 Landscape"); string REPA0P = M("A0 Hochformat","A0 Portrait"); string REPA0L = M("A0 Querformat","A0 Landscape"); string REPLETTERP = M("Letter Hochformat","Letter Portrait"); string REPLETTERL = M("Letter Querformat","Letter Landscape"); string REPTABLOIDP = M("Tabloid Hochformat","Tabloid Portrait"); string REPTABLOIDL = M("Tabloid Querformat","Tabloid Landscape"); string REPTAGSTD = M("Standard Symbol","Standard Symbol"); string REPTAGVIRT = M("Virtuelles Tag","Virtual Tag"); string REPTAGNETL = M("Netzlisten Tag","Netlist Tag"); string REPPTSYMTAG = M("Symbol Tag","Symbol Tag"); string REPPTPINTAG = M("Pin Tag","Pin Tag"); string REPPTNETTAG = M("Netz Tag","Net Tag"); string REPPTNPNTAG = M("Netzpin Tag","Net Pin Tag"); string REPPTNARTAG = M("Netzbereich Tag","Net Area Tag"); string REPPTPARTAG = M("Bauteilbereich Tag","Part Area Tag"); string REPPTILL = M("Unbekannter Tagtyp","Unknown Tag Type"); string ITMYES = M("ja","yes"); string ITMNO = M("nein","no"); string ITMHDSYM = M("Sym./Lab.","Sym./Lab."); string ITMHDPIN = M("Pin","Pin"); string ITMHDMRK = M("Marker","Marker"); string ITMHDMAC = M("Makro","Macro"); string ITMLABEL = M("LABEL","LABEL"); #define FMTHEADUL "%.*s" #define FMTNREFH1 "%-*s %-*s %8s %8s Rot/Mirr" #define FMTNREFH2 "%.*s %.*s ======== ======== ========" #define FMTNREF "%-*s %-*s %8.3f %8.3f %6.2f/%1d" #define ITMULINE "========================================" // Destination unit designators string UNIT = bae_getcoorddisp() ? "[\"]" : "[mm]" /* Units designator */; double ITOB = baecvtl(1.0) /* Scale fact. int. to BAE disp. */; // Standard plan sizes #define A0W 0.841 // A0 paper width #define A0H 1.189 // A0 paper height #define A1W 0.594 // A1 paper width #define A1H 0.841 // A1 paper height #define A2W 0.420 // A2 paper width #define A2H 0.594 // A2 paper height #define A3W 0.297 // A3 paper width #define A3H 0.420 // A3 paper height #define A4W 0.210 // A4 paper width #define A4H 0.297 // A4 paper height #define LW 0.2159 // Letter paper width #define LH 0.2794 // Letter paper height #define TW 0.2794 // Tabloid paper width #define TH 0.4318 // Tabloid paper height #define SMALLVAL 0.000001 // Small compare value // Globals double nx = bae_planwsnx()/* Plan origin X coordinate */; double ny = bae_planwsny()/* Plan origin Y coordinate */; double ux = bae_planwsux()/* Plan upper X coordinate */; double uy = bae_planwsuy()/* Plan upper Y coordinate */; double lx = bae_planwslx()/* Plan lower X coordinate */; double ly = bae_planwsly()/* Plan lower Y coordinate */; int nrefcnt /* Named ref. (part/pin) count */; int labelcnt /* Label count */; int lnam,lmac /* Output field lengths */; STRINGS headl /* Header list */; int headn = 0 /* Header count */; STRINGS entryl /* Entry list */; int entryn = 0 /* Entry count */; int ddbcl = bae_planddbclass() /* Current element class */; // Main program void main() { string blkrname /* Block reference name */; string namepat /* Symbol name pattern */; double w, h /* Plan dimensions */; int mc = 0 /* Requested popup column count */; int tagmode /* Symbol/label tag mode */; int i /* Loop variable */; // Print the plan characteristics sprintf(headl[0],REPHEADER,ddbclassname(ddbcl)); sprintf(headl[1],FMTHEADUL,strlen(headl[0]),ITMULINE); sprintf(headl[2],REPFILE,bae_planfname()); sprintf(headl[3],REPELEM,bae_planename()); headn=4; if (ddbcl==DDBCLSCM && !cap_blocktopflag()) { sprintf(headl[headn],REPBLOCK,cap_blockname()); headn++; scm_getstrpar(11,blkrname); sprintf(headl[headn],REPBLOCKREF,blkrname); headn++; } if (ddbcl==DDBCLSSYM) { scm_getstrpar(5,namepat); if (namepat!="") { sprintf(headl[headn],REPNAMEPAT,namepat); headn++; } } if (ddbcl==DDBCLSSYM || ddbcl==DDBCLSLAB) { scm_getintpar(40,tagmode); switch (tagmode) { case 1 : namepat=REPTAGVIRT; break; case 2 : namepat=REPTAGNETL; break; case 0 : default : namepat=REPTAGSTD; } if (namepat!="") { sprintf(headl[headn],REPTAGMODE,namepat); headn++; } } sprintf(headl[headn],REPSAVE,bae_plannotsaved()?ITMNO:ITMYES); sprintf(headl[headn+1],REPORIG,ITOB*nx,ITOB*ny,UNIT); sprintf(headl[headn+2],REPUBND,ITOB*ux,ITOB*uy,UNIT); sprintf(headl[headn+3],REPLBND,ITOB*lx,ITOB*ly,UNIT); w=ux-lx; h=uy-ly; sprintf(headl[headn+4],REPSIZE,ITOB*w,ITOB*h,UNIT); if (fabs(w-A4W)<=SMALLVAL && fabs(h-A4H)<=SMALLVAL) headl[headn+4]+=" "+REPA4P; else if (fabs(w-A4H)<=SMALLVAL && fabs(h-A4W)<=SMALLVAL) headl[headn+4]+=" "+REPA4L; else if (fabs(w-A3W)<=SMALLVAL && fabs(h-A3H)<=SMALLVAL) headl[headn+4]+=" "+REPA3P; else if (fabs(w-A3H)<=SMALLVAL && fabs(h-A3W)<=SMALLVAL) headl[headn+4]+=" "+REPA3L; else if (fabs(w-A2W)<=SMALLVAL && fabs(h-A2H)<=SMALLVAL) headl[headn+4]+=" "+REPA2P; else if (fabs(w-A2H)<=SMALLVAL && fabs(h-A2W)<=SMALLVAL) headl[headn+4]+=" "+REPA2L; else if (fabs(w-A1W)<=SMALLVAL && fabs(h-A1H)<=SMALLVAL) headl[headn+4]+=" "+REPA1P; else if (fabs(w-A1H)<=SMALLVAL && fabs(h-A1W)<=SMALLVAL) headl[headn+4]+=" "+REPA1L; else if (fabs(w-A0W)<=SMALLVAL && fabs(h-A0H)<=SMALLVAL) headl[headn+4]+=" "+REPA0P; else if (fabs(w-A0H)<=SMALLVAL && fabs(h-A0W)<=SMALLVAL) headl[headn+4]+=" "+REPA0L; else if (fabs(w-LW)<=SMALLVAL && fabs(h-LH)<=SMALLVAL) headl[headn+4]+=" "+REPLETTERP; else if (fabs(w-LH)<=SMALLVAL && fabs(h-LW)<=SMALLVAL) headl[headn+4]+=" "+REPLETTERL; else if (fabs(w-TW)<=SMALLVAL && fabs(h-TH)<=SMALLVAL) headl[headn+4]+=" "+REPTABLOIDP; else if (fabs(w-TH)<=SMALLVAL && fabs(h-TW)<=SMALLVAL) headl[headn+4]+=" "+REPTABLOIDL; headn+=5; // Get the plan class name switch (ddbcl) { // SCM plan case DDBCLSCM : // Get the symbol/label list nreflist(ITMHDSYM); // Complete the header sprintf(headl[headn],REPSYMCNT,nrefcnt); sprintf(headl[headn+1],REPLABCNT,labelcnt); headl[headn+2]=" "; sprintf(headl[headn+3],FMTNREFH1, lnam,ITMHDSYM,lmac,ITMHDMAC,"X "+UNIT,"Y "+UNIT); sprintf(headl[headn+4],FMTNREFH2, lnam,ITMULINE,lmac,ITMULINE); headn+=5; break; // SCM symbol case DDBCLSSYM : // Get the pin list nreflist(ITMHDPIN); // Complete the header sprintf(headl[headn],REPPINCNT,nrefcnt); headl[headn+1]=" "; sprintf(headl[headn+2],FMTNREFH1, lnam,ITMHDPIN,lmac,ITMHDMRK,"X "+UNIT,"Y "+UNIT); sprintf(headl[headn+3],FMTNREFH2, lnam,ITMULINE,lmac,ITMULINE); headn+=4; break; // SCM label case DDBCLSLAB : // Get the marker list nreflist(ITMHDMRK); // Complete the header headl[headn]=" "; sprintf(headl[headn+1],FMTNREFH1, lnam,ITMHDPIN,lmac,ITMHDMRK,"X "+UNIT,"Y "+UNIT); sprintf(headl[headn+2],FMTNREFH2, lnam,ITMULINE,lmac,ITMULINE); headn+=3; break; } // Get maximum line length for (i=headn-1;i>=0;i--) mc=maxint(mc,strlen(headl[i])+1); for (i=entryn-1;i>=0;i--) mc=maxint(mc,strlen(entryl[i])+1); // Activate the popup menu bae_setintpar(16,3092); popupmenu(0,"",headl,headn,entryl,entryn, "",0,0,1,headn+entryn+2,mc,0,""); } // Reference list routines void nreflist(string item) /* // Print the named reference list for the currently loaded element // Parameters : // string item : Named reference item designator */ { index C_NREF n /* Named reference index */; string entrystr /* Entry string buffer */; string tagmstr /* Tag mode string buffer */; // Init the nref and label count nrefcnt=labelcnt=0; // Get the output field lengths lnam=strlen(item); if (ddbcl==DDBCLSCM) lmac=strlen(ITMHDMAC); else lmac=strlen(ITMHDMRK); forall (n) { lnam=maxint(lnam,strlen(n.NAME)); if (n.MACRO.CLASS!=DDBCLSLAB) lmac=maxint(lmac,strlen(n.MACRO.NAME)); } // Loop thru the named reference list (without labels) forall (n where n.MACRO.CLASS!=DDBCLSLAB) { // Increment the named reference count nrefcnt++; // Build the entry string sprintf(entrystr,FMTNREF,lnam,n.NAME,lmac,n.MACRO.NAME, ITOB*(n.X-nx),ITOB*(n.Y-ny),cvtangle(n.ANGLE,0,1),n.MIRROR); if (ddbcl==DDBCLSSYM) { switch (n.TAGPTYP) { case SYPSTD : tagmstr=""; break; case SYPSYMTAG : tagmstr=REPPTSYMTAG; break; case SYPPINTAG : tagmstr=REPPTPINTAG; break; case SYPNETTAG : tagmstr=REPPTNETTAG; break; case SYPNPNTAG : tagmstr=REPPTNPNTAG; break; case SYPNARTAG : tagmstr=REPPTNARTAG; break; case SYPPARTAG : tagmstr=REPPTPARTAG; break; default : tagmstr=REPPTILL; } if (tagmstr!="") entrystr+=" "+tagmstr; } // Store the entry string newentry(entrystr); } // Abort if not SCM plan (i.e. no label list available) if (ddbcl!=DDBCLSCM) return; // Loop thru the named reference label list forall (n where n.MACRO.CLASS==DDBCLSLAB) { // Increment the label count labelcnt++; // Print the info sprintf(entryl[entryn],FMTNREF,lnam,n.NAME,lmac,ITMLABEL, ITOB*(n.X-nx),ITOB*(n.Y-ny),cvtangle(n.ANGLE,0,1),n.MIRROR); entryn++; } } // Entry list routines void newentry(string entrystr) /* // Store a new entry string to the entry list // Parameters : // string entrystr : Entry string */ { int slb = 0 /* Search lower boundary */; int sub = entryn-1 /* Search upper boundary */; int sidx /* Search index */; int compres /* Compare result */; // Loop until search area empty while (slb<=sub) { // Get the search index sidx=(slb+sub)>>1; // Test if entry found; update the search area if ((compres=numstrcmp(entrystr,entryl[sidx]))<0) sub=sidx-1; else slb=sidx+1; } // Insert new entry string to sorted entry list for (sidx=entryn;sidx>slb;sidx--) entryl[sidx]=entryl[sidx-1]; entryl[slb]=entrystr; entryn++; } // User Language program end