Commit f7696dfa authored by Scott Sun's avatar Scott Sun

scott

parent 85938b68
......@@ -2865,123 +2865,125 @@ function saveMeans(props){
if (chklist) {chks = [chklist]}else {
chks = GEN.getChecklist({job: job,step: step})
}
chks = chks.filter(function(v){return /quotation/.test(v)});
if(chks && chks.length){
chks.forEach(function (item, i) {
var afterChkPath = mkPath(chkPath, [item])
var hdr = "{\n\
\"title\": \"" + item + "\",\n\
\"sequence\": " + (i + 1) + "\n\
}"
fs.writeFile(afterChkPath + "/hdr", _.toString(hdr))
var nacts = []
if (nact) {
nacts = [nact]
} else {
var nactCount = GEN.getChklistActCount({job:job,step:step,chklist:item}) || 0;
if(/quotation/.test(item)){
nactCount = 5;
}
for (var i = 0; i < nactCount; i++) {
nacts.push(i+1)
}
}
if(nacts.length > 0){
var actionPath = mkPath(afterChkPath, ["actions"])
nacts.forEach(function(index){
var titleFile = GEN.INFO({
entity_type: "check",
entity_path: job + "/" + step + "/" + item,
data_type: "TITLE",
options: "action=" + index,
parse:'no'
})
var title = fs.readFile(titleFile) || item
if(title && title != ""){
if(/=/.test(title)){
title = title.split("=")[1].trim()
title = title.substring(1, title.length-1)
}
var nackPath = mkPath(actionPath, [index+"-"+title])
fs.writeFile(nackPath + "/hdr", "{\n\
\"title\": \"" + (index + "-" + title) + "\",\n\
\"sequence\": " + index + ",\n\
\"dfm_name\": \"" + title + "\"\n\
}");
var displayFile = GEN.INFO({
entity_type: 'check',
if(chks && chks.length){
chks = chks.filter(function(v){return /quotation/.test(v)});
if(chks && chks.length){
chks.forEach(function (item, i) {
var afterChkPath = mkPath(chkPath, [item])
var hdr = "{\n\
\"title\": \"" + item + "\",\n\
\"sequence\": " + (i + 1) + "\n\
}"
fs.writeFile(afterChkPath + "/hdr", _.toString(hdr))
var nacts = []
if (nact) {
nacts = [nact]
} else {
var nactCount = GEN.getChklistActCount({job:job,step:step,chklist:item}) || 0;
if(/quotation/.test(item)){
nactCount = 5;
}
for (var i = 0; i < nactCount; i++) {
nacts.push(i+1)
}
}
if(nacts.length > 0){
var actionPath = mkPath(afterChkPath, ["actions"])
nacts.forEach(function(index){
var titleFile = GEN.INFO({
entity_type: "check",
entity_path: job + "/" + step + "/" + item,
data_type: 'MEAS_DISP_ID',
data_type: "TITLE",
options: "action=" + index,
parse:'no'
});
fs.writeFile(nackPath + "/disp", fs.readFile(displayFile))
var measFile = GEN.INFO({entity_type:'check', entity_path:job+'/'+step+'/'+item, data_type:'MEAS', options:"index+action="+index, parse:'no'});
var means;
if(filter){ // 处理过滤
var fileArray = []
var file = fs.openFile(measFile,'r');
while(!file.atEnd()) {
fileArray.push(file.readLine())
})
var title = fs.readFile(titleFile) || item
if(title && title != ""){
if(/=/.test(title)){
title = title.split("=")[1].trim()
title = title.substring(1, title.length-1)
}
if(Array.isArray(filter)){
var nowFilter = filter.filter(function(item2){
for (var key in item2) {
var value = item2[key]
if (!Array.isArray(value)){
item2[key] = [value]
}
}
return item2.step.indexOf(step)>=0 && item2.chk.indexOf(item)>=0 && item2.nact.indexOf(index)>=0
})
if (nowFilter.length > 0){
var nowfilter = nowFilter.map(function(v){return v.filter}).reduce(function(a,b){
b.forEach(function(v2){
if (a.indexOf(v2)<0){
a.push(v2)
}
})
return a
},[])
fileArray = fileArray.filter(function(line){
var flag = false
nowfilter.forEach(function(f){
var reg = new RegExp(f, "ig")
if (reg.test(line)){
flag = true
}
})
return flag
})
var nackPath = mkPath(actionPath, [index+"-"+title])
fs.writeFile(nackPath + "/hdr", "{\n\
\"title\": \"" + (index + "-" + title) + "\",\n\
\"sequence\": " + index + ",\n\
\"dfm_name\": \"" + title + "\"\n\
}");
var displayFile = GEN.INFO({
entity_type: 'check',
entity_path: job + "/" + step + "/" + item,
data_type: 'MEAS_DISP_ID',
options: "action=" + index,
parse:'no'
});
fs.writeFile(nackPath + "/disp", fs.readFile(displayFile))
var measFile = GEN.INFO({entity_type:'check', entity_path:job+'/'+step+'/'+item, data_type:'MEAS', options:"index+action="+index, parse:'no'});
var means;
if(filter){ // 处理过滤
var fileArray = []
var file = fs.openFile(measFile,'r');
while(!file.atEnd()) {
fileArray.push(file.readLine())
}
} else if (typeof filter == "object") {
if (filter[step] && filter[step][item] && filter[step][item][String(index)]) {
var nowFilter = filter[step][item][String(index)]
if (!Array.isArray(nowFilter)){nowFilter = [nowFilter]}
fileArray = fileArray.filter(function(line){
var flag = false
nowFilter.forEach(function(f){
var reg = new RegExp(f, "ig")
if (reg.test(line)){
flag = true
if(Array.isArray(filter)){
var nowFilter = filter.filter(function(item2){
for (var key in item2) {
var value = item2[key]
if (!Array.isArray(value)){
item2[key] = [value]
}
})
return flag
}
return item2.step.indexOf(step)>=0 && item2.chk.indexOf(item)>=0 && item2.nact.indexOf(index)>=0
})
if (nowFilter.length > 0){
var nowfilter = nowFilter.map(function(v){return v.filter}).reduce(function(a,b){
b.forEach(function(v2){
if (a.indexOf(v2)<0){
a.push(v2)
}
})
return a
},[])
fileArray = fileArray.filter(function(line){
var flag = false
nowfilter.forEach(function(f){
var reg = new RegExp(f, "ig")
if (reg.test(line)){
flag = true
}
})
return flag
})
}
} else if (typeof filter == "object") {
if (filter[step] && filter[step][item] && filter[step][item][String(index)]) {
var nowFilter = filter[step][item][String(index)]
if (!Array.isArray(nowFilter)){nowFilter = [nowFilter]}
fileArray = fileArray.filter(function(line){
var flag = false
nowFilter.forEach(function(f){
var reg = new RegExp(f, "ig")
if (reg.test(line)){
flag = true
}
})
return flag
})
}
}
means = fileArray.join("\n")
} else {
means = fs.readFile(measFile)
}
means = fileArray.join("\n")
} else {
means = fs.readFile(measFile)
fs.writeFile(nackPath + "/meas", means)
}
fs.writeFile(nackPath + "/meas", means)
}
})
}
})
}
})
}
})
}
}
})
}
// 算弧长
......
......@@ -439,9 +439,10 @@ try {
GEN.workLayer({name:"outline",display_number:2,clear_before:'yes'})
GEN.selAllFeat()
if(GEN.getSelectCount() > 0) {
// GEN.COM("sel_create_profile,create_profile_with_holes=no")
// cutting data
createOutline({job:job, step:tmp_step, profileRule:["^outline$"]})
GEN.COM("sel_create_profile,create_profile_with_holes=no");
if(!hasProfle({job:job, step:tmp_step})){
createOutline({job:job, step:tmp_step, profileRule:["^outline$"]})
}
}
else { createOutline({job:job, step:tmp_step, profileRule:profileRule}) }
} else if (contours.length) {
......@@ -458,9 +459,7 @@ try {
GEN.selAllFeat()
if(GEN.getSelectCount() > 0) { GEN.COM("sel_create_profile,create_profile_with_holes=no") }
} else if(all_layer.indexOf("array") >= 0) {
GEN.workLayer({name:"array",display_number:2,clear_before:'yes'})
GEN.selAllFeat()
if(GEN.getSelectCount() > 0) { GEN.COM("sel_create_profile,create_profile_with_holes=no") }
createOutline({job:job, step:tmp_step, profileRule:["^array$"]})
}else if(all_layer.indexOf("top") >= 0) {
GEN.selClearFeature()
GEN.workLayer({name:"top",display_number:2,clear_before:'yes'})
......@@ -505,7 +504,7 @@ try {
GEN.COM("sel_create_profile,create_profile_with_holes=no")
}
}
}
}
if(!hasProfle({job:job, step:tmp_step})){
createOutline({job:job, step:tmp_step, profileRule:profileRule})
}
......@@ -1027,8 +1026,7 @@ function createOutline(props){
return a
}, ["outline"])
}
var tmp_outline
var tmp_outline;
if(outlines.length){
if( outlines.length){
for(var i =0;i<outlines.length;i++){
......
......@@ -230,7 +230,6 @@ try {
var importOk = false; // 是否成功导入
script_info({ progress: 10 })
if(/odb/ig.test(jobInfo.type)){ // odb导入
script_info({ msg: "Import odb++", result_severity:"error" });
global._ERRORMAG = "Fail to import odb++";
......@@ -683,7 +682,7 @@ function changePath2(filePath){
for(var i = tmp.length-1;i>=0;i--){
var newFileName = tmp[i].fileName.replace(/\s*/g,'');//去除文件名中空格
newFileName = newFileName.replace(/\?/g,'');//去除文件名中?
var newPath = tmp[i].path.replace(/^(.*)\/[^\/]*$/,"$1");
var newPath = tmp[i].path.replace(/^(.*)\/[^\/]*$/,"$1");
var file = fs.rename(tmp[i].path,newPath+'/'+newFileName);
list.push(file);
}
......
......@@ -829,18 +829,18 @@
"tl_name": [
{"orig_name" : ["^comp_+_top$"], "tl_name" : "comp_+_top" },
{"orig_name" : ["^comp_+_bot$"], "tl_name" : "comp_+_bot" },
{"orig_name" : ["^pmt\\.art$","\\.pma$|\\.spa$","paste.?top|soldPasteTop|pastemask.?top","past_top"], "tl_name" : "past_top" },
{"orig_name" : ["^pmb\\.art$","\\.pmb$|\\.spb$","paste.?bot|soldPasteBot|pastemask.?bot","past_botm"], "tl_name" : "past_botm" },
{"orig_name" : ["tsilk|silktop","^sst\\.art$","\\.ssa$","silkscrntop|silkscreentop","silk.top|silk-top"], "tl_name" : "silk_top" },
{"orig_name" : ["bsilk|silkbot","^ssb\\.art$","\\.ssb$","silkscrnbot|silkscreenbot","silk.bot|silk-bot"], "tl_name" : "silk_bot" },
{"orig_name" : ["tmask","^smt\\.art$","\\.sma$","soldmask1top|soldermask.?top","sm.top|solder.top"], "tl_name" : "sm_top" },
{"orig_name" : ["bmask","^smb\\.art$","\\.smb$","soldmask1bot|soldermask.?bot","sm.bot|solder.bot"], "tl_name" : "sm_botm" },
{"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" : ["\\.tsm$|tmask|^smt$","^smt\\.art$","\\.sma$","soldmask1top|soldermask.?top","sm.top|solder.top"], "tl_name" : "sm_top" },
{"orig_name" : ["\\.bsm$|bmask|^smb$","^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).)+top\\.(pho|art)$","^top$","^top\\.art$"], "tl_name" : "top" },
{"orig_name" : ["_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" : ["\\.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).)+bot(tom)?\\.(pho|art)$","^bot\\.art$","^bottom$","^bottom.art$"], "tl_name" : "bottom" },
{"orig_name" : ["\\.d(\\d+)$"], "tl_name" : "d_($1)-($1+1)"},
{"orig_name" : ["(\\d+)-(\\d+)plated\\.ncd","thruHolePlated_(\\d+)_(\\d+)\\.ncd","(\\d+)-(\\d+)\\.drl$","^drill(\\d+)-(\\d+)$","^d_(\\d+)-(\\d+)$"], "tl_name" : "d_($1)-($2)"},
{"orig_name" : ["(\\d+)-(\\d+)-np\\.drl$","ThruHoleNonPlated\\.ncd$","^drill$"], "tl_name" : "drill" },
{"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" },
......@@ -878,7 +878,7 @@
{
"valid": function(props){
var file = props.file;
return /\.gbr$|\.gdo$|\.pho$|^line$|^ftdrill/ig.test(file.name)
return /\.pho|\.gbr$|\.gdo$|\.pho$|^line$|^ftdrill/ig.test(file.name)
},
"type": "Gerber274x",
"format": "Gerber274x_4"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment