(function(){return { "formats": { "ODB": {}, "ODB_1": { "comments": "", "arrStep": "stp", "isMerge": "yes" }, "Gerber274x_1": { "nf1": 3, "nf2": 4, "units": "mm", "zeroes": "leading", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "*", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Gerber274x_2": { "nf1": 3, "nf2": 5, "units": "inch", "zeroes": "leading", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "*", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Gerber274x_3": { "nf1": 3, "nf2": 5, "units": "mm", "zeroes": "leading", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "*", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Gerber274x_4": { "nf1": 2, "nf2": 4, "units": "mm", "zeroes": "leading", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "*", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Gerber274x_5": { "nf1": 2, "nf2": 3, "units": "mm", "zeroes": "leading", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "*", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "mm", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Excellon1_1":{ "nf1": 3, "nf2": 0, "units": "mm", "zeroes": "leading", "decimal": "yes", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "mm", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Excellon2_1": { "nf1": 3, "nf2": 5, "units": "mm", "zeroes": "leading", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "mm", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Excellon2_2": { "nf1": 2, "nf2": 3, "units": "inch", "zeroes": "leading", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Excellon2_3": { "nf1": 2, "nf2": 5, "units": "inch", "zeroes": "trailing", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "mm", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Excellon2_4": { "nf1": 3, "nf2": 3, "units": "mm", "zeroes": "leading", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "mm", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Excellon2_5": { "nf1": 2, "nf2": 3, "units": "mm", "zeroes": "leading", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "mm", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Excellon2_6": { "nf1": 3, "nf2": 4, "units": "mm", "zeroes": "leading", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "mm", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Excellon2_7": { "nf1": 3, "nf2": 4, "units": "inch", "zeroes": "none", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Excellon2_8": { "nf1": 2, "nf2": 5, "units": "inch", "zeroes": "none", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "Excellon2_9": { "nf1": 2, "nf2": 3, "units": "inch", "zeroes": "trailing", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 }, "IPC356_1": { "nf1": 2, "nf2": 4, "units": "inch", "zeroes": "none", "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "*", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": "inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 } }, "customer": { "2171": { "step": "cad", "rules": [ { "valid": function(props){ var file = props.file; return /.+\.tgz$/ig.test(file.name) }, "type": "ODB", "format": "ODB" }, { "valid": function(props){ var file = props.file; return /.+\.art$|\.gbr$/ig.test(file.name) }, "type": "Gerber274x", "format": "Gerber274x_2", "format_params": function(props){ var params = props.params if(params.art_param){ var leading = params.art_param["SUPPRESS_LEAD_ZEROES"] var trailing = params.art_param["SUPPRESS_TRAIL_ZEROES"] var zeroes = "none" if(/yes/ig.test(leading)){ zeroes = "leading" } if(/yes/ig.test(trailing)){ zeroes = "trailing" } var nf1,nf2 if(params.art_param.hasOwnProperty("FORMAT")){ var tmp = params.art_param["FORMAT"].split(".") if(/\d+/ig.test(tmp[0])){nf1 = Number(tmp[0])} if(/\d+/ig.test(tmp[1])){nf2 = Number(tmp[1])} } return { "nf1": nf1 || 3, "nf2": nf2 || 5, "units": /METRIC|MM/ig.test(params.art_param["OUTPUT_UNITS"])? "mm" :"inch", "zeroes": zeroes, "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "*", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": /METRIC|MM/ig.test(params.art_param["OUTPUT_UNITS"])? "mm" :"inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 } } } }, { "valid": function(props){ var file = props.file; return /.+\.drl$/ig.test(file.name) }, "type": "Excellon2", "format": "Excellon2_1", "format_params": function(props){ var params = props.params if(params.nc_param){ var leading = params.nc_param["SUPPRESS_LEAD_ZEROES"] var trailing = params.nc_param["SUPPRESS_TRAIL_ZEROES"] var zeroes = "none" if(/yes/ig.test(leading)){ zeroes = "leading" } if(/yes/ig.test(trailing)){ zeroes = "trailing" } return { "nf1": params.nc_param["INTEGER_PLACES"]? Number(params.nc_param["INTEGER_PLACES"]) : 3, "nf2": params.nc_param["DECIMAL_PLACES"]? Number(params.nc_param["DECIMAL_PLACES"]) : 5, "units": /METRIC|MM/ig.test(params.nc_param["OUTPUT_UNITS"])? "mm" :"inch", "zeroes": zeroes, "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": /METRIC|MM/ig.test(params.nc_param["OUTPUT_UNITS"])? "mm" :"inch", "coordinates": params.nc_param["COORDINATES"]? params.nc_param["COORDINATES"].toLowerCase() :"absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 } } } }, { "valid": function(props){ var file = props.file; return /.+\.drd$/ig.test(file.name) }, "type": "Excellon1", "format": "Excellon1_1" }, { "valid": function(props){ var file = props.file; return /.+\.phd$/ig.test(file.name) }, "type": "Gerber274x", "format": "Gerber274x_1" } ], "tl_name": [ {"orig_name" : ["^comp_+_top$"], "tl_name" : "comp_+_top" }, {"orig_name" : ["^comp_+_bot$"], "tl_name" : "comp_+_bot" }, {"orig_name" : ["top_enig","top-enig","enig_top"], "tl_name" : "enig_top" }, {"orig_name" : ["bot_enig","bot-enig","enig_bot"], "tl_name" : "enig_bot" }, {"orig_name" : ["top_(?:solder)paste","^spt(?:\\.gbr)?$","^past_top$"], "tl_name" : "past_top" }, {"orig_name" : ["bot(?:tom)?_(?:solder)paste","^spb(?:\\.gbr)?$","^past_botm$"], "tl_name" : "past_botm" }, {"orig_name" : ["top_silk","^sst(?:\\.gbr)?$","^silk_top$"], "tl_name" : "silk_top" }, {"orig_name" : ["bot(?:tom)?_silk","^ssb(?:\\.gbr)?$","^silk_bot$"], "tl_name" : "silk_bot" }, {"orig_name" : ["top_(?:solder)mask","^smt(?:\\.gbr)?$","^sm_top$"], "tl_name" : "sm_top" }, {"orig_name" : ["bot(?:tom)?_(?:solder)mask","^smb(?:\\.gbr)?$","^sm_botm$"], "tl_name" : "sm_botm" }, {"orig_name" : ["^top$","^top\\.gbr$","^top\\.art$"], "tl_name" : "top" }, {"orig_name" : "^drill(?:\\.drl)$", "tl_name" : "drill" }, {"orig_name" : ["^board_outline$","outline\\.gbr|outline\\.art","^outline$"], "tl_name" : "outline" }, {"orig_name" : ["^rout$","\\.rou$"], "tl_name" : "rout" }, {"orig_name" : ["^bottom$","^bottom\\.gbr$","^bottom\\.art$"], "tl_name" : "bottom" }, {"orig_name" : ["^inner_(\\d+)\\.art","^l(\\d+)","^isl(\\d+)(?:\\.gbr)?$","^layer_(\\d+)$"], "tl_name" : "l_($1)"}, {"orig_name" : ["-(\\d+)-(\\d+)(?:-laser)?\\.drl","_isl(\\d+)_isl(\\d+)","d(\\d+)-(\\d+)"], "tl_name" : "d_($1)-($2)"}, {"orig_name" : ["_top_isl(\\d+)"], "tl_name" : "d_1-($1)"}, {"orig_name" : ["_isl(\\d+)_bottom"], "tl_name" : "d_($1)-($1+1)"} ] }, "Yucca": { "step": "cad", "rules": [ { "valid": function(props){ var file = props.file; return /.+\.tgz$/ig.test(file.name) }, "type": "ODB", "format": "ODB" }, { "valid": function(props){ var file = props.file; return /.+\.ipc$/ig.test(file.name) }, "type": "IPC356", "format": "IPC356_1" }, { "valid": function(props){ var file = props.file; return /.+\.rou$/ig.test(file.name) }, "type": "Excellon2", "format": "Excellon2_3" }, { "valid": function(props){ var file = props.file; return /\.ncd/ig.test(file.name) }, "type": "Excellon2", "format": "Excellon2_9" }, { "valid": function(props){ var file = props.file; return /.+\.gbr$|.+\.art$|\.l\d+$|\.r1$|\.sb$|\.st$|\.d\d+-\d+|\.[bt]sm$|\.drwg$|\.p\d+p$|\.gdo/ig.test(file.name) }, "type": "Gerber274x", "format": "Gerber274x_2", "format_params": function(props){ var params = props.params if(params.art_param){ var leading = params.art_param["SUPPRESS_LEAD_ZEROES"] var trailing = params.art_param["SUPPRESS_TRAIL_ZEROES"] var zeroes = "none" if(/yes/ig.test(leading)){ zeroes = "leading" } if(/yes/ig.test(trailing)){ zeroes = "trailing" } var nf1,nf2 if(params.art_param.hasOwnProperty("FORMAT")){ var tmp = params.art_param["FORMAT"].split(".") if(/\d+/ig.test(tmp[0])){nf1 = Number(tmp[0])} if(/\d+/ig.test(tmp[1])){nf2 = Number(tmp[1])} } return { "nf1": nf1 || 3, "nf2": nf2 || 5, "units": /METRIC|MM/ig.test(params.art_param["OUTPUT_UNITS"])? "mm" :"inch", "zeroes": zeroes, "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "*", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": /METRIC|MM/ig.test(params.art_param["OUTPUT_UNITS"])? "mm" :"inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 } } } }, { "valid": function(props){ var file = props.file; return /.+\.drl$/ig.test(file.name) }, "type": "Excellon2", "format": "Excellon2_1", "format_params": function(props){ var params = props.params if(params.nc_param){ var leading = params.nc_param["SUPPRESS_LEAD_ZEROES"] var trailing = params.nc_param["SUPPRESS_TRAIL_ZEROES"] var zeroes = "none" if(/yes/ig.test(leading)){ zeroes = "leading" } if(/yes/ig.test(trailing)){ zeroes = "trailing" } if(!params.nc_param["OUTPUT_UNITS"]){ params.nc_param["OUTPUT_UNITS"] = params.art_param["OUTPUT_UNITS"]} return { "nf1": params.nc_param["INTEGER_PLACES"]? Number(params.nc_param["INTEGER_PLACES"]) : 3, "nf2": params.nc_param["DECIMAL_PLACES"]? Number(params.nc_param["DECIMAL_PLACES"]) : 5, "units": /METRIC|MM/ig.test(params.nc_param["OUTPUT_UNITS"])? "mm" :"inch", "zeroes": zeroes, "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": /METRIC|MM/ig.test(params.nc_param["OUTPUT_UNITS"])? "mm" :"inch", "coordinates": params.nc_param["COORDINATES"]? params.nc_param["COORDINATES"].toLowerCase() :"absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 } } } } ], "tl_name": [ {"orig_name" : ["^comp_+_top$"], "tl_name" : "comp_+_top" }, {"orig_name" : ["^comp_+_bot$"], "tl_name" : "comp_+_bot" }, {"orig_name" : ["^pm_top","spcs\\.gbr$|paste.pri|pripaste|solderpaste_top","ppst\\.art|spt\\.art","assy[_-]?top\\.art","past_top","paste_top|spt"], "tl_name" : "past_top" }, {"orig_name" : ["^pm_bot","spps\\.gbr$|paste.sec|secpaste|solderpaste_bottom","spst\\.art|spb\\.art","assy[_-]?bott?o?m?\\.art","past_bot","paste_bot|spb"], "tl_name" : "past_botm" }, {"orig_name" : ["silk.pri","pleg\\.art|sst\\.art","^ss_top|sscs\\.gbr$","silk_top|sst"], "tl_name" : "silk_top" }, {"orig_name" : ["silk.sec","sleg\\.art|ssb\\.art","^ss_bot|ssps\\.gbr$","silk_bot|ssb"], "tl_name" : "silk_bot" }, {"orig_name" : ["^tm\\.art$|\\.st$|\\.tsm$|soldermask_top","mask.top\\.art|smt\\.art","mask.pri\\.art|smcs\\.gbr$","psm\\.art","sm_top|^smt"], "tl_name" : "sm_top" }, {"orig_name" : ["^bm\\.art$|\\.sb$|\\.bsm$|soldermask_bottom","mask.bot\\.art|smb\\.art","mask.sec\\.art|smps\\.gbr$","ssm\\.art","sm_bot|^smb"], "tl_name" : "sm_botm" }, {"orig_name" : ["^(?:(?!assy|enig|pm|past|ss|silk|sm|soldermask).)+_top\.art$","^top$","^top.art$"], "tl_name" : "top" }, {"orig_name" : ["^(?:(?!assy|enig|pm|past|ss|silk|sm|soldermask).)+_bottom\.art$","^bot\\.art$","^bottom$","^bottom\\.art$"], "tl_name" : "bottom" }, {"orig_name" : ["int(\\d+)\\.art"], "tl_name" : "l_($1+1)"}, {"orig_name" : ["lay-(\\d+)\\.art$","^(?:signal|plane|layer)_(\\d+)$","^l(\\d+)$","_l(\\d+)-.{3}\\.art$","lay(\\d+)\\.art$","l(\\d+).*\\.gbr$","^0?(\\d+)[\\D].*\\.art$","\\.p(\\d+)p?$","\\.l(\\d+)$","^l(\\d+).*\\.art$","^l(\\d+)\\.art$","^0(\\d+).*ccp_ms","^s(\\d+)\\.art","laye?r?(\\d+)","layer_(\\d+)"], "tl_name" : "l_($1)"}, {"orig_name" : ["(\\d+)-(\\d+)-((?:(?!laser)[a-zA-Z])+)\\.drl$","\\.d(\\d+)-(\\d+)((?:(?!laser)[a-zA-Z])+)$"], "tl_name" : "d($1)-($2)-($3)"}, {"orig_name" : ["_l?(\\d+)_l?(\\d+)$","\\.ncd(\\d)-(\\d)$","\\.d(\\d+)-(\\d+)$","-(\\d+)-(\\d+)\\.drl$","(\\d+)-(\\d+)-laser\\.drl$","d(\\d+)-(\\d+)"], "tl_name" : "d_($1)-($2)"}, {"orig_name" : ["^nth_layer$","^drill$","\\.ncdthru$"], "tl_name" : "drill" }, {"orig_name" : ["\\.rou$","^rout$"], "tl_name" : "rout" }, {"orig_name" : "fab.art", "tl_name" : "fab.art" }, {"orig_name" : ["multipack.art","^array$"], "tl_name" : "array" }, {"orig_name" : ["^ro\\.art$","^contour\\.gdo$","\\.R1$","outline"], "tl_name" : "outline" }, {"orig_name" : ["^pst\\.art$","top-enig","enig_top"], "tl_name" : "enig_top" }, {"orig_name" : ["^sst\\.art$","bot-enig","enig_bot"], "tl_name" : "enig_bot" }, {"orig_name" : ["_top_l(\\d+)"], "tl_name" : "d_1-($1)"}, {"orig_name" : ["_l(\\d+)_bottom"], "tl_name" : "d_($1)-($1+1)"} ], "mergerule" : { profile:["past_top","sm_top"], drill: [ {orig_rule:["contournonplated"],drill_type:"non_plated",shape:"slot"}, {orig_rule:["contourplated"],drill_type:"plated",shape:"slot"}, {orig_rule:["thruholenonplated"],drill_type:"non_plated",shape:"hole"}, {orig_rule:["thruholeplated"],drill_type:"plated",shape:"hole"}, ] }, "extra": [ { "verification": function(info){ if(!info.type){return false} return /gerber/ig.test(info.type) }, "fn": function(props){ var fileInfo = props.fileInfo; var step = props.step; fileInfo.forEach(function(item){ var layer = item.file.name.toLowerCase().split(" ").join("-") var path = item.file.path var filectx = fs.readFile(path) var tmp = filectx.match(/Holesize \d\. = [\d\.]+ Tolerance = [\S]+ [\S]+ [\S]+ Quantity = \d+\n/igm) if(tmp && tmp.length) { var units = "mm" var res = tmp.map(function(v,i) { var tmp2 = /Holesize \d\. = ([\d\.]+) Tolerance = ([\S]+) ([\S]+) ([\S]+) Quantity = \d+\n/igm.exec(v); if(/MILS/ig.test(tmp2[4])){ units = "inch" } return { size: tmp2[1], tolerance: tmp2[2], type: tmp2[3], unit: tmp2[4], row: i+1 } }) // [{"size":"0.100300","tolerance":"+0.020000/-0.020000","type":"PLATED","unit":"MM" MILS,"row":1}] GEN.units({type:units}) var toolsInfo = GEN.getTool({job:job, step:step, layer:layer, units:units}) GEN.COM("tools_show,layer="+layer) // {"1":{"count":"01156","num":"1","type":"plated","min_tol":"0","max_tol":"0","finish_size":"1","drill_size":"1","slot_len":"0","type2":"standard","shape":"hole","bit":0}} GEN.COM("tools_tab_reset") var alltype = { plated: "plate", non_plated: "nplate", laser: "via", via: "via" } Object.keys(toolsInfo).forEach(function(row, i){ var info = toolsInfo[row]; var numberrow = i; var k = units == "mm" ? 1000 : 1; var type = res[numberrow]? res[numberrow].type.toLowerCase() : info.type.toLowerCase(); var min_tol = res[numberrow]? Math.abs( res[numberrow].tolerance.split("/")[1] * k ): info.min_tol; var max_tol = res[numberrow]? Math.abs(res[numberrow].tolerance.split("/")[0] * k) : info.max_tol; var drill_size = res[numberrow]? res[numberrow].size * k : info.drill_size; GEN.COM("tools_tab_add,num="+row+",shape="+info.shape+",type="+alltype[type] +",min_tol="+min_tol+",max_tol="+max_tol+",bit=,finish_size="+drill_size+",drill_size="+drill_size); }) GEN.COM("tools_set,layer="+layer+",thickness=0,user_params=,slots=by_length") } }) GEN.saveJob({ job: job }); } } ] }, "Wistron":{ "step": "cad", "rules": [ { "valid": function(props){ var file = props.file; return /.+\.tgz$/ig.test(file.name) }, "type": "ODB", "format": "ODB" }, { "valid": function(props){ var file = props.file; return /.+\.btd$/ig.test(file.name) }, "type": "IPC356", "format": "IPC356_1" }, { "valid": function(props){ var file = props.file; return /.+\.ger$/ig.test(file.name) || /.+\.l\d+$|\.pho$|\.bol$|\.gdo$|\.pma$|\.pmb$|\.spa$|\.spb$\.sma$|\.smb$|\.ssa$|\.ssb$/ig.test(file.name) || /.+\.l\d+$/ig.test(file.name) }, "type": "Gerber274x", "format": "Gerber274x_3" }, { "valid": function(props){ var file = props.file; return /.+\.ncd$/ig.test(file.name) }, "type": "Excellon2", "format": "Excellon2_4" }, { "valid": function(props){ var file = props.file; return /.+\.d\d+$/ig.test(file.name) }, "type": "Excellon2", "format": "Excellon2_6" }, { "valid": function(props){ var file = props.file; return /.+\.art$/ig.test(file.name) }, "type": "Gerber274x", "format": "Gerber274x_3", "format_params": function(props){ var params = props.params if(params.art_param){ var leading = params.art_param["SUPPRESS_LEAD_ZEROES"] var trailing = params.art_param["SUPPRESS_TRAIL_ZEROES"] var zeroes = "none" if(/yes/ig.test(leading)){ zeroes = "leading" } if(/yes/ig.test(trailing)){ zeroes = "trailing" } var nf1,nf2 if(params.art_param.hasOwnProperty("FORMAT")){ var tmp = params.art_param["FORMAT"].split(".") if(/\d+/ig.test(tmp[0])){nf1 = Number(tmp[0])} if(/\d+/ig.test(tmp[1])){nf2 = Number(tmp[1])} } return { "nf1": nf1 || 3, "nf2": nf2 || 5, "units": /METRIC|MM/ig.test(params.art_param["OUTPUT_UNITS"])? "mm" :"inch", "zeroes": zeroes, "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "*", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": /METRIC|MM/ig.test(params.art_param["OUTPUT_UNITS"])? "mm" :"inch", "coordinates": "absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 } } } }, { "valid": function(props){ var file = props.file; return /.+\.drl$|\.rou$/ig.test(file.name) }, "type": "Excellon2", "format": "Excellon2_4", "format_params": function(props){ var params = props.params if (params.ncdrill && !params.nc_param){params.nc_param = params.ncdrill} if(params.nc_param){ var leading = params.nc_param["SUPPRESS_LEAD_ZEROES"] var trailing = params.nc_param["SUPPRESS_TRAIL_ZEROES"] var zeroes = "none" if(/yes/ig.test(leading)){ zeroes = "leading" } if(/yes/ig.test(trailing)){ zeroes = "trailing" } return { "nf1": params.nc_param["INTEGER_PLACES"]? Number(params.nc_param["INTEGER_PLACES"]) : 3, "nf2": params.nc_param["DECIMAL_PLACES"]? Number(params.nc_param["DECIMAL_PLACES"]) : 5, "units": /METRIC|MM/ig.test(params.nc_param["OUTPUT_UNITS"])? "mm" :"inch", "zeroes": zeroes, "decimal": "no", "nf_comp": 0, "break_sr": "yes", "data_type": "ascii", "separator": "nl", "threshold": 200, "drill_only": "no", "multiplier": 1, "resolution": 3, "tool_units": /METRIC|MM/ig.test(params.nc_param["OUTPUT_UNITS"])? "mm" :"inch", "coordinates": params.nc_param["COORDINATES"]? params.nc_param["COORDINATES"].toLowerCase() :"absolute", "merge_by_rule": "no", "signed_coords": "no", "text_line_width": 0.0024 } } } } ], "tl_name": [ {"orig_name" : ["^comp_+_top$"], "tl_name" : "comp_+_top" }, {"orig_name" : ["^comp_+_bot$"], "tl_name" : "comp_+_bot" }, {"orig_name" : ["^spt$|^pmt\\.art$","\\.pma$|\\.spa$","paste.?top|soldPasteTop|pastemask.?top","past_top"], "tl_name" : "past_top" }, {"orig_name" : ["^spb$|^pmb\\.art$","\\.pmb$|\\.spb$","paste.?bot|soldPasteBot|pastemask.?bot","past_botm"], "tl_name" : "past_botm" }, {"orig_name" : ["sst|tsilk|silktop","^sst\\.art$","\\.ssa$","silkscrntop|silkscreentop","silk.top|silk-top"], "tl_name" : "silk_top" }, {"orig_name" : ["ssb|bsilk|silkbot","^ssb\\.art$","\\.ssb$","silkscrnbot|silkscreenbot","silk.bot|silk-bot"], "tl_name" : "silk_bot" }, {"orig_name" : ["^soldtop","\\.tsm$|tmask|^smt$|^smtop","^smt\\.art$","\\.sma$","soldmask1top|soldermask.?top","sm.top|solder.top"], "tl_name" : "sm_top" }, {"orig_name" : ["^soldbot","\\.bsm$|bmask|^smb$|^smbot","^smb\\.art$","\\.smb$","soldmask1bot|soldermask.?bot","sm.bot|solder.bot"], "tl_name" : "sm_botm" }, {"orig_name" : ["^top\\.(pho|art)$","^(?:(?!assy|export|enig|pm|past|paste|silk|mask|sm|sold).)+top\\.(pho|art)$","^top$","^top\\.art$"], "tl_name" : "top" }, {"orig_name" : ["\\.p(\\d+)p$","^m(\\d+)$","_s(\\d+)\\.art$","^(?:(?!ref).)+l(\\d+)\\.art$","-(\\d+)l\\.pho$","^l(\\d+).*\\.art$","^v(\\d+)\\.art$","^g(\\d+)\\.art$","^s(\\d+)\\.art$","\\.l(\\d+)$","Copper(\\d+)\\.ger$","^laye?r?_?(\\d+)"], "tl_name" : "l_($1)"}, {"orig_name" : ["^bottom\\.(pho|art)$","^(?:(?!assy|view|enig|pm|past|paste|silk|mask|sm|sold).)+bot(tom)?\\.(pho|art)$","^bot\\.art$","^bottom$","^bottom.art$"], "tl_name" : "bottom" }, {"orig_name" : ["\\.d(\\d+)$"], "tl_name" : "d_($1)-($1+1)"}, {"orig_name" : ["\\.ncd(\\d+)-(\\d+)$","(\\d+)-(\\d+)plated\\.ncd","thruHolePlated_(\\d+)_(\\d+)\\.ncd","(\\d+)[-_](\\d+)\\.drl$","^drill(\\d+)-(\\d+)$","^d_(\\d+)-(\\d+)$"], "tl_name" : "d_($1)-($2)"}, {"orig_name" : ["\\.ncdthru$","(\\d+)-(\\d+)-np\\.drl$","ThruHoleNonPlated\\.ncd$","^drill$"], "tl_name" : "drill" }, {"orig_name" : ["\\.rou$","^rout$"], "tl_name" : "rout" }, {"orig_name" : "fab.art", "tl_name" : "fab.art" }, {"orig_name" : ["multipack\\.art","^array$"], "tl_name" : "array" }, {"orig_name" : ["p_outline\\.art","panel\\.(art|pho)$","panel-?outline\\.pho","outline\\.art$","\\.bol$","PnlContourNonPlated\\.ger","^outline"], "tl_name" : "outline" }, {"orig_name" : ["gold_t","topside-golden","top-enig","enig_top"], "tl_name" : "enig_top" }, {"orig_name" : ["gold_b","botside-golden","bot-enig","enig_bot"], "tl_name" : "enig_bot" }, ], "mergerule" : { profile:["silk_top","past_top"], laser : { tl_name: "drill($1)-($2)", regs: ["(\\d+)-(\\d+)\\.drl$"] } } }, "Vivo":{ "step": "cad", "rules": [ { "valid": function(props){ var file = props.file; return /.+\.tgz$/ig.test(file.name) }, "type": "ODB", "format": "ODB" }, { "valid": function(props){ var file = props.file; return /.+\.btd$|.+\.rou$/ig.test(file.name) }, "type": "IPC356A", "format": "IPC356A_1" }, { "valid": function(props){ var file = props.file; return /\.pho|\.gbr$|\.gdo$|\.pho$|^line$|^ftdrill/ig.test(file.name) }, "type": "Gerber274x", "format": "Gerber274x_4" }, { "valid": function(props){ var file = props.file; return /.+\.ncd$/ig.test(file.name) || /.+\.d\d+$/ig.test(file.name) }, "type": "Excellon2", "format": "Excellon2_5" }, { "valid": function(props){ var file = props.file; return /.+\.drl/ig.test(file.name) || /.+\.d\d+$/ig.test(file.name) }, "type": "Excellon2", "format": "Excellon2_7" } ], "tl_name": [ {"orig_name" : ["^comp_+_top$"], "tl_name" : "comp_+_top" }, {"orig_name" : ["^comp_+_bot$"], "tl_name" : "comp_+_bot" }, {"orig_name" : ["osp-top\\.pho","solderpastetop","past_top"], "tl_name" : "past_top" }, {"orig_name" : ["osp-bottom\\.pho","solderpastebottom","past_botm"], "tl_name" : "past_botm" }, {"orig_name" : ["pleg\\.art","^ss_top","silk_top"], "tl_name" : "silk_top" }, {"orig_name" : ["sleg\\.art","^ss_bot","silk_bot"], "tl_name" : "silk_bot" }, {"orig_name" : ["topsoldermask|soldermask1|soldermask-top","top-solder-mask\\.pho","soldermasktop","sm_top"], "tl_name" : "sm_top" }, {"orig_name" : ["bottomsoldermask|soldermask2|soldermask-bottom","bottom-solder-mask\\.pho","soldermaskbottom","sm_bot"], "tl_name" : "sm_botm" }, {"orig_name" : ["^m1\\.gbr$","top\\.pho","^top$","lay(?:er)?top"], "tl_name" : "top" }, {"orig_name" : ["^m(\\d+)\\.gbr$","^lay(\\d+)","layer(\\d+)\\.gdo","layer(?:_)?(\\d+)"], "tl_name" : "l_($1)"}, {"orig_name" : ["^mbot\\.gbr$","^bottom\\.pho$","^bottom$","lay(?:er)?bottom"], "tl_name" : "bottom" }, {"orig_name" : ["^dr(?:l)?(\\d+)-(\\d+)\\.drl","^drill(\\d+)-(\\d+)$","^d(\\d+)-(\\d+)$"], "tl_name" : "d_($1)-($2)"}, {"orig_name" : ["^drill$"], "tl_name" : "drill" }, {"orig_name" : ["\\.rou$","^rout$"], "tl_name" : "rout" }, {"orig_name" : ["fab\\.art|fab\\.gbr"], "tl_name" : "fab.art" }, {"orig_name" : ["pcb-set\\.gdo","^pcb-set\\.pho$","^pcb-set$","^array$"], "tl_name" : "array" }, {"orig_name" : ["^outline"], "tl_name" : "outline" }, {"orig_name" : ["au[_-]mask[_-]top","enig_top"], "tl_name" : "enig_top" }, {"orig_name" : ["au[_-]mask[_-]bot","enig_bot"], "tl_name" : "enig_bot" }, {"orig_name" : ["cavitytop","cavity_top"], "tl_name" : "cavity_top" }, {"orig_name" : ["cavitybottom","cavity_bot"], "tl_name" : "cavity_bot" }, ], "mergerule" : { drill_second: ["(\\d+)-(\\d+)\\.drl$"], drill: [ {orig_rule:["contournonplated"],drill_type:"non_plated",shape:"slot"}, {orig_rule:["contourplated"],drill_type:"plated",shape:"slot"}, {orig_rule:["thruholenonplated"],drill_type:"non_plated",shape:"hole"}, {orig_rule:["thruholeplated"],drill_type:"plated",shape:"hole"}, ], profile:["top","enig_bot","past_top"], laser : { tl_name: "drill($1)-($2)", regs: ["(\\d+)-(\\d+)plated\\.ncd$","(\\d+)-(\\d+)\\.drl$"] } } }, "1352":{ "step": "cad", "rules": [ { "valid": function(props){ var file = props.file; return /.+\.tgz$/ig.test(file.name) }, "type": "ODB", "format": "ODB" }, { "valid": function(props){ var file = props.file; return /.+\.ipc$/ig.test(file.name) }, "type": "IPC356", "format": "IPC356_1" }, { "valid": function(props){ var file = props.file; return /.+\.art$/ig.test(file.name) }, "type": "Gerber274x", "format": "Gerber274x_5" }, { "valid": function(props){ var file = props.file; return /.+\.drl$/ig.test(file.name) }, "type": "Excellon2", "format": "Excellon2_8" } ], "tl_name": [ {"orig_name" : ["^comp_+_top$"], "tl_name" : "comp_+_top" }, {"orig_name" : ["^comp_+_bot$"], "tl_name" : "comp_+_bot" }, {"orig_name" : ["pasttop\\.art","past_top"], "tl_name" : "past_top" }, {"orig_name" : ["pastbotm\\.art","past_bot"], "tl_name" : "past_botm" }, {"orig_name" : ["^silktop\\.art$","silk_top"], "tl_name" : "silk_top" }, {"orig_name" : ["^silkbotm\\.art$","silk_bot"], "tl_name" : "silk_bot" }, {"orig_name" : ["soldtop.art","sm_top|mask_top"], "tl_name" : "sm_top" }, {"orig_name" : ["soldbotm\\.art","sm_bot|mask_bot"], "tl_name" : "sm_botm" }, {"orig_name" : ["^top$","^top.art$"], "tl_name" : "top" }, {"orig_name" : ["^gnd(\\d+)\\.art$","^in(\\d+)\\.art$","^pgp(\\d+)\\.art$","^art(\\d+)\\.art$","^l_(\\d+)"], "tl_name" : "l_($1)"}, {"orig_name" : ["^bot\\.art$","^bottom$","^bottom.art$"], "tl_name" : "bottom" }, {"orig_name" : ["\\.d(\\d+)$"], "tl_name" : "d_($1)-($1+1)"}, {"orig_name" : ["(\\d+)-(\\d+)-((?:(?!laser)[a-zA-Z])+)\\.drl$","\\.d(\\d+)-(\\d+)((?:(?!laser)[a-zA-Z])+)$"], "tl_name" : "d($1)-($2)-($3)"}, {"orig_name" : ["^drill(\\d+)-(\\d+)$","^d_(\\d+)-(\\d+)$"], "tl_name" : "d_($1)-($2)"}, {"orig_name" : ["^drill$"], "tl_name" : "drill" }, {"orig_name" : ["\\.rou$","^rout$"], "tl_name" : "rout" }, {"orig_name" : "fab.art", "tl_name" : "fab.art" }, {"orig_name" : ["multipack.art","^array$"], "tl_name" : "array" }, {"orig_name" : ["\\.bol$","PnlContourNonPlated\\.ger","^outline"], "tl_name" : "outline" }, {"orig_name" : ["top-enig","enig_top"], "tl_name" : "enig_top" }, {"orig_name" : ["bot-enig","enig_bot"], "tl_name" : "enig_bot" }, ], "mergerule" : { drill:["(\\d+)-(\\d+)\\.drl$"], profile:["sm_top"], laser : { tl_name: "drill($1)-($2)", regs: ["(\\d+)-(\\d+)\\.drl$"] } }, "extra": [ { "verification": function(info){ if(!info.type){return false} return /gerber/ig.test(info.type) }, "fn": function(props){ var fileInfo = props.fileInfo; var step = props.step; fileInfo.forEach(function(item){ var layer = item.file.name.toLowerCase().split(" ").join("-") var path = item.file.path var filectx = fs.readFile(path) var tmp = filectx.match(/Holesize \d\. = [\d\.]+ Tolerance = [\S]+ [\S]+ [\S]+ Quantity = \d+\n/igm) if(tmp && tmp.length) { var units = "mm" var res = tmp.map(function(v,i) { var tmp2 = /Holesize \d\. = ([\d\.]+) Tolerance = ([\S]+) ([\S]+) ([\S]+) Quantity = \d+\n/igm.exec(v); if(/MILS/ig.test(tmp2[4])){ units = "inch" } return { size: tmp2[1], tolerance: tmp2[2], type: tmp2[3], unit: tmp2[4], row: i+1 } }) // [{"size":"0.100300","tolerance":"+0.020000/-0.020000","type":"PLATED","unit":"MM" MILS,"row":1}] GEN.units({type:units}) var toolsInfo = GEN.getTool({job:job, step:step, layer:layer, units:units}) GEN.COM("tools_show,layer="+layer) // {"1":{"count":"01156","num":"1","type":"plated","min_tol":"0","max_tol":"0","finish_size":"1","drill_size":"1","slot_len":"0","type2":"standard","shape":"hole","bit":0}} GEN.COM("tools_tab_reset") var alltype = { plated: "plate", non_plated: "nplate", laser: "via", via: "via" } Object.keys(toolsInfo).forEach(function(row, i){ var info = toolsInfo[row]; var numberrow = i; var k = units == "mm" ? 1000 : 1; var type = res[numberrow]? res[numberrow].type.toLowerCase() : info.type.toLowerCase(); var min_tol = res[numberrow]? Math.abs( res[numberrow].tolerance.split("/")[1] * k ): info.min_tol; var max_tol = res[numberrow]? Math.abs(res[numberrow].tolerance.split("/")[0] * k) : info.max_tol; var drill_size = res[numberrow]? res[numberrow].size * k : info.drill_size; GEN.COM("tools_tab_add,num="+row+",shape="+info.shape+",type="+alltype[type] +",min_tol="+min_tol+",max_tol="+max_tol+",bit=,finish_size="+drill_size+",drill_size="+drill_size); }) GEN.COM("tools_set,layer="+layer+",thickness=0,user_params=,slots=by_length") } }); // 特殊名称 var _matrix = GEN.getMatrix({job:job}) var _layers = Object.keys(_matrix) var specialLayers = _layers.filter(function(v){return /^gnd.*\.art$|^in.?\.art$|^vcc\.art$/.test(v)}) if(specialLayers.length && specialLayers.indexOf("vcc.art") >= 0){ var _tmpdata = specialLayers.map(function(v) { if(v == "gnd.art"){return {ori:v, newname:"gnd0.art"}} if(/in/.test(v)){ return {ori:v, newname:"gnd" + (/in(\d+)\.art/.exec(v)[1]-0.5) + ".art"} } if(/vcc/.test(v)){ return {ori:v, newname:"gnd" + specialLayers.length + ".art"} } return {ori:v, newname:v} }) _tmpdata.sort(function(a,b){return (/^gnd(.+)\.art$/.exec(a.newname)[1]) - (/gnd(.+)\.art/.exec(b.newname)[1])}) _tmpdata.forEach(function(item,v){ console.log(_.toString({job:job,layer:item.ori,new_name:'gnd' + (v+2) + ".art"})); GEN.renameLayer({job:job,layer:item.ori,new_name:'pgp' + (v+2) + ".art"}) }) } } } ] } }, "data_format": [ {"tl_name":"comp_\\+_top" , "new_name":"comp_+_top" , "attr":{}}, {"tl_name":"enig_top" , "new_name":"enig_top" , "attr":{ "context":"board", "type":"document" }}, {"tl_name":"past_top" , "new_name":"past_top" , "attr":{ "context":"board", "type":"solder_paste" }}, {"tl_name":"silk_top" , "new_name":"silk_top" , "attr":{ "context":"board", "type":"silk_screen" }}, {"tl_name":"sm_top" , "new_name":"sm_top" , "attr":{ "context":"board", "type":"solder_mask" }}, {"tl_name":"^top$" , "new_name":"top" , "attr":{ "context":"board", "type":"signal" }}, {"tl_name":"l_(\\d+)","new_name":"l($1)" ,"attr":{"context":"board","type":"signal"}}, {"tl_name":"^bottom$","new_name":"bottom" ,"attr":{"context":"board","type":"signal"}}, {"tl_name":"sm_botm" , "new_name":"sm_botm" , "attr":{ "context":"board", "type":"solder_mask" }}, {"tl_name":"silk_bot" , "new_name":"silk_bot" , "attr":{ "context":"board", "type":"silk_screen" }}, {"tl_name":"past_botm" , "new_name":"past_botm" , "attr":{ "context":"board", "type":"solder_paste" }}, {"tl_name":"enig_bot" , "new_name":"enig_bot" , "attr":{ "context":"board", "type":"document" }}, {"tl_name":"comp_\\+_bot" , "new_name":"comp_+_bot" , "attr":{}}, {"tl_name":"d_(\\d+)-(\\d+)","new_name":"ftdrill($1)-($2)l" ,"attr":{"context":"board","type":"drill"}}, {"tl_name":"d(\\d+)-(\\d+)-(.*)","new_name":"ftdrill($1)-($2)-($3)" ,"attr":{"context":"board","type":"drill"}}, {"tl_name":"drill","new_name":"ftdrill" ,"attr":{"context":"board","type":"drill"}}, {"tl_name":"rout","new_name":"rout" ,"attr":{"context":"board","type":"rout"}}, {"tl_name":"outline","new_name":"outline" ,"attr":{"context":"board","type":"rout"}}, {"tl_name":"array","new_name":"array" ,"attr":{"context":"misc"}}, {"tl_name":"cavity_top","new_name":"cavity_top" ,"attr":{"context":"misc"}}, {"tl_name":"cavity_bot","new_name":"cavity_bot" ,"attr":{"context":"misc"}}, {"tl_name":"fab.art","new_name":"fab.art" ,"attr":{"context":"misc"}} ], "delSameJob": "yes" }})()