/* LAYEDBAT (GED) -- GED Layout Library Edit Batch */ /* LAYEDBAT (GED) -- GED Layoutbibliothek Batch-Editor */ /* // Copyright (c) 2003-2012 Oliver Bartels F+E, Muenchen // Author: Roman Ludwig // Changes History: // rl (120427) RELEASED FOR BAE V7.8. // rl (120319) ENHANCEMENT: // Added name to attribute move transfer functions. // rl (101019) RELEASED FOR BAE V7.6. // rl (101012) ENHANCEMENT: // Added center options to origin and pick text functions. // rl (091021) RELEASED FOR BAE V7.4. // rl (081014) RELEASED FOR BAE V7.2. // rl (071029) RELEASED FOR BAE V7.0. // rl (071004) ENHANCEMENT: // Added plot width assignment functions. // rl (070822) ENHANCEMENT: // Added drill class change function. // rl (060829) RELEASED FOR BAE V6.8. // rl (060601) ENHANCEMENT: // Added batch delete function. // Added DRC polygon derivation from silkscreen graphic function. // rl (060512) ENHANCEMENT: // Added polygon type query to polygon related batch steps. // rl (060127) ENHANCEMENT: // Added rule name selection box with pattern input support. // rl (050906) RELEASED FOR BAE V6.6. // rl (050720) ENHANCEMENT: // Added functions to store/load batches in a batch database. // rl (050405) ENHANCEMENT: // Added height DRC documentation text function. // rl (050218) ENHANCEMENT: // Added set pick point to graphics center function. // rl (041011) ENHANCEMENT: // Added polygon resize support. // rl (040811) RELEASED FOR BAE V6.4. // rl (040811) ENHANCEMENT: // Added element name pattern support. // Added plan rule attachment support. // rl (031215) ORIGINAL CODING. // // DESCRIPTION // // The layedbat User Language program performs the setup of // a batch with a series of advanced layout edit actions. // The edit batch can be accomplished to all layouts/macros of // selectable layout library files of the current directory. // layedbat provides functions for defining, changing or // deleting special texts, for changing the element boundaries, // for changing pin padstack macros, for moving pin names, for setting // the part origin and pick point, etc. */ // Includes #include "baeparam.ulh" // User Language BAE param. access #include "pop.ulh" // User Language popup utilities #include "lay.ulh" // User Language layout utilities #include "sql.ulh" // User Language SQL utilities // Disable undo state request #pragma ULCALLERNOUNDO // Messages string UPRABORT = M_UPRABORT(); string ERRINPVAL = M_ERRINPVAL(); string REPBATHD = M("Layout Bibliothek Edit Batch-Programm:", "Layout Library Edit Batch Program:"); string REPELEMPAT = M("Elementnamensmuster '%s'", "Element Name Pattern '%s'"); string REPLIBHD = M("Bibliothek '%s' Aenderungen:", "Library '%s' Changes:"); string REPLAYPROC = M("%d von %d Layouts geaendert.", "%d of %d Layouts changed."); string REPPARTPROC = M("%d von %d Bauteilen geaendert.", "%d of %d Parts changed."); string REPPSTKPROC = M("%d von %d Padstacks geaendert.", "%d of %d Padstacks changed."); string REPPADPROC = M("%d von %d Pads geaendert.", "%d of %d Pads changed."); string REPBATLIST = M("Auswahl Batchname :","Batch Name Selection :"); string REPBATDONE = M("Batch '%s' ausgefuehrt.","Batch '%s' executed."); string UPRNAMEPAT = M("Elementnamens-Pattern (=alle) : ", "Element Name Pattern (=all) : "); string UPRLIBH = M("Bibliotheks-Hierarchie-Ebene waehlen!", "Select Library Hierarchy Level!"); string UPRLIBHLAY = M("&Layouts","&Layouts"); string UPRLIBHPRT = M("&Bauteile","&Parts"); string UPRLIBHSTK = M("Pad&stacks","Pad&stacks"); string UPRLIBHPAD = M("Pa&ds","Pa&ds"); string UPRBATLOAD = M("%B&atch Laden","%L&oad Batch"); string UPRBATSAVE = M("Batch S&peichern","S&ave Batch"); string UPRBATDEL = M("Batch Loeschen","Delete Batch"); string UPRBATNAME = M("Batchname ? ","Batch Name ? "); string UPRDBLBATCH = M("Batch '%s' ueberschreiben?", "Overwrite Batch '%s'?"); string UPRBATFCT = M("Batch-Funktion selektieren!", "Select Batch Function!"); string UPRTXTMOV = M("Text &bewegen","&Move Text"); string UPRTXTCHG = M("T&ext aendern","&Change Text String"); string UPRTXTLCHG = M("Text(e) Lage aendern","Text(s) Layer Change"); string UPRTXTCPY = M("Text(e) Lage kopieren","Text(s) Layer Copy"); string UPRTXTSTD = M("Textgroesse(n) Standar&d", "Text(s) Si&ze Standard"); string UPRTXTMIN = M("Textgroesse(n) Mi&n.","Text(s) Size Mi&nimum"); string UPRTXTMAX = M("Textgroesse(n) Ma&x.","Text(s) Size Ma&ximum"); string UPRTXTPWIDTH = M("Text Stiftbreite","Text Plot Width"); string UPRTXTCENT = M("Text(e) zentrieren","Center Text(s)"); string UPRTXTORIG = M("Nullpunkt Text","Origin Text"); string UPRTXTPICK = M("Pickpunkt Text","Pick Point Text"); string UPRTXTHDRC = M("Hoehen-DRC Text","Height DRC Text"); string UPRTXTDEL = M("Text(e) &loeschen","&Delete Text(s)"); string UPRTXTRULE = M("Text(e) Regelzuweisung", "Text(s) Rule Assignment"); string UPRNAMAMOV = M("%Attribut statt Namen bewegen", "%Name Move to Attribute Move"); string UPRDRLCCHG = M("%Bohrklasse aendern","%Drill Class Change"); string UPRPLYLCHG = M("%Polygon Lage aendern","%Polygon Layer Change"); string UPRPLYCPY = M("Polygon Lage kopieren","Polygon Layer Copy"); string UPRPLYDRC = M("Polygon DRC-Lage ableiten","Polygon Derive DRC Layer"); string UPRPLYDEL = M("Polygon Lage loeschen","Polygon Layer Delete"); string UPRPLYPWIDTH = M("Dokumentarlinien Stiftbreite", "Documentary Line Plot Width"); string UPRPLYSIZE = M("Polygon Groesse aendern","Polygon Size Change"); string UPRPLYRULE = M("Polygone Regelzuweisung", "Polygons Rule Assignment"); string UPRPLANRULE = M("%Plan Regelzuweisung","%Plan Rule Assignment"); string UPRSTKCHG = M("%Pin-Padstacks aendern","%Change Pin &Padstacks"); string UPRPADCHG = M("%Pads tauschen","%Pad Exchange"); string UPRPADLCHG = M("Pad Lage aendern","Pad Layer Change"); string UPRPADCPY = M("Pad Lage kopieren","Pad Layer Copy"); string UPRPADDEL = M("Pad Lage loeschen","Pad Layer Delete"); string UPRWSMIN = M("%&Elementgrenzen minimieren", "%Minimize &Workspace"); string UPRWSSHR = M("Elementgrenzen verkleinern","Shrink Workspace"); string UPRWSENL = M("Elementgrenzen vergroessern","Enlarge Workspace"); string UPRNOCHG = M("%&Fertig","%Don&e"); string UPRPROCFILE = M("%Bearbeiten &Einzeldateien","%Process Files"); string UPRPROCDIR = M("Bearbeiten &Verzeichnisbaum", "Process Folder Tree"); string UPRPICKPOS = M("Pickpunktmodus selektieren!", "Select Pick Point Mode!"); string UPRPICK1 = M("&Mittelpunkt Pinrechteck", "&Center of Pin Rectangle"); string UPRPICK2 = M("Mittelpunkt &Grafikrechteck", "Center of &Graphics Rectangle"); string UPRPICK3 = M("Bauteil&nullpunkt","Part &Origin"); string UPRPICK4 = M("Pin &1","Pin &1"); string UPRPICKCENT = M("Textzentrierung selektieren!", "Select Text Center Mode!"); string UPRCENT1 = M("&Keine Zentrierung","&No Centering"); string UPRCENT2 = M("Zentrierung &H","Centering &H"); string UPRCENT3 = M("Zentrierung &V","Centering &V"); string UPRCENT4 = M("&Zentrierung H+V","&Centering H+V"); string UPRRULEMODE = M("Regelmodus selektieren!", "Select Rule Mode!"); string UPRRULE1 = M("Regel anhaengen","Attach Rule"); string UPRRULE2 = M("Regel loeschen","Detach Rule"); string UPRRULEDB = M("Regeln in Datenbank :","Database Rules :"); string UPRLAYMODE1 = M("'%s' ist nicht PHYSICAL deklartiert!\n", "'%s' is not declared PHYSICAL!\n"); string UPRLAYMODE2 = M("Texte trotzdem erzeugen?","Create texts anyway?"); string UPRLAYER = M(" Lage selektieren!"," Select Layer!"); string UPRSLAYER = M(" Quelllage selektieren!"," Select Source Layer!"); string UPRDLAYER = M(" Ziellage selektieren!", " Select Destination Layer!"); string UPRSCLASS = M(" Quellbohrklasse ? "," Source Drill Class ? "); string UPRDCLASS = M(" Zielbohrklasse ? "," Destination Drill Class ? "); string UPRCLASS = M("Bohrungsklasse :","Drilling Class :"); string UPRMCLASS = M("Spiegelbohrungsklasse :", "Mirror Drilling Class :"); string UPRTLAYALL = M("Texte auf &Speziallage Alle Lagen", "Text on special layer All Layers"); string UPRALLT = M("Texte auf allen Lagen","Texts on all layers"); string UPRRULE = M(" - Regelname ? "," - Rule Name ? "); string UPRTXT1 = M(" - Text ? "," - Text ? "); string UPRDTXT1 = M("Text :","Text :"); string UPRTXTP1 = M(" - Text(muster) ? "," - Text (pattern) ? "); string UPRDTXTP1 = M("Text(muster) :","Text (pattern) :"); string UPRTXT2 = M(" - Neuer Text ? "," - New Text ? "); string UPRDTXT2 = M("Neuer Text :","New Text :"); string UPRTXTS = M(" - Textgroesse [mm] ? "," - Text Size [mm] ? "); string UPRDTXTS = M("Textgroesse [mm] :","Text Size [mm] :"); string UPRPWIDTH = M(" - Stiftbreite [mm] ? "," - Plot Width [mm] ? "); string UPRDPWIDTH = M("Stiftbreite [mm] :","Plot Width [mm] :"); string UPRSIZEM = M(" (%.2fmm) ? "," (%.2fmm) ? "); string UPRSIZEI = M(" (%.3f Inch) ? "," (%.3f Inch) ? "); string UPRHEIGHTM = M(". Hoehe (%.2fmm) ? ",". Height (%.2fmm) ? "); string UPRHEIGHTI = M(". Hoehe (%.3f Inch) ? ",". Height (%.3f Inch) ? "); string UPRSSTK = M("Quellpadstack ('%s') ?", "Source Padstack ('%s') ?"); string UPRDSTK = M("Zielpadstack in '%s' ?", "Destination Padstack in %s' ?"); string UPRSPAD = M("Quellpad ('%s') ?","Source Pad ('%s') ?"); string UPRDPAD = M("Zielpad in '%s' ?","Destination Pad in '%s' ?"); string UPRRUNBAT = M("Edit-Batch ausfuehren [J|N] ? ", "Run Edit Batch [Y|N] ? "); string UPRSDIR = M("Startverzeichnis ? ","Start Directory ? "); string UPRSAVEBAT = M("Edit-Batch speichern [J|N] ? ", "Save Edit Batch [Y|N] ? "); string UPRSELLIB = M("Layoutbibliothek ? ","Layout Library ? "); string ERRNOACT = M("Keine Editier-Aktion spezifiziert!", "No edit action specified!"); string ERRLOAD = M("Fehler beim Laden von '%s'!", "Error loading '%s'!"); string ERRBADTEXT = M("Ungueltige Textangabe!","Invalid text string!"); string ERRDELETE = M("Fehler beim Loeschen eines Elementes!", "Error deleting element!"); string ERRCREATE = M("Fehler beim Erzeugen eines neuen Elementes!", "Error creating new element!"); string ERRDBINIT = M("SQL/DB-Datei '%s' kann nicht initialisiert werden!", "Error initialyzing SQL/DB file '%s'!"); // INI file parameter name definitions #define PAR_TXTPICKTOLF "LAYEDTPTOL_GED"// Text pick tolerance factor #define PAR_BELLAY "BELLAY_GED" // Layout boundary enlarge length #define PAR_BELPRT "BELPRT_GED" // Part boundary enlarge length #define PAR_BELSTK "BELSTK_GED" // Padstack boundary enlarge length #define PAR_BELPAD "BELPAD_GED" // Pad boundary enlarge length // Global variables #define SMALLVAL 0.000000001 // Small compare value static string BAEMACRODB = strgetconffilename(MACROVNAME,MACROFNAME,1); double TXTPICKTOLF = bae_inidblval(PAR_TXTPICKTOLF,0.5) /* Text pick tolerance factor */; double BELLAY = bae_inidblval(PAR_BELLAY,0.00127) /* Layout boundary enlarge length */; double BELPRT = bae_inidblval(PAR_BELPRT,0.00127) /* Part boundary enlarge length */; double BELSTK = bae_inidblval(PAR_BELSTK,0.000635) /* Padstack bound. enlarge length */; double BELPAD = bae_inidblval(PAR_BELPAD,0.0003175) /* Pad boundary enlarge length */; #define FCTTXTMOVI 0 // Function move text interactive #define FCTTXTCHG 1 // Function text change #define FCTTXTLCHG 2 // Function text layer change #define FCTTXTCPY 3 // Function text layer copy #define FCTTXTSSTD 4 // Function text size standard #define FCTTXTSMIN 5 // Function text size minimum #define FCTTXTSMAX 6 // Function text size maximum #define FCTTXTORIG 7 // Function text origin #define FCTTXTPICK 8 // Function pick text #define FCTTXTDEL 9 // Function text delete #define FCTTXTRULE 10 // Function text rule attachment #define FCTPLYLCHG 11 // Function polygon layer change #define FCTPLYCPY 12 // Function polygon layer copy #define FCTPLYDEL 13 // Function polygon layer delete #define FCTPLYRULE 14 // Function polygon rule attachment #define FCTSTKCHG 15 // Function padstack macro change #define FCTPADCHG 16 // Function pad exchange #define FCTPADLCHG 17 // Function pad layer change #define FCTPADCPY 18 // Function pad layer copy #define FCTPADDEL 19 // Function pad delete #define FCTWSMIN 20 // Function workspace minimize #define FCTWSSHR 21 // Function workspace shrink #define FCTWSENL 22 // Function workspace enlarge #define FCTPLANRULE 23 // Function plan rule attachment #define FCTPLYSIZ 24 // Function polygon size change #define FCTTXTHDRC 25 // Function height DRC text #define FCTPLYDRC 26 // Function polygon DRC creation #define FCTDRLCCHG 27 // Function drill class change #define FCTTXTPWIDTH 28 // Function text plot width #define FCTPLYPWIDTH 29 // Function polygon plot width #define FCTTXTCENT 30 // Function text center #define FCTNAMAMOV 31 // Function name to attribute move struct batfctdes { // Batch function descriptor string rep /* Report string */; int ft /* Function type */; int c /* Element class */; string s1 /* Text string 1 */; string s2 /* Text string 2 */; double size /* Text size parameter */; int l1 /* Layer 1 parameter */; int l2 /* Layer 2 parameter */; int cnt /* Change count */; } batfctl[] /* Batch function list */; int batfctn = 0 /* Batch function count */; int curfctidx = 0 /* Current batch function index */; string batl[] /* Batch name list */; int batn /* Batch count */; string namepat = "*" /* Element name pattern */; double lx, ly /* Pins lower boundary */; double ux, uy /* Pins upper boundary */; int pinn /* Pin count */; int scanlayer /* Scan layer */; int scandir /* Scan directory mode */; int elemchg /* Element changed flag */; int elemcnt /* Changed elements count */; int remoteflag = 0 /* Remote operation flag */; STRINGS hl /* Header list */; int hn /* Header count */; STRINGS el /* Entry list */; int en /* Entry count */; // SQL command definitions #define B_SELECT1 "select idx,rep,ft,c,s1,s2,size,l1,l2 from" #define B_SELECT2 " layedbat where name=%s;" #define B_SELECT B_SELECT1+B_SELECT2 #define B_CREATE1 "create table layedbat (idx integer,name string," #define B_CREATE2 "rep string,ft integer,c integer,s1 string,s2 string," #define B_CREATE3 "size float,l1 integer,l2 integer);" #define B_CREATE B_CREATE1+B_CREATE2+B_CREATE3 #define B_HELP "help layedbat;" #define B_INSERT1 "insert into layedbat values(%d,%s,%s,%d,%d,%s," #define B_INSERT2 "%s,%.10f,%d,%d);" #define B_INSERT B_INSERT1+B_INSERT2 #define B_DELETE "delete from layedbat where name=%s;" #define BN_SELECT "select name from layedbat where idx=0;" string sqlcommand /* SQL command string */; // Main program void main() { string batname /* Batch name */; int remoteflag = 0 /* Remote interaction flag */; if (bae_peekiact()==2) { namepat=askstr("",1024); if (namepat=="call") { if (bae_planddbclass()==DDBCLUNDEF) error_class(); // Select the batch name if ((batname=selbatchname(0))=="") exit(0); // Load batch batfctn=0; sprintf(sqlcommand,B_SELECT,sql_quotestr(batname)); sqlcmd(BAEMACRODB,sqlcommand,batloadfunc); remoteflag=1; editelement(); screenredraw(); sprintf(sqlcommand,REPBATDONE,batname); bae_prtdialog(sqlcommand); exit(0); } remoteflag=1; } // Save current element with verification on request verifysave(); // Ask for element name pattern if (!remoteflag) { bae_setmousetext(""); if ((namepat=bae_readedittext(UPRNAMEPAT,"*",MAXKEYLEN))=="") // Set the all match pattern namepat="*"; } // Check if abort request if (namepat==UINPOPABORT) error_abort(); // Build the batch buildbatch(); // Test if something to do if (batfctn<=0) // No action defined; abort error(ERRNOACT); // Save current state for undo bae_callmenu(MNU_BAESAVESTATE); // Run the batch runbatch(); } /*________________________________________________________________*/ // Batch edit routines void buildbatch() /* // Build the batch program */ { string msg /* Message string */; string prompt /* Prompt string */; string batname /* Batch name */; string s1,s2 /* Text function strings */; string libname /* Library name */; double size = cvtlength(baepar_dblval(LAYPAR_DEFTEXTSIZE),0,2); /* Text size parameter */; int layer1 = 0 /* Layer 1 parameter */; int layer2 = 0 /* Layer 2 parameter */; int mode = 0 /* Mode parameter */; int repflag = 1 /* Repeat flag */; int repflag2 = 1 /* Repeat flag 2 */; // Create/init database file if (sqlinit(BAEMACRODB,0)==(-1) && sqlinit(BAEMACRODB,1)==(-1)) // SQL/DB creation error errormsg(ERRDBINIT,BAEMACRODB); // Create table in database if (sqlcmd(bae_planfname(),B_HELP,NULL)!=0) if (sqlcmd(BAEMACRODB,B_CREATE,NULL)) // SQL/DB error (ignore table already defined error) sql_dberror(25); while (repflag) { // Ask for database hierarchie to change bae_promptdialog(UPRLIBH); switch (bae_askmenu(10,UPRLIBHLAY,UPRLIBHPRT,UPRLIBHSTK,UPRLIBHPAD, UPRBATLOAD,UPRBATSAVE,UPRBATDEL,UPRPROCFILE,UPRPROCDIR, UPRABORT)) { // Layouts case 0 : // Repetively ask for layout batch function repflag2=1; do { s1=s2=""; bae_promptdialog(UPRBATFCT); switch (bae_askmenu(24,UPRTXTMOV,UPRTXTCHG,UPRTXTLCHG, UPRTXTCPY,UPRTXTSTD,UPRTXTMIN,UPRTXTMAX,UPRTXTPWIDTH, UPRTXTCENT,UPRTXTORIG,UPRTXTDEL,UPRTXTRULE,UPRNAMAMOV, UPRPLYLCHG,UPRPLYCPY,UPRPLYDEL,UPRPLYPWIDTH,UPRPLYSIZE, UPRPLYRULE,UPRPLANRULE,UPRWSMIN,UPRWSSHR,UPRWSENL, UPRNOCHG)) { // Text move case 0 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTMOV); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTMOVI, DDBCLLAY,s1,"",0.0, layer1,LAYERINV); } break; // Text change case 1 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTCHG); if (edittextstep(prompt,s1,s2)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; if (layer1==LAYERALL && bae_askmenu(2,UPRTLAYALL,UPRALLT)==1) layer1=LAYERINV; // Store text function storebatfct(prompt,FCTTXTCHG,DDBCLLAY, s1,s2,0.0,layer1,LAYERINV); break; // Text layer change case 2 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTLCHG); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,7)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,7)) break; // Store text function storebatfct(prompt,FCTTXTLCHG, DDBCLLAY,s1,"",0.0,layer1,layer2); } break; // Text layer copy case 3 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTCPY); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,7)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,7)) break; // Store text function storebatfct(prompt,FCTTXTCPY, DDBCLLAY,s1,"",0.0,layer1,layer2); } break; // Text size std case 4 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTSTD); if (edittextsize(prompt,s1,size,0)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTSSTD,DDBCLLAY, s1,"",size,layer1,LAYERINV); break; // Text size min case 5 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTMIN); if (edittextsize(prompt,s1,size,0)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTSMIN,DDBCLLAY, s1,"",size,layer1,LAYERINV); break; // Text size max case 6 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTMAX); if (edittextsize(prompt,s1,size,0)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTSMAX,DDBCLLAY, s1,"",size,layer1,LAYERINV); break; // Assign text plot width case 7 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTPWIDTH); size=0.0; if (edittextsize(prompt,s1,size,2)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTPWIDTH,DDBCLLAY, s1,"",size,layer1,LAYERINV); break; // Text center case 8 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTCENT); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTCENT,DDBCLLAY, s1,"",0.0,layer1,LAYERINV); } break; // Place standard text at origin case 9 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTORIG); if (edittextsize(prompt,s1,size,1)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Ask for text center mode bae_promptdialog(UPRPICKCENT); switch (bae_askmenu(5,UPRCENT1,UPRCENT2, UPRCENT3,UPRCENT4,UPRABORT)) { case 0 : s2="0"; break; case 1 : s2=itoa(TEXTHCENT); break; case 2 : s2=itoa(TEXTVCENT); break; case 3 : s2=itoa(TEXTHCENT|TEXTVCENT); break; default : s2=""; } if (s2=="") break; // Store text function storebatfct(prompt,FCTTXTORIG,DDBCLLAY, s1,s2,size,layer1,LAYERINV); break; // Text delete case 10 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTDEL); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTDEL,DDBCLLAY, s1,"",0.0,layer1,LAYERINV); } break; // Attach/detach text rule case 11 : prompt=bae_plainmenutext(UPRTXTRULE); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) error_abort(); if (askrulename(s2,prompt+UPRRULE)) break; // Ask for rule attachment mode bae_promptdialog(UPRRULEMODE); if ((mode=bae_askmenu(3,UPRRULE1, UPRRULE2,UPRABORT))<0 || mode>1) break; storebatfct(prompt,FCTTXTRULE, DDBCLLAY,s1,s2,0.0,layer1,mode); } break; // Convert name to attribute move case 12 : // Prompt for parameters prompt=bae_plainmenutext(UPRNAMAMOV); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,3)) break; // Store polygon function storebatfct(prompt,FCTNAMAMOV,DDBCLLAY, "","",0.0,layer1,LAYERINV); break; // Polygon layer change case 13 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYLCHG); bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,0)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,0)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYLCHG, DDBCLLAY,"",s2,0.0,layer1,layer2); break; // Polygon layer copy case 14 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYCPY); bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,0)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,0)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYCPY, DDBCLLAY,"",s2,0.0,layer1,layer2); break; // Polygon layer delete case 15 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYDEL); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYDEL,DDBCLLAY, "",s2,0.0,layer1,LAYERINV); break; // Assign polygon plot width case 16 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYPWIDTH); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,3)) break; size=0.0; if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),1)) break; storebatfct(prompt,FCTPLYPWIDTH,DDBCLLAY, "","",size,layer1,LAYERINV); break; // Polygon size change case 17 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYSIZE); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Get the resize parameter size=0.0; if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),1)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYSIZ,DDBCLLAY, "",s2,size,layer1,LAYERINV); break; // Attach/detach polygon rule case 18 : prompt=bae_plainmenutext(UPRPLYRULE); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) error_abort(); // Get polygon type(s) s2=getpolytype(prompt,layer1); if (askrulename(s1,prompt+UPRRULE)) break; // Ask for rule attachment mode bae_promptdialog(UPRRULEMODE); if ((mode=bae_askmenu(3,UPRRULE1,UPRRULE2, UPRABORT))<0 || mode>1) break; storebatfct(prompt,FCTPLYRULE,DDBCLLAY, s1,s2,0.0,layer1,mode); break; // Attach/detach plan rule case 19 : prompt=bae_plainmenutext(UPRPLANRULE); if (askrulename(s1,prompt+UPRRULE)) break; // Ask for rule attachment mode bae_promptdialog(UPRRULEMODE); if ((mode=bae_askmenu(3,UPRRULE1,UPRRULE2, UPRABORT))<0 || mode>1) break; storebatfct(prompt,FCTPLANRULE,DDBCLLAY, s1,"",0.0,0,mode); break; // Minimize workspace case 20 : prompt=bae_plainmenutext(UPRWSMIN); storebatfct(prompt,FCTWSMIN,DDBCLLAY, "","",0.0,LAYERINV,LAYERINV); break; // Shrink workspace case 21 : prompt=bae_plainmenutext(UPRWSSHR); size=BELLAY; // Get the shrink parameter if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),0) || size<0.0) break; storebatfct(prompt,FCTWSSHR,DDBCLLAY, "","",size,LAYERINV,LAYERINV); break; // Enlarge workspace case 22 : prompt=bae_plainmenutext(UPRWSENL); size=BELLAY; // Get the enlarge parameter if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),0) || size<0.0) break; storebatfct(prompt,FCTWSENL,DDBCLLAY, "","",size,LAYERINV,LAYERINV); break; default : repflag2=0; } } while (repflag2); break; // Parts case 1 : // Repetively ask for part batch function repflag2=1; do { s1=s2=""; bae_promptdialog(UPRBATFCT); switch (bae_askmenu(27,UPRTXTMOV,UPRTXTCHG,UPRTXTLCHG, UPRTXTCPY,UPRTXTSTD,UPRTXTMIN,UPRTXTMAX,UPRTXTPWIDTH, UPRTXTCENT,UPRTXTORIG,UPRTXTPICK,UPRTXTHDRC,UPRTXTDEL, UPRTXTRULE,UPRPLYLCHG,UPRPLYCPY,UPRPLYDRC,UPRPLYDEL, UPRPLYPWIDTH,UPRPLYSIZE,UPRPLYRULE,UPRSTKCHG, UPRPLANRULE,UPRWSMIN,UPRWSSHR,UPRWSENL,UPRNOCHG)) { // Text move case 0 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTMOV); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTMOVI, DDBCLLPRT,s1,"",0.0, layer1,LAYERINV); } break; // Text change case 1 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTCHG); if (edittextstep(prompt,s1,s2)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; if (layer1==LAYERALL && bae_askmenu(2,UPRTLAYALL,UPRALLT)==1) layer1=LAYERINV; // Store text function storebatfct(prompt,FCTTXTCHG,DDBCLLPRT, s1,s2,0.0,layer1,LAYERINV); break; // Text layer change case 2 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTLCHG); s1="*"; if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,7)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,7)) break; // Store text function storebatfct(prompt,FCTTXTLCHG, DDBCLLPRT,s1,"",0.0,layer1,layer2); } break; // Text layer copy case 3 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTCPY); s1="*"; if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,7)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,7)) break; // Store text function storebatfct(prompt,FCTTXTCPY, DDBCLLPRT,s1,"",0.0,layer1,layer2); } break; // Text size std case 4 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTSTD); if (edittextsize(prompt,s1,size,0)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTSSTD,DDBCLLPRT, s1,"",size,layer1,LAYERINV); break; // Text size min case 5 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTMIN); if (edittextsize(prompt,s1,size,0)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTSMIN,DDBCLLPRT, s1,"",size,layer1,LAYERINV); break; // Text size max case 6 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTMAX); if (edittextsize(prompt,s1,size,0)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTSMAX,DDBCLLPRT, s1,"",size,layer1,LAYERINV); break; // Assign text plot width case 7 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTPWIDTH); size=0.0; if (edittextsize(prompt,s1,size,2)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,0)) break; // Store text function storebatfct(prompt,FCTTXTPWIDTH,DDBCLLPRT, s1,"",size,layer1,LAYERINV); break; // Text center case 8 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTCENT); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTCENT,DDBCLLPRT, s1,"",0.0,layer1,LAYERINV); } break; // Place standard text at origin case 9 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTORIG); s1="$"; if (edittextsize(prompt,s1,size,1)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Ask for text center mode bae_promptdialog(UPRPICKCENT); switch (bae_askmenu(5,UPRCENT1,UPRCENT2, UPRCENT3,UPRCENT4,UPRABORT)) { case 0 : s2="0"; break; case 1 : s2=itoa(TEXTHCENT); break; case 2 : s2=itoa(TEXTVCENT); break; case 3 : s2=itoa(TEXTHCENT|TEXTVCENT); break; default : s2=""; } if (s2=="") break; // Store text function storebatfct(prompt,FCTTXTORIG,DDBCLLPRT, s1,s2,size,layer1,LAYERINV); break; // Place pick text case 10 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTPICK); s1="$"; if (edittextsize(prompt,s1,size,1)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer1,3)) break; if (lay_doclaytext( (layer1-DOCLAYBASE)/DOCLAYSHIFT)!=0) { sprintf(msg,UPRLAYMODE1+UPRLAYMODE2, purelayername(layer1)); if (bae_msgboxverify(msg,"")!=1) break; } // Ask for pick position mode bae_promptdialog(UPRPICKPOS); if ((mode=bae_askmenu(5,UPRPICK1,UPRPICK2, UPRPICK3,UPRPICK4,UPRABORT))<0 || mode>3) break; if (mode==1) { bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer2,3)) break; mode=(-layer2); } // Ask for text center mode bae_promptdialog(UPRPICKCENT); switch (bae_askmenu(5,UPRCENT1,UPRCENT2, UPRCENT3,UPRCENT4,UPRABORT)) { case 0 : s2="0"; break; case 1 : s2=itoa(TEXTHCENT); break; case 2 : s2=itoa(TEXTVCENT); break; case 3 : s2=itoa(TEXTHCENT|TEXTVCENT); break; default : s2=""; } if (s2=="") break; storebatfct(prompt,FCTTXTPICK,DDBCLLPRT, s1,s2,size,layer1,mode); break; // Place height DRC documentation texts case 11 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTHDRC); s1="%.1fmm"; if (edittextsize(prompt,s1,size,1)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,3)) break; // Store text function storebatfct(prompt,FCTTXTHDRC,DDBCLLPRT, s1,"",size,layer1,LAYERINV); break; // Text delete case 12 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTDEL); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTDEL,DDBCLLPRT, s1,"",0.0,layer1,LAYERINV); } break; // Attach/detach text rule case 13 : prompt=bae_plainmenutext(UPRTXTRULE); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) error_abort(); if (askrulename(s2,prompt+UPRRULE)) break; // Ask for rule attachment mode bae_promptdialog(UPRRULEMODE); if ((mode=bae_askmenu(3,UPRRULE1, UPRRULE2,UPRABORT))<0 || mode>1) break; storebatfct(prompt,FCTTXTRULE, DDBCLLPRT,s1,s2,0.0,layer1,mode); } break; // Polygon layer change case 14 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYLCHG); bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,0)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,0)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYLCHG, DDBCLLPRT,"",s2,0.0,layer1,layer2); break; // Polygon layer copy case 15 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYCPY); bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,0)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,0)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYCPY, DDBCLLPRT,"",s2,0.0,layer1,layer2); break; // Polygon DRC derive copy case 16 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYDRC); bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,3)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,3)) break; // Get the height parameter size=0.0; if (askdist(size,prompt+(lay_defusrunit() ? UPRHEIGHTI : UPRHEIGHTM),0)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYDRC, DDBCLLPRT,"",s2,size,layer1,layer2); break; // Polygon layer delete case 17 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYDEL); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYDEL,DDBCLLPRT, "",s2,0.0,layer1,LAYERINV); break; // Assign polygon plot width case 18 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYPWIDTH); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,3)) break; size=0.0; if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),1)) break; storebatfct(prompt,FCTPLYPWIDTH,DDBCLLPRT, "","",size,layer1,LAYERINV); break; // Polygon size change case 19 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYSIZE); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Get the resize parameter size=0.0; if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),1)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYSIZ,DDBCLLPRT, "",s2,size,layer1,LAYERINV); break; // Attach/detach polygon rule case 20 : prompt=bae_plainmenutext(UPRPLYRULE); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) error_abort(); // Get polygon type(s) s2=getpolytype(prompt,layer1); if (askrulename(s1,prompt+UPRRULE)) break; // Ask for rule attachment mode bae_promptdialog(UPRRULEMODE); if ((mode=bae_askmenu(3,UPRRULE1,UPRRULE2, UPRABORT))<0 || mode>1) break; storebatfct(prompt,FCTPLYRULE,DDBCLLPRT, s1,s2,0.0,layer1,mode); break; // Change padstack macro case 21 : libname=strgetvarfilename(lay_deflibname()); catext(libname,DDBEXT); prompt=bae_plainmenutext(UPRSTKCHG); // Select source padstack macro if (bae_askddbename(s1,libname,DDBCLLSTK, msgstring(UPRSSTK,convstring(libname,1)))) break; // Select destination padstack macro if (bae_askddbename(s2,libname,DDBCLLSTK, msgstring(UPRDSTK,convstring(libname,1)))) break; storebatfct(prompt,FCTSTKCHG,DDBCLLPRT, s1,s2,0.0,LAYERINV,LAYERINV); break; // Attach/detach plan rule case 22 : prompt=bae_plainmenutext(UPRPLANRULE); if (askrulename(s1,prompt+UPRRULE)) break; // Ask for rule attachment mode bae_promptdialog(UPRRULEMODE); if ((mode=bae_askmenu(3,UPRRULE1,UPRRULE2, UPRABORT))<0 || mode>1) break; storebatfct(prompt,FCTPLANRULE,DDBCLLPRT, s1,"",0.0,0,mode); break; // Minimize workspace case 23 : prompt=bae_plainmenutext(UPRWSMIN); storebatfct(prompt,FCTWSMIN,DDBCLLPRT, "","",0.0,LAYERINV,LAYERINV); break; // Shrink workspace case 24 : prompt=bae_plainmenutext(UPRWSSHR); size=BELPRT; // Get the shrink parameter if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),0) || size<0.0) break; storebatfct(prompt,FCTWSSHR,DDBCLLPRT, "","",size,LAYERINV,LAYERINV); break; // Enlarge workspace case 25 : prompt=bae_plainmenutext(UPRWSENL); size=BELPRT; // Get the enlarge parameter if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),0) || size<0.0) break; storebatfct(prompt,FCTWSENL,DDBCLLPRT, "","",size,LAYERINV,LAYERINV); break; default : repflag2=0; } } while (repflag2); break; // Padstacks case 2 : // Repetively ask for padstack batch function repflag2=1; do { s1=s2=""; bae_promptdialog(UPRBATFCT); switch (bae_askmenu(28,UPRTXTMOV,UPRTXTCHG,UPRTXTLCHG, UPRTXTCPY,UPRTXTSTD,UPRTXTMIN,UPRTXTMAX,UPRTXTPWIDTH, UPRTXTCENT,UPRTXTORIG,UPRTXTDEL,UPRTXTRULE,UPRPLYLCHG, UPRPLYCPY,UPRPLYDEL,UPRPLYPWIDTH,UPRPLYSIZE,UPRPLYRULE, UPRPADCHG,UPRPADLCHG,UPRPADCPY,UPRPADDEL,UPRDRLCCHG, UPRPLANRULE,UPRWSMIN,UPRWSSHR,UPRWSENL,UPRNOCHG)) { // Text move case 0 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTMOV); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTMOVI, DDBCLLSTK,s1,"",0.0, layer1,LAYERINV); } break; // Text change case 1 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTCHG); if (edittextstep(prompt,s1,s2)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; if (layer1==LAYERALL && bae_askmenu(2,UPRTLAYALL,UPRALLT)==1) layer1=LAYERINV; // Store text function storebatfct(prompt,FCTTXTCHG,DDBCLLSTK, s1,s2,0.0,layer1,LAYERINV); break; // Text layer change case 2 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTLCHG); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,7)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,7)) break; // Store text function storebatfct(prompt,FCTTXTLCHG, DDBCLLSTK,s1,"",0.0,layer1,layer2); } break; // Text layer copy case 3 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTCPY); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,7)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,7)) break; // Store text function storebatfct(prompt,FCTTXTCPY, DDBCLLSTK,s1,"",0.0,layer1,layer2); } break; // Text size std case 4 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTSTD); if (edittextsize(prompt,s1,size,0)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTSSTD,DDBCLLSTK, s1,"",size,layer1,LAYERINV); break; // Text size min case 5 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTMIN); if (edittextsize(prompt,s1,size,0)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTSMIN,DDBCLLSTK, s1,"",size,layer1,LAYERINV); break; // Text size max case 6 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTMAX); if (edittextsize(prompt,s1,size,0)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTSMAX,DDBCLLSTK, s1,"",size,layer1,LAYERINV); break; // Assign text plot width case 7 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTPWIDTH); size=0.0; if (edittextsize(prompt,s1,size,2)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,0)) break; // Store text function storebatfct(prompt,FCTTXTPWIDTH,DDBCLLSTK, s1,"",size,layer1,LAYERINV); break; // Text center case 8 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTCENT); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTCENT,DDBCLLSTK, s1,"",0.0,layer1,LAYERINV); } break; // Place standard text at origin case 9 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTORIG); if (edittextsize(prompt,s1,size,1)) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Ask for text center mode bae_promptdialog(UPRPICKCENT); switch (bae_askmenu(5,UPRCENT1,UPRCENT2, UPRCENT3,UPRCENT4,UPRABORT)) { case 0 : s2="0"; break; case 1 : s2=itoa(TEXTHCENT); break; case 2 : s2=itoa(TEXTVCENT); break; case 3 : s2=itoa(TEXTHCENT|TEXTVCENT); break; default : s2=""; } if (s2=="") break; // Store text function storebatfct(prompt,FCTTXTORIG,DDBCLLSTK, s1,s2,size,layer1,LAYERINV); break; // Text delete case 10 : // Prompt for parameters prompt=bae_plainmenutext(UPRTXTDEL); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store text function storebatfct(prompt,FCTTXTDEL,DDBCLLSTK, s1,"",0.0,layer1,LAYERINV); } break; // Attach/detach text rule case 11 : prompt=bae_plainmenutext(UPRTXTRULE); if (s1=askstr(prompt+UPRTXTP1,MAXTEXTLEN)) { // Check if abort request if (s1==UINPOPABORT) break; bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) error_abort(); if (askrulename(s2,prompt+UPRRULE)) break; // Ask for rule attachment mode bae_promptdialog(UPRRULEMODE); if ((mode=bae_askmenu(3,UPRRULE1, UPRRULE2,UPRABORT))<0 || mode>1) break; storebatfct(prompt,FCTTXTRULE, DDBCLLSTK,s1,s2,0.0,layer1,mode); } break; // Polygon layer change case 12 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYLCHG); bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,0)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,0)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYLCHG, DDBCLLSTK,"",s2,0.0,layer1,layer2); break; // Polygon layer copy case 13 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYCPY); bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,0)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,0)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYCPY, DDBCLLSTK,"",s2,0.0,layer1,layer2); break; // Polygon layer delete case 14 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYDEL); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYDEL,DDBCLLSTK, "",s2,0.0,layer1,LAYERINV); break; // Assign polygon plot width case 15 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYPWIDTH); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,3)) break; size=0.0; if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),1)) break; storebatfct(prompt,FCTPLYPWIDTH,DDBCLLSTK, "","",size,layer1,LAYERINV); break; // Polygon size change case 16 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYSIZE); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Get the resize parameter size=0.0; if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),1)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYSIZ,DDBCLLSTK, "",s2,size,layer1,LAYERINV); break; // Attach/detach polygon rule case 17 : prompt=bae_plainmenutext(UPRPLYRULE); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) error_abort(); // Get polygon type(s) s2=getpolytype(prompt,layer1); if (askrulename(s1,prompt+UPRRULE)) break; // Ask for rule attachment mode bae_promptdialog(UPRRULEMODE); if ((mode=bae_askmenu(3,UPRRULE1,UPRRULE2, UPRABORT))<0 || mode>1) break; storebatfct(prompt,FCTPLYRULE,DDBCLLSTK, s1,s2,0.0,layer1,mode); break; // Change pad macro case 18 : libname=strgetvarfilename(lay_deflibname()); catext(libname,DDBEXT); prompt=bae_plainmenutext(UPRPADCHG); // Select source pad macro if (bae_askddbename(s1,libname,DDBCLLPAD, msgstring(UPRSPAD,convstring(libname,1)))) break; // Select destination pad macro if (bae_askddbename(s2,libname,DDBCLLPAD, msgstring(UPRDPAD,convstring(libname,1)))) break; storebatfct(prompt,FCTPADCHG,DDBCLLSTK, s1,s2,0.0,LAYERINV,LAYERINV); break; // Pad layer change case 19 : // Prompt for parameters prompt=bae_plainmenutext(UPRPADLCHG); bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,0)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,0)) break; // Store pad function storebatfct(prompt,FCTPADLCHG, DDBCLLSTK,"","",0.0,layer1,layer2); break; // Pad layer copy case 20 : // Prompt for parameters prompt=bae_plainmenutext(UPRPADCPY); bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,0)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,0)) break; // Store pad function storebatfct(prompt,FCTPADCPY, DDBCLLSTK,"","",0.0,layer1,layer2); break; // Pad layer delete case 21 : // Prompt for parameters prompt=bae_plainmenutext(UPRPADDEL); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Store pad function storebatfct(prompt,FCTPADDEL,DDBCLLSTK, "","",0.0,layer1,LAYERINV); break; // Drill class change case 22 : // Prompt for parameters prompt=bae_plainmenutext(UPRDRLCCHG); bae_promptdialog(prompt+UPRSCLASS); if (askdrillclass(layer1,prompt+UPRSCLASS) || askdrillclass(layer2, prompt+" "+drillclass(layer1)+" "+UPRDCLASS)) break; // Store drill function storebatfct(prompt,FCTDRLCCHG, DDBCLLSTK,"","",0.0,layer1,layer2); break; // Attach/detach plan rule case 23 : prompt=bae_plainmenutext(UPRPLANRULE); if (askrulename(s1,prompt+UPRRULE)) break; // Ask for rule attachment mode bae_promptdialog(UPRRULEMODE); if ((mode=bae_askmenu(3,UPRRULE1,UPRRULE2, UPRABORT))<0 || mode>1) break; storebatfct(prompt,FCTPLANRULE,DDBCLLSTK, s1,"",0.0,0,mode); break; // Minimize workspace case 24 : prompt=bae_plainmenutext(UPRWSMIN); storebatfct(prompt,FCTWSMIN,DDBCLLSTK, "","",0.0,LAYERINV,LAYERINV); break; // Shrink workspace case 25 : prompt=bae_plainmenutext(UPRWSSHR); size=BELSTK; // Get the shrink parameter if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),0) || size<0.0) break; storebatfct(prompt,FCTWSSHR,DDBCLLSTK, "","",size,LAYERINV,LAYERINV); break; // Enlarge workspace case 26 : prompt=bae_plainmenutext(UPRWSENL); size=BELSTK; // Get the enlarge parameter if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),0) || size<0.0) break; storebatfct(prompt,FCTWSENL,DDBCLLSTK, "","",size,LAYERINV,LAYERINV); break; default : repflag2=0; } } while (repflag2); break; // Pads case 3 : // Repetively ask for pad batch function repflag2=1; do { s1=s2=""; bae_promptdialog(UPRBATFCT); switch (bae_askmenu(10,UPRPLYLCHG,UPRPLYDEL, UPRPLYPWIDTH,UPRPLYSIZE,UPRPLYRULE,UPRPLANRULE, UPRWSMIN,UPRWSSHR,UPRWSENL,UPRNOCHG)) { // Polygon layer change case 0 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYLCHG); bae_promptdialog(prompt+UPRSLAYER); if (ged_asklayer(layer1,0)) break; bae_promptdialog(prompt+UPRDLAYER); if (ged_asklayer(layer2,0)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store text function storebatfct(prompt,FCTPLYLCHG, DDBCLLPAD,"",s2,0.0,layer1,layer2); break; // Polygon layer delete case 1 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYDEL); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store text function storebatfct(prompt,FCTPLYDEL,DDBCLLPAD, "",s2,0.0,layer1,LAYERINV); break; // Assign polygon plot width case 2 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYPWIDTH); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,3)) break; size=0.0; if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),1)) break; storebatfct(prompt,FCTPLYPWIDTH,DDBCLLPAD, "","",size,layer1,LAYERINV); break; // Polygon size change case 3 : // Prompt for parameters prompt=bae_plainmenutext(UPRPLYSIZE); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) break; // Get the resize parameter size=0.0; if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),1)) break; // Get polygon type(s) s2=getpolytype(prompt,layer1); // Store polygon function storebatfct(prompt,FCTPLYSIZ,DDBCLLPAD, "",s2,size,layer1,LAYERINV); break; // Attach/detach polygon rule case 4 : prompt=bae_plainmenutext(UPRPLYRULE); bae_promptdialog(prompt+UPRLAYER); if (ged_asklayer(layer1,7)) error_abort(); // Get polygon type(s) s2=getpolytype(prompt,layer1); if (askrulename(s1,prompt+UPRRULE)) break; // Ask for rule attachment mode bae_promptdialog(UPRRULEMODE); if ((mode=bae_askmenu(3,UPRRULE1,UPRRULE2, UPRABORT))<0 || mode>1) break; storebatfct(prompt,FCTPLYRULE,DDBCLLPAD, s1,s2,0.0,layer1,mode); break; // Attach/detach plan rule case 5 : prompt=bae_plainmenutext(UPRPLANRULE); if (askrulename(s1,prompt+UPRRULE)) break; // Ask for rule attachment mode bae_promptdialog(UPRRULEMODE); if ((mode=bae_askmenu(3,UPRRULE1,UPRRULE2, UPRABORT))<0 || mode>1) break; storebatfct(prompt,FCTPLANRULE,DDBCLLPAD, s1,"",0.0,0,mode); break; // Minimize workspace case 6 : prompt=bae_plainmenutext(UPRWSMIN); storebatfct(prompt,FCTWSMIN,DDBCLLPAD, "","",0.0,LAYERINV,LAYERINV); break; // Shrink workspace case 7 : prompt=bae_plainmenutext(UPRWSSHR); size=BELPAD; // Get the shrink parameter if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),0) || size<0.0) break; storebatfct(prompt,FCTWSSHR,DDBCLLPAD, "","",size,LAYERINV,LAYERINV); break; // Enlarge workspace case 8 : prompt=bae_plainmenutext(UPRWSENL); size=BELPAD; // Get the enlarge parameter if (askdist(size,prompt+(lay_defusrunit() ? UPRSIZEI : UPRSIZEM),0) || size<0.0) break; storebatfct(prompt,FCTWSENL,DDBCLLPAD, "","",size,LAYERINV,LAYERINV); break; default : repflag2=0; } } while (repflag2); break; // Load batch case 4 : // Select the batch name if ((batname=selbatchname(0))=="") continue; batfctn=0; sprintf(sqlcommand,B_SELECT,sql_quotestr(batname)); sqlcmd(BAEMACRODB,sqlcommand,batloadfunc); break; // Save batch case 5 : // Select the batch name if ((batname=selbatchname(1))=="") continue; sprintf(sqlcommand,B_DELETE,sql_quotestr(batname)); sqlcmd(BAEMACRODB,sqlcommand,NULL); for (curfctidx=0;curfctidx=0 && lay_lastfigelem(nfig)==0) // Get rules if (rs_getfigrules(fig,rl)>0) // Attach rules if (lay_rulefigatt(nfig,rl)) rs_error(-1); // Update process counter batfctl[batidx].cnt++; elemchg=1; } // Delete group elements bae_callmenu(MNU_GEDDELGRP); } void text_lchg(int batidx) /* // Change text layer // Parameter : // int batidx : Batch index */ { string chgtxt /* Change text (pattern) */; int slayer /* Text source layer */; int dlayer /* Text destination layer */; index L_FIGURE fig /* Figure list index */; // Get the batch step parameters chgtxt=batfctl[batidx].s1; slayer=batfctl[batidx].l1; dlayer=batfctl[batidx].l2; // Select texts to group ged_groupselect(0,L_FIGTEXT,1); // Loop thru all text matching string to be changed forall (fig where fig.TYP==L_FIGTEXT && fig.LAYER==slayer && fig.GROUP && (fig.NAME==chgtxt || strmatch(fig.NAME,chgtxt)) && !(fig.FIXED&2)) { // Change layer if (ged_elemlaychg(fig,dlayer)) continue; // Update process counter batfctl[batidx].cnt++; elemchg=1; } // Reset group bae_callmenu(MNU_GEDGRPRESE); } void text_cpy(int batidx) /* // Copy text layer // Parameter : // int batidx : Batch index */ { string cpytxt /* Copy text (pattern) */; int slayer /* Text source layer */; int dlayer /* Text destination layer */; index L_FIGURE fig /* Figure list index */; index L_FIGURE nfig /* New figure list element */; STRINGS rl /* Rule list */; bae_postprocess(); // Get the batch step parameters cpytxt=batfctl[batidx].s1; slayer=batfctl[batidx].l1; dlayer=batfctl[batidx].l2; // Loop thru all text matching string to be copied forall (fig where fig.TYP==L_FIGTEXT && fig.LAYER==slayer && (fig.NAME==cpytxt || strmatch(fig.NAME,cpytxt))) { // Create text copy on destination layer if (ged_storetext(fig.NAME,fig.X,fig.Y, fig.ANGLE,fig.SIZE,dlayer,fig.MIRROR)) continue; // Transfer rules if (fig.RULEOBJID>=0 && lay_lastfigelem(nfig)==0) // Get rules if (rs_getfigrules(fig,rl)>0) // Attach rules if (lay_rulefigatt(nfig,rl)) rs_error(-1); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void text_del(int batidx) /* // Delete text string // Parameter : // int batidx : Batch index */ { string deltxt /* Text to be deleted */; int layer /* Text layer */; index L_FIGURE fig /* Figure list index */; index L_FIGURE dfig /* Delete figure list element */; // Get the batch step parameters deltxt=batfctl[batidx].s1; layer=batfctl[batidx].l1; // Loop thru all text matching string to be deleted forall (fig where fig.TYP==L_FIGTEXT && fig.LAYER==layer && (fig.NAME==deltxt || strmatch(fig.NAME,deltxt)) && !(fig.FIXED&2)) { dfig=fig; ged_delelem(dfig); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void text_size(int batidx) /* // Changes size of specified text // Parameter : // int batidx : Batch index */ { string txt /* Text to be changed */; double size /* New text size (in mm) */; int layer /* Text layer */; index L_FIGURE fig /* Figure list index */; // Get the batch step parameters txt=batfctl[batidx].s1; size=batfctl[batidx].size; layer=batfctl[batidx].l1; // Loop thru all text matching string to be changed forall (fig where fig.TYP==L_FIGTEXT && fig.LAYER==layer && (fig.NAME==txt || strmatch(fig.NAME,txt)) && cvtlength(fig.SIZE,0,2)!=size && !(fig.FIXED&2)) { ged_elemsizechg(fig,cvtlength(size,2,0)); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void text_minsize(int batidx) /* // Changes specified text's minimum size // Parameter : // int batidx : Batch index */ { string txt /* Text to be changed */; double size /* New minimum text size (in mm) */; int layer /* Text layer */; index L_FIGURE fig /* Figure list index */; // Get the batch step parameters txt=batfctl[batidx].s1; size=batfctl[batidx].size; layer=batfctl[batidx].l1; // Loop thru all text matching string to be changed forall (fig where fig.TYP==L_FIGTEXT && fig.LAYER==layer && (fig.NAME==txt || strmatch(fig.NAME,txt)) && cvtlength(fig.SIZE,0,2)size && !(fig.FIXED&2)) { ged_elemsizechg(fig,cvtlength(size,2,0)); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void text_plotwidth(int batidx) /* // Assign text plot width // Parameter : // int batidx : Batch index */ { string txt /* Text to be changed */; double pwidth /* New text plot width (in mm) */; int layer /* Text layer */; index L_FIGURE fig /* Figure list index */; // Get the batch step parameters txt=batfctl[batidx].s1; pwidth=cvtlength(batfctl[batidx].size,2,0); layer=batfctl[batidx].l1; // Loop thru all text matching string to be changed forall (fig where fig.TYP==L_FIGTEXT && fig.LAYER==layer && (fig.NAME==txt || strmatch(fig.NAME,txt)) && !(fig.FIXED&2)) { rs_assfigdblpred(fig,RS_PLOTWIDTH,pwidth,0.0,""); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void text_center(int batidx) /* // Center text // Parameter : // int batidx : Batch index */ { index L_FIGURE fig /* Figure list index */; index L_FIGURE nfig /* New figure list index */; index L_TEXT text /* Text index */; string txt /* Text to be changed */; double x,y /* Text position */; double vx,vy /* Text angle vector */; double ang /* Text angle */; double size /* Text size */; int mode /* Text mode */; int mirr /* Text mirroring */; int layer /* Text layer */; int tlen /* Text length */; STRINGS rl /* Rule list */; // Get the batch step parameters txt=batfctl[batidx].s1; layer=batfctl[batidx].l1; // Loop thru all text matching string to be changed forall (fig where fig.TYP==L_FIGTEXT && fig.LAYER==layer && (fig.NAME==txt || strmatch(fig.NAME,txt)) && !(fig.FIXED&2) && (fig.TEXT.MODE&(TEXTHCENT|TEXTVCENT))!= (TEXTHCENT|TEXTVCENT)) { // Get the text data text=fig.TEXT; x=text.X; y=text.Y; ang=text.ANGLE; size=text.SIZE; mode=text.MODE&TEXTEMSK; mirr=text.MIRROR; tlen=strlen(fig.NAME); // Get the text angle vector vx=cos(ang)*size; vy=sin(ang)*size; if ((mode&TEXTHCENT)==0) { x+=0.5*vx*tlen/1.5; y+=0.5*vy*tlen/1.5; } if ((mode&TEXTVCENT)==0) { x-=0.5*vy; y+=0.5*vx; } // Place the centered text ged_storetext(fig.NAME,x,y,ang,size,layer, mirr|mode|TEXTHCENT|TEXTVCENT); // Check if text should be fixed if (fig.FIXED && lay_lastfigelem(nfig)==0) ged_elemfixchg(nfig,fig.FIXED); // Transfer rules if (fig.RULEOBJID>=0 && lay_lastfigelem(nfig)==0) // Get rules if (rs_getfigrules(fig,rl)>0) // Attach rules if (lay_rulefigatt(nfig,rl)) rs_error(-1); ged_delelem(fig); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void text_origplc(int batidx) /* // Place standard text at origin // Parameter : // int batidx : Batch index */ { string txt /* Text string */; double size /* Text size (in mm) */; int layer /* Text layer */; int textmode /* Text center mode */; index L_TEXT ltxt /* Text index */; // Get the batch step parameters txt=batfctl[batidx].s1; size=batfctl[batidx].size; layer=batfctl[batidx].l1; textmode=batfctl[batidx].s2=="" ? 0 : atoi(batfctl[batidx].s2); // Check if text already placed forall (ltxt where ltxt.STR==txt && ltxt.LAYER==layer) return; // Place the text ged_storetext(txt,bae_planwsnx(),bae_planwsny(),0.0, cvtlength(size,2,0),layer,textmode); // Update process counter batfctl[batidx].cnt++; elemchg=1; } void text_pickplc(int batidx) /* // Place pick point text // Parameter : // int batidx : Batch index */ { string txt /* Text string */; double size /* Text size (in mm) */; int layer /* Text layer */; int pickmode /* Text pick point mode */; int textmode /* Text center mode */; index L_TEXT ltxt /* Text index */; index L_FIGURE fig /* Figure list index */; index L_NREF nref /* Named reference index */; // Get the batch step parameters txt=batfctl[batidx].s1; if (txt=="") txt="$"; size=batfctl[batidx].size; layer=batfctl[batidx].l1; textmode=batfctl[batidx].s2=="" ? 0 : atoi(batfctl[batidx].s2); if ((pickmode=batfctl[batidx].l2)<0) { scanlayer=(-pickmode); pickmode=1; } // Check if text already placed forall (ltxt where ltxt.STR==txt && ltxt.LAYER==layer) return; switch (pickmode) { // Center of pins case 0 : lx=ux=bae_planwsnx(); ly=uy=bae_planwsny(); pinn=0; if (lay_scanall(0.0,0.0,0.0,1,0, pinmacrofunc,NULL,NULL,NULL,NULL,NULL,NULL)) error_scan(); if (pinn) { // Place the text ged_storetext(txt,0.5*(lx+ux),0.5*(ly+uy),0.0, cvtlength(size,2,0),layer,textmode); // Update process counter batfctl[batidx].cnt++; elemchg=1; } break; // Center of graphics case 1 : lx=ux=bae_planwsnx(); ly=uy=bae_planwsny(); pinn=0; if (lay_scanall(0.0,0.0,0.0,1,0, NULL,polyfunc,NULL,NULL,NULL,laychk,NULL)) error_scan(); if (pinn) { // Place the text ged_storetext(txt,0.5*(lx+ux),0.5*(ly+uy),0.0, cvtlength(size,2,0),layer,textmode); // Update process counter batfctl[batidx].cnt++; elemchg=1; } break; // Origin case 2 : // Place the text ged_storetext(txt,bae_planwsnx(),bae_planwsny(),0.0, cvtlength(size,2,0),layer,textmode); // Update process counter batfctl[batidx].cnt++; elemchg=1; break; // Pin 1 case 3 : // Search pin 1 if (lay_nrefsearch("1",fig)==0) { ged_storetext(txt,fig.X,fig.Y,0.0, cvtlength(size,2,0),layer,textmode); // Update process counter batfctl[batidx].cnt++; elemchg=1; break; } // Search first pin forall (nref where nref.NAME!="#") { ged_storetext(txt,nref.X,nref.Y,0.0, cvtlength(size,2,0),layer,textmode); // Update process counter batfctl[batidx].cnt++; elemchg=1; break; } break; } } void text_heightdrc(int batidx) /* // Place height DRC documentation text(s) // Parameter : // int batidx : Batch index */ { index L_FIGURE fig /* Figure list index */; index L_FIGURE dfig /* Delete figure list element */; index L_POLY poly /* Polygon index */; index L_POINT p /* Point index */; string txt /* Text string */; string outstr /* Text output string */; double size /* Text size (in mm) */; double lx,ly,ux,uy /* Polygon boundaries */; double h /* Polygon height (in mm) */; int layer /* Text layer */; // Get the batch step parameters txt=batfctl[batidx].s1; size=cvtlength(batfctl[batidx].size,2,0); layer=batfctl[batidx].l1; // Delete old texts forall (fig where fig.TYP==L_FIGTEXT && fig.LAYER==layer && !(fig.FIXED&2)) { dfig=fig; ged_delelem(dfig); } forall (fig where fig.TYP==L_FIGPOLY) { poly=fig.POLY; // Check if height DRC polygon if (poly.LAYER!=layer || poly.TYP!=L_POLYKEEPOUT || lay_rulequery(RS_OCFIG,fig,RS_PCBSUBJ,RS_HEIGHT,"?f",h)<1) continue; // Loop for polygon points bae_clearpoints(); forall (p of poly) // Store point to internal list bae_storepoint(p.X,p.Y,p.TYP); // Get the polygon range bae_getpolyrange(lx,ly,ux,uy); // Place the text sprintf(outstr,txt,cvtlength(h,0,2)); ged_storetext(outstr, 0.5*(ux+lx)-0.5*size*strlen(outstr)*32.0/48.0, 0.5*(uy+ly),0.0,size,layer,0); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void text_rule(int batidx) /* // Attach/detach text rule // Parameter : // int batidx : Batch index */ { string txt /* Text (pattern) for rule att. */; string rule /* Rule name */; int layer /* Text layer */; int mode /* Attach mode */; index L_FIGURE fig /* Figure list index */; STRINGS rl /* Rule list */; int rn /* Rule count */; int nrn /* New rule count */; int i /* Loop control variable */; bae_postprocess(); // Get the batch step parameters txt=batfctl[batidx].s1; rule=batfctl[batidx].s2; layer=batfctl[batidx].l1; mode=batfctl[batidx].l2; // Loop thru all text matching string to be changed forall (fig where fig.TYP==L_FIGTEXT && fig.LAYER==layer && (fig.NAME==txt || strmatch(fig.NAME,txt))) { // Get the element rules nrn=rn=rs_getfigrules(fig,rl); for (i=0;i0) { if (lay_rulefigdet(fig)) rs_error(-1); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } } void text_nameattrmove(int batidx) /* // Convert name to attribute move // Parameter : // int batidx : Batch index */ { index L_FIGURE fig /* Figure list index */; index L_FIGURE dfig /* Delete figure list element */; index L_FIGURE nfig /* New figure list index */; index L_NREF nref /* Named reference index */; index L_MACRO macro /* Macro index */; index L_REFTEXT rmod /* Reference text modifier index */; struct refmoddes { // Reference text modifier descriptor double x,y /* Text position */; double ang /* Text angle */; double size /* Text size */; int mirr /* Text mirror flag */; int layer /* Text layer */; string str /* Text string */; } rtml[] /* Reference text modifier list */; int rtmn = 0 /* Part ref. text modifier count */; string lastname = "" /* Last part name buffer */; string name = "" /* Part name buffer */; string macname /* Part macro name buffer */; double x,y /* Part position buffer */; double ang /* Part angle buffer */; int mirr /* Part mirror buffer */; int robjid /* Part rule object id */; int fix /* Part fix state */; double btx, bty /* Transformed text position */; double tang /* Transformed rotation angle */; double asin, acos /* Angle sin, cos values */; int tmirr /* Transformed mirror flag */; int dlayer /* Move destination layer */; int cflag = 0 /* Change flag */; STRINGS rl /* Rule list */; int expertmode /* Expert mode */; int i /* Loop control variable */; bae_postprocess(); dlayer=batfctl[batidx].l1; // Loop for all parts forall (fig where fig.TYP==L_FIGNREF && fig.NAME!=lastname) { lastname=fig.NAME; // Buffer the part data nref=fig.NREF; name=nref.NAME; macro=nref.MACRO; macname=macro.NAME; x=nref.X; y=nref.Y; ang=nref.ANGLE; mirr=nref.MIRROR; fix=fig.FIXED; if ((robjid=fig.RULEOBJID)>=0) // Get rules if (rs_getfigrules(fig,rl)<=0) robjid=(-1); cflag=0; rtmn=0; forall (rmod of nref) { if (rmod.LAYER==LAYERINV) { cflag=1; rtml[rtmn].layer=dlayer; rtml[rtmn].str="$"; } else { rtml[rtmn].layer=rmod.LAYER; rtml[rtmn].str=rmod.STR; } // Transform rel. to abs. position asin=sin(mirr ? -ang : ang); acos=cos(mirr ? -ang : ang); btx=acos*(rmod.X-macro.MNX)-asin*(rmod.Y-macro.MNY); bty=asin*(rmod.X-macro.MNX)+acos*(rmod.Y-macro.MNY); bty= mirr ? (-bty) : bty ; tmirr=(rmod.MIRROR!=0)!=(mirr!=0) ? 1 : 0 ; tang=rmod.ANGLE; tang+=tmirr ? -ang : ang ; rtml[rtmn].x=btx; rtml[rtmn].y=bty; rtml[rtmn].ang=tang; rtml[rtmn].size=rmod.SIZE; rtml[rtmn].mirr=tmirr; rtmn++; } if (!cflag) continue; // Delete the old part dfig=fig; // Set the expert mode expertmode=101; bae_storepoint(0.0,0.0,expertmode); if (ged_delelem(dfig)) { // Reset the expert mode expertmode++; bae_storepoint(0.0,0.0,expertmode); error(ERRDELETE); } // Reset the expert mode expertmode++; bae_storepoint(0.0,0.0,expertmode); // Place part at same position if (ged_storepart(name,macname,x,y,ang,mirr)<0) error(ERRCREATE); // Check if part should be fixed if (fix && lay_lastfigelem(nfig)==0) ged_elemfixchg(nfig,fix); // Transfer rules if (robjid>=0 && lay_lastfigelem(nfig)==0) // Attach rules if (lay_rulefigatt(nfig,rl)) rs_error(-1); for (i=0;i=0 && lay_lastfigelem(nfig)==0) // Get rules if (rs_getfigrules(fig,rl)>0) // Attach rules if (lay_rulefigatt(nfig,rl)) rs_error(-1); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void poly_drc(int batidx) /* // Derive polygon DRC layer // Parameter : // int batidx : Batch index */ { int slayer /* Polygon source layer */; int dlayer /* Polygon destination layer */; double height /* Polygon default height value */; int typmask /* Polygon type mask */; index L_FIGURE fig /* Figure list index */; index L_FIGURE nfig /* New figure list element */; index L_POLY poly /* Polygon index */; index L_POINT point /* Polygon point index */; double lx,ly,ux,uy /* DRC boundaries */; double plx,ply,pux,puy /* Polygon boundaries */; int bfound = 0 /* Boundaries found flag */; // Get the batch step parameters slayer=batfctl[batidx].l1; dlayer=batfctl[batidx].l2; height=batfctl[batidx].size; typmask= batfctl[batidx].s2=="" ? 0xFFFF : atoi(batfctl[batidx].s2); // Loop thru all DRC polygons on destination layer forall (fig where fig.TYP==L_FIGPOLY && fig.LAYER==dlayer && fig.POLY.TYP==L_POLYKEEPOUT) // DRC already defined return; // Loop thru all polygons on source layer forall (fig where fig.TYP==L_FIGPOLY && fig.LAYER==slayer && ((1<ux) ux=pux; if (plyuy) uy=puy; } else { // Set boundary lx=plx; ly=ply; ux=pux; uy=puy; bfound=1; } } // Check if valid boundary found if (!bfound || lx==ux || ly==uy) { // Set default boundaries lx=bae_planwslx(); ly=bae_planwsly(); ux=bae_planwsux(); uy=bae_planwsuy(); } // Create DRC polygon on destination layer bae_clearpoints(); bae_storepoint(lx,ly,0); bae_storepoint(ux,ly,0); bae_storepoint(ux,uy,0); bae_storepoint(lx,uy,0); if (ged_storepoly(dlayer,L_POLYKEEPOUT,"",0)) return; if (lay_lastfigelem(nfig)==0) // Assign the height DRC predicate rule rs_assfigdblpred(nfig,RS_HEIGHT,height,0.0,""); // Update process counter batfctl[batidx].cnt++; elemchg=1; } void poly_del(int batidx) /* // Delete polygon layer // Parameter : // int batidx : Batch index */ { int layer /* Polygon layer */; int typmask /* Polygon type mask */; index L_FIGURE fig /* Figure list index */; index L_FIGURE dfig /* Delete figure list element */; // Get the batch step parameters layer=batfctl[batidx].l1; typmask= batfctl[batidx].s2=="" ? 0xFFFF : atoi(batfctl[batidx].s2); // Loop thru all polygons matching layer to be changed forall (fig where fig.TYP==L_FIGPOLY && fig.LAYER==layer && !(fig.FIXED&2) && ((1<0) { if (lay_rulefigdet(fig)) rs_error(-1); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } } void plan_rule(int batidx) /* // Attach/detach plan rule // Parameter : // int batidx : Batch index */ { string rule /* Rule name */; int mode /* Attach mode */; STRINGS rl /* Rule list */; int rn /* Rule count */; int nrn /* New rule count */; int i /* Loop control variable */; bae_postprocess(); // Get the batch step parameters rule=batfctl[batidx].s1; mode=batfctl[batidx].l2; // Get the plan rules nrn=rn=rs_getplanrules(rl); for (i=0;i0) { if (lay_ruleplandet()) rs_error(-1); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void stkchange(int batidx) /* // Exchange padstack macros // Parameter : // int batidx : Batch index */ { string sstk /* Source padstack macro */; string dstk /* Destination padstack macro */; index L_FIGURE fig /* Figure list index */; int selcnt = 0 /* Selection count */; // Get the batch step parameters sstk=batfctl[batidx].s1; dstk=batfctl[batidx].s2; // Select all pins with given macro forall (fig where fig.TYP==L_FIGNREF && fig.NREF.MACRO.NAME==sstk && !(fig.FIXED&2)) { ged_elemgrpchg(fig,1); selcnt++; } // Check if any pin selected if (selcnt==0) return; // Change pin padstack macro bae_clriactqueue(); bae_storetextiact(1,dstk); bae_callmenu(MNU_GEDGRPMACN); // Reset group bae_callmenu(MNU_GEDGRPRESE); // Update process counter batfctl[batidx].cnt+=selcnt; elemchg=1; } void pad_chg(int batidx) /* // Change pad macro // Parameter : // int batidx : Batch index */ { string spad /* Source pad macro */; string dpad /* Destination pad macro */; index L_FIGURE fig /* Figure list index */; int selcnt = 0 /* Selection count */; // Get the batch step parameters spad=batfctl[batidx].s1; dpad=batfctl[batidx].s2; // Select all pads with given macro forall (fig where fig.TYP==L_FIGUREF && fig.UREF.MACRO.NAME==spad && !(fig.FIXED&2)) { ged_elemgrpchg(fig,1); selcnt++; } // Check if any pad selected if (selcnt==0) return; // Change pad macro bae_clriactqueue(); bae_storetextiact(1,dpad); bae_callmenu(MNU_GEDGRPMACN); // Reset group bae_callmenu(MNU_GEDGRPRESE); // Update process counter batfctl[batidx].cnt+=selcnt; elemchg=1; } void pad_lchg(int batidx) /* // Change pad layer // Parameter : // int batidx : Batch index */ { int slayer /* Text source layer */; int dlayer /* Text destination layer */; index L_FIGURE fig /* Figure list index */; // Get the batch step parameters slayer=batfctl[batidx].l1; dlayer=batfctl[batidx].l2; // Loop thru all pads on source layer forall (fig where fig.TYP==L_FIGUREF && fig.LAYER==slayer && !(fig.FIXED&2)) { // Change layer if (ged_elemlaychg(fig,dlayer)) continue; // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void pad_cpy(int batidx) /* // Copy pad layer // Parameter : // int batidx : Batch index */ { int slayer /* Text source layer */; int dlayer /* Text destination layer */; index L_FIGURE fig /* Figure list index */; index L_FIGURE nfig /* New figure list element */; STRINGS rl /* Rule list */; bae_postprocess(); // Get the batch step parameters slayer=batfctl[batidx].l1; dlayer=batfctl[batidx].l2; // Loop thru all pads on source layer forall (fig where fig.TYP==L_FIGUREF && fig.LAYER==slayer) { // Create pad copy on destination layer if (ged_storeuref(fig.UREF.MACRO.NAME, fig.X,fig.Y,fig.ANGLE,dlayer,fig.MIRROR)) continue; // Transfer rules if (fig.RULEOBJID>=0 && lay_lastfigelem(nfig)==0) // Get rules if (rs_getfigrules(fig,rl)>0) // Attach rules if (lay_rulefigatt(nfig,rl)) rs_error(-1); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void pad_del(int batidx) /* // Delete pads on given layer // Parameter : // int batidx : Batch index */ { int layer /* Polygon layer */; index L_FIGURE fig /* Figure list index */; index L_FIGURE dfig /* Delete figure list element */; // Get the batch step parameters layer=batfctl[batidx].l1; // Loop thru all pads on given layer forall (fig where fig.TYP==L_FIGUREF && fig.LAYER==layer && !(fig.FIXED&2)) { dfig=fig; ged_delelem(dfig); // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void drill_cchg(int batidx) /* // Change drill class // Parameter : // int batidx : Batch index */ { int sclass /* Drill source class */; int dclass /* Drill destination class */; index L_FIGURE fig /* Figure list index */; // Get the batch step parameters sclass=batfctl[batidx].l1; dclass=batfctl[batidx].l2; // Loop thru all drills with source class forall (fig where fig.TYP==L_FIGDRILL && fig.LAYER==sclass && !(fig.FIXED&2)) { // Change layer if (ged_elemlaychg(fig,dclass)) continue; // Update process counter batfctl[batidx].cnt++; elemchg=1; } } void wsminimize(int batidx) /* // Minimize workspace size // Parameter : // int batidx : Batch index */ { double nx, ny /* New boundary coordinates */; int gridlock /* Grid lock flag */; // Free grid lock if (gridlock=bae_getgridlock()) { bae_setintpar(22,1); bae_setgridlock(0); bae_setintpar(22,0); } // Set upper workspace boundary bae_clriactqueue(); if ((nx=(bae_planwslx()+SMALLVAL))bae_planwsnx()) nx=bae_planwsnx(); if ((ny=(bae_planwsuy()-SMALLVAL))>bae_planwsny()) ny=bae_planwsny(); bae_storemouseiact(1,nx,ny,0,LMB); bae_callmenu(MNU_GEDPARLBND); // Restore grid lock mode bae_setintpar(22,1); bae_setgridlock(gridlock); bae_setintpar(22,0); // Update process counter batfctl[batidx].cnt++; elemchg=1; } void wsshrink(int batidx) /* // Shrink workspace size // Parameter : // int batidx : Batch index */ { double shrink /* Shrink size */; double nx, ny /* New boundary coordinates */; int gridlock /* Grid lock flag */; // Get the shrink parameter shrink=batfctl[batidx].size; // Free grid lock if (gridlock=bae_getgridlock()) { bae_setintpar(22,1); bae_setgridlock(0); bae_setintpar(22,0); } // Set upper workspace boundary bae_clriactqueue(); if ((nx=(bae_planwsux()-shrink))bae_planwsnx()) nx=bae_planwsnx(); if ((ny=(bae_planwsly()+shrink))>bae_planwsny()) ny=bae_planwsny(); bae_storemouseiact(1,nx,ny,0,LMB); bae_callmenu(MNU_GEDPARLBND); // Restore grid lock mode bae_setintpar(22,1); bae_setgridlock(gridlock); bae_setintpar(22,0); // Update process counter batfctl[batidx].cnt++; elemchg=1; } void wsenlarge(int batidx) /* // Enlarge workspace size // Parameter : // int batidx : Batch index */ { double enlarge /* Enlarge size */; int gridlock /* Grid lock flag */; // Get the enlarge parameter enlarge=batfctl[batidx].size; // Free grid lock if (gridlock=bae_getgridlock()) { bae_setintpar(22,1); bae_setgridlock(0); bae_setintpar(22,0); } // Set upper workspace boundary bae_clriactqueue(); bae_storemouseiact(1, bae_planwsux()+enlarge,bae_planwsuy()+enlarge,0,LMB); bae_callmenu(MNU_GEDPARUBND); // Set lower workspace boundary bae_clriactqueue(); bae_storemouseiact(1, bae_planwslx()-enlarge,bae_planwsly()-enlarge,0,LMB); bae_callmenu(MNU_GEDPARLBND); // Restore grid lock mode bae_setintpar(22,1); bae_setgridlock(gridlock); bae_setintpar(22,0); // Update process counter batfctl[batidx].cnt++; elemchg=1; } string getpolytype(string prompt,int layer) /* // Edit polygon type batch step // Return value : // zero if done or (-1) on error // Parameters : // string prompt : Prompt message // int layer : Polygon layer */ { double cy /* Current y value */; int pcidx = (-1) /* Passive copper index */; int acidx = (-1) /* Passive copper index */; int koidx = (-1) /* Keepout area index */; int dlidx = (-1) /* Documentary line index */; int daidx = (-1) /* Documentary area index */; int cfidx = (-1) /* Copper fill index */; int ptfield = 0 /* Polygon type field */; int intpar /* Integer parameter query result */; // Check for dialog support if (bae_dialclr()) return("-1"); // Check if power layer polygon if (layer>=POWLAYBASE && layer=DOCLAYBASE) { dlidx=bae_dialaddcontrol(PA_TOGGLE,0,0,1,0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,0.0,polytypename(L_POLYDOCLINE)); cy+=DIAL_CTRVSTEP; } if (layer>=DOCLAYBASE || bae_swconfig(0)==BAE_HighEnd) { daidx=bae_dialaddcontrol(PA_TOGGLE,0,0,1,0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,0.0,polytypename(L_POLYDOCAREA)); cy+=DIAL_CTRVSTEP; } cfidx=bae_dialaddcontrol(PA_TOGGLE,0,0,1,0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,0.0,polytypename(L_POLYCOPFILL)); cy+=DIAL_CTRVSTEP; // Store the OK and abort button with seperator dial_hsep(cy); dial_okabort(cy); // Call the dialog function bae_setintpar(16,3036); if (bae_dialaskparams(prompt,0,DIAL_LEFTMARG+20.0+DIAL_RIGHTSMARG,cy)) error_abort(); if (pcidx>=0) { bae_dialgetdata(pcidx,intpar,0.0,""); if (intpar) ptfield|=1<=0) { bae_dialgetdata(acidx,intpar,0.0,""); if (intpar) ptfield|=1<=0) { bae_dialgetdata(koidx,intpar,0.0,""); if (intpar) ptfield|=1<=0) { bae_dialgetdata(dlidx,intpar,0.0,""); if (intpar) ptfield|=1<=0) { bae_dialgetdata(daidx,intpar,0.0,""); if (intpar) ptfield|=1<=0) { bae_dialgetdata(cfidx,intpar,0.0,""); if (intpar) ptfield|=1<ux) ux=x; if (yuy) uy=y; } pinn++; } // Continue scan return(1); } int polyfunc(index L_POLY poly,int layer, int polyinws,int tree,index L_LEVEL level) /* // Output an already transformed polygon data block to PS file // Return value : // zero if done or (-1) on file error // Parameters : // index L_POLY poly : Polygon // int layer : Polygon layer // int polyinws : Poly in workspace flag // int tree : Polygon tree number // index L_LEVEL level : Polygon level */ { index L_POINT point /* Polygon point */; double rlx,rly,rux,ruy /* Polygon range */; // 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(rlx,rly,rux,ruy); if (pinn==0) { lx=rlx; ly=rly; ux=rux; uy=ruy; } else { if (rlxux) ux=rux; if (rlyuy) uy=ruy; } pinn++; // Return without errors return(0); } int laychk(int layer) /* // Graphic layer check routine // Return value : // zero if scan break requested, 1 if scan allowed // Parameters : // int layer : Layer code */ { // Check the layer return(layer==scanlayer ? 1 : 0); } string batchname(int batidx) /* // Get the name of a batch step // Returns : batch name string // Parameter : // int batidx : Batch step index */ { string name /* Batch step name string */; int textmode /* Text mode */; sprintf(name,"%s %s", ddbclassname(batfctl[batidx].c),batfctl[batidx].rep); if (batfctl[batidx].s1) name+=" '"+batfctl[batidx].s1+"'"; if (batfctl[batidx].s2) { switch (batfctl[batidx].ft) { case FCTPLYLCHG : case FCTPLYCPY : case FCTPLYDRC : case FCTPLYDEL : case FCTPLYSIZ : case FCTPLYRULE : break; default : name+=" '"+batfctl[batidx].s2+"'"; } } if (batfctl[batidx].size!=0.0) { switch (batfctl[batidx].ft) { case FCTWSSHR : case FCTWSENL : case FCTPLYSIZ : case FCTPLYPWIDTH : case FCTPLYDRC : name+=" "+ftoa(cvtlength(batfctl[batidx].size,0,2),2)+ " [mm]"; break; default : name+=" "+ftoa(batfctl[batidx].size,2)+" [mm]"; } } if (batfctl[batidx].ft==FCTDRLCCHG) { name+=" "+drillclass(batfctl[batidx].l1)+" / "+ drillclass(batfctl[batidx].l2); } else if (batfctl[batidx].l1!=LAYERINV) { name+=" "+purelayername(batfctl[batidx].l1); if (batfctl[batidx].l2!=LAYERINV) { switch (batfctl[batidx].ft) { case FCTTXTPICK : switch (batfctl[batidx].l2) { case 0 : name+=" "+bae_plainmenutext(UPRPICK1); break; case 2 : name+=" "+bae_plainmenutext(UPRPICK3); break; case 3 : name+=" "+bae_plainmenutext(UPRPICK4); break; default : name+= " "+bae_plainmenutext(UPRPICK2)+" "+ purelayername(-batfctl[batidx].l2); break; } textmode=batfctl[batidx].s2=="" ? 0 : atoi(batfctl[batidx].s2); if (textmode==TEXTHCENT) name+=" "+bae_plainmenutext(UPRCENT2); else if (textmode==TEXTVCENT) name+=" "+bae_plainmenutext(UPRCENT3); else if (textmode==(TEXTHCENT|TEXTVCENT)) name+=" "+bae_plainmenutext(UPRCENT4); break; case FCTTXTRULE : case FCTPLYRULE : name+=" "+ (batfctl[batidx].l2 ? UPRRULE2 : UPRRULE1); break; default : name+=" / "+purelayername(batfctl[batidx].l2); } } } switch (batfctl[batidx].ft) { case FCTPLYLCHG : case FCTPLYCPY : case FCTPLYDRC : case FCTPLYDEL : case FCTPLYSIZ : case FCTPLYRULE : if (batfctl[batidx].s2!="") name+=" Polygon Types "+batfctl[batidx].s2; } // Return batch step name return(name); } string drillclass(int code) /* // Convert drill class code to item character // Return value : // drill class code denote character // Parameters : // int code : Drill class code */ { string cstr /* Drill class string */; int class /* Drill class */; int mclass /* Mirrored drill class */; // Get the class codes class= (code&DRLCMASK1); mclass= (code&DRLCMIRR) ? ((code&DRLCMASK2)>>DRLCSHFT2) : class; // Check the class codes if (class<0 || class>26 || mclass<0 || mclass>26) // Undefined return("*"); if (class==mclass) sprintf(cstr,"'%c'",class==0 ? '-' : (class+'A'-1)); else sprintf(cstr,"'%c'/'%c'",class==0 ? '-' : (class+'A'-1), mclass==0 ? '-' : ( mclass+'A'-1)); return(cstr); } /*________________________________________________________________*/ // SQL/DB selection callback functions static int batloadfunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Batch function callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { // Store the current entry switch (didx) { // Index case 1 : curfctidx=dint; if (curfctidx>=batfctn) batfctn=curfctidx+1; break; // Report string sequence case 2 : batfctl[curfctidx].rep=dstr; break; // Function type case 3 : batfctl[curfctidx].ft=dint; break; // Element class case 4 : batfctl[curfctidx].c=dint; break; // First string case 5 : batfctl[curfctidx].s1=dstr; break; // Second string case 6 : batfctl[curfctidx].s2=dstr; break; // Size case 7 : batfctl[curfctidx].size=ddbl; break; // First layer case 8 : batfctl[curfctidx].l1=dint; break; // Second layer case 9 : batfctl[curfctidx].l2=dint; break; } // Return without errors return(0); } int batnamefunc(string dstr,int dint,double ddbl, int dval,int dtype,string dtable,string dfield,int didx) /* // Batch name list callback function // Return value : // zero if done or (-1) on data error // Parameters : // string dstr : String/Date data // int dint : Integer/Boolean data // double ddbl : Float data // int dval : Data valid flag // int dtype : Data type // string dtable : Data table name // string dfield : Data field name // int didx : Data output field index */ { int i /* Loop control variable */; switch (didx) { // Name case 1 : for (i=batn;i>0;i--) if (batl[i-1]>dstr) batl[i]=batl[i-1]; else break; batl[i]=dstr; batn++; break; } // Return without errors return(0); } string selbatchname(int new) /* // Perform a batch name input // Return value : // batch name string // Parameter : // int new : New batch name input */ { STRINGS hl /* Header list */; int hn /* Header count */; string batname /* Batch name */; string msg /* Message string */; int i /* Loop control variable */; // Show the batch edit functions if (new) { batn=0; for (i=0;i>DRLCSHFT2) : drlclass; // Perform the rule input loop bae_prtdialog(""); // Check if dialog box support if (bae_dialclr()) { } else { do { bae_dialclr(); cy=DIAL_TOPMARG; // Store the OK and abort button with seperator bae_dialaddcontrol(PA_OK,0,0,0,0.0,0.0,0.0,"", 0,DIAL_LEFTMARG,cy,0.0,""); bae_dialaddcontrol(PA_ABORT,0,0,0,0.0,0.0,0.0,"", 0,DIAL_LEFTMARG+5.0,cy,0.0,""); cy+=DIAL_BUTVSTEP; dial_label(0.0,cy,UPRCLASS); cidx=dial_selbox(class,19.0,cy); classname="&-"; for (i=0;i<=26;i++) { if (i!=0) classname[1]='A'+i-1; dial_sbentry(1,i,classname); } dial_label(0.0,cy,UPRMCLASS); cmidx=dial_selbox(mclass,19.0,cy); classname="&-"; for (i=0;i<=26;i++) { if (i!=0) classname[1]='A'+i-1; dial_sbentry(0,i,classname); } // Display dialog box bae_setintpar(16,3092); switch (bae_dialaskparams(prompt,0, DIAL_LEFTMARG+25.0+DIAL_RIGHTSMARG,cy+DIAL_SEPVSTEP)) { // Done case 0 : bae_dialgetdata(cidx,class,0.0,""); bae_dialgetdata(cmidx,mclass,0.0,""); repflag=0; break; // Drill class change case 1 : bae_dialgetdata(cidx,class,0.0,""); mclass=class; break; default : return(-1); } } while (repflag); } // Return class drlclass= class|(class!=mclass ? (DRLCMIRR|(mclass<