Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
Scott
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Scott Sun
Scott
Commits
171681b2
Commit
171681b2
authored
Sep 22, 2020
by
Scott Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scott
parent
2a1e0011
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1606 additions
and
338 deletions
+1606
-338
20200922_yucca.md
ats/topcam/20200922_yucca.md
+1
-0
ATS_AIM_customer_data_analysis.js
ats/topcam/ATS_AIM_customer_data_analysis.js
+8
-2
ATS_AIM_layer_rename_and_sort.js
ats/topcam/ATS_AIM_layer_rename_and_sort.js
+29
-21
config_ats.js
ats/topcam/config_ats.js
+1095
-0
scotttest.js
public_script/scotttest.js
+53
-169
silkScreenOptimize.js
public_script/silkScreenOptimize.js
+226
-146
tmp3.js
public_script/tmp3.js
+194
-0
No files found.
ats/topcam/20200922_yucca.md
0 → 100644
View file @
171681b2
104: d xx - xx -np
\ No newline at end of file
ats/topcam/ATS_AIM_customer_data_analysis.js
View file @
171681b2
...
...
@@ -135,8 +135,7 @@ var resultData = [];
var
ALL
=
{}
var
Omatrix
=
{};
try
{
script_info
({
result_severity
:
"analysis start"
})
script_info
({
progress
:
65
})
console
.
log
(
"=============================================>anaysis_start"
);
var
par
=
PAR
;
var
vc_src_01005_pad_result
=
par
.
vc_src_01005_pad_result
...
...
@@ -151,6 +150,8 @@ try {
// 检查料号是否能够check out
if
(
GEN
.
checkInout
({
job
:
job
,
mode
:
"test"
})
!=
0
){
throw
"the job check"
}
GEN
.
checkInout
({
job
:
job
,
mode
:
"out"
});
script_info
({
result_severity
:
"analysis start"
})
script_info
({
progress
:
65
})
var
pcs_step
=
par
.
pcs_step
==
""
?
"cad"
:
par
.
pcs_step
;
var
array_step
=
par
.
array_step
==
""
?
"stp"
:
par
.
array_step
;
var
step_list
=
GEN
.
getStepList
({
job
:
job
})
...
...
@@ -174,6 +175,7 @@ try {
if
(
GEN
.
getSelectCount
()
>
0
){
// unSelect()
// if(GEN.getSelectCount() > 0){
// GEN.COM("cur_atr_reset")
// GEN.COM("cur_atr_set,attribute=.drill,option=via")
// GEN.COM("sel_change_atr,mode=add")
// }
...
...
@@ -195,6 +197,7 @@ try {
if
(
GEN
.
getSelectCount
()
>
0
){
// unSelect()
// if(GEN.getSelectCount() > 0){
// GEN.COM("cur_atr_reset")
// GEN.COM("cur_atr_set,attribute=.drill,option=plated")
// GEN.COM("sel_change_atr,mode=add")
// }
...
...
@@ -203,6 +206,7 @@ try {
if
(
GEN
.
getSelectCount
()
>
0
){
// unSelect()
// if(GEN.getSelectCount() > 0){
// GEN.COM("cur_atr_reset")
// GEN.COM("cur_atr_set,attribute=.drill,option=non_plated")
// GEN.COM("sel_change_atr,mode=add")
// }
...
...
@@ -2105,6 +2109,7 @@ function min_symbols_anal(props){ // 分析最 symbols
GEN
.
workLayer
({
name
:
solderL_tmp
,
display_number
:
2
,
clear_before
:
"yes"
})
GEN
.
selContourize
()
GEN
.
COM
(
"sel_cont2pad,match_tol=0,restriction=,min_size=5,max_size=100,suffix=+++"
)
GEN
.
COM
(
"cur_atr_reset"
)
GEN
.
COM
(
"cur_atr_set,attribute=.smd"
)
GEN
.
COM
(
"sel_change_atr,mode=add"
)
var
ck
=
"tmp_chk"
...
...
@@ -2251,6 +2256,7 @@ function all_bga_min_pitch_anal(props){ // 分析所有bga中间距最小的
GEN
.
workLayer
({
name
:
solder_layer_tmp
,
display_number
:
2
,
clear_before
:
"yes"
})
GEN
.
selContourize
()
GEN
.
COM
(
"sel_cont2pad,match_tol=0,restriction=,min_size=5,max_size=100,suffix=+++"
)
GEN
.
COM
(
"cur_atr_reset"
)
GEN
.
COM
(
"cur_atr_set,attribute=.smd"
)
GEN
.
COM
(
"sel_change_atr,mode=add"
)
var
ck
=
"tmp_chk"
...
...
ats/topcam/ATS_AIM_layer_rename_and_sort.js
View file @
171681b2
...
...
@@ -221,9 +221,7 @@ try {
if
(
ret
.
err
){
throw
err
}
var
after_sort_matrix
=
ret
.
sortNames
// 设置钻孔
err
=
setDrill
({
job
:
job
,
matrix
:
after_sort_matrix
})
if
(
err
){
throw
err
}
// 改名
script_info
({
result_severity
:
"format rename"
})
...
...
@@ -231,6 +229,11 @@ try {
err
=
reName
({
job
:
job
,
matrix
:
after_sort_matrix
,
cfg
:
format_cfg
})
if
(
err
){
throw
err
}
// 设置钻孔
err
=
setDrill
({
job
:
job
})
if
(
err
){
throw
err
}
var
tmp_matrix
=
GEN
.
getMatrix
({
job
:
job
})
// 钻孔名称再次更改
...
...
@@ -250,6 +253,7 @@ try {
if
(
ftdrill_layer
[
ftdrill_layer
.
length
-
1
]
!=
v
){
GEN
.
matrixMoveRow
({
job
:
job
,
layer
:
"ftdrill"
,
after
:
ftdrill_layer
[
ftdrill_layer
.
length
-
1
]
})
}
hasMainDrill
=
!
hasMainDrill
}
else
if
(
chabie
>
1
&&
chabie
<
layer_count
-
1
){
// 改名
GEN
.
renameLayer
({
job
:
job
,
layer
:
v
,
new_name
:
v
.
substr
(
0
,
v
.
length
-
1
)})
...
...
@@ -272,6 +276,7 @@ try {
createOutline
({
job
:
job
,
step
:
tmp_step
,
matrix
:
tmp_matrix
,
profileRule
:
profileRule
})
var
hasProfile
=
GEN
.
getProfile
({
job
:
job
,
step
:
tmp_step
})
if
(
hasProfile
.
match
(
/
\n
/ig
).
length
==
1
){
script_info
({
result_severity
:
"创建profile失败"
})
throw
"创建profile失败"
}
}
else
{
...
...
@@ -452,15 +457,15 @@ function sortLayer(props){ // 排序方法 {job:要排序的料号, rule: {要
function setDrill(props){ // 设置钻孔
var job = props.job
var matrix =
props.matrix
var matrix =
_.values(GEN.getMatrix({job:job}))
// 获取所有的钻孔层
var drillLayer =matrix.filter(function(v){
return (v.
attr.type == "
drill
" || v.attr.type == "
rout
") && v.attr
.context == "
board
"
return (v.
layer_type == "
drill
" || v.layer_type == "
rout
") && v
.context == "
board
"
})
// 获取所有single层
var signalLayer =matrix.filter(function(v){
return v.
attr.type == "
signal
" && v.attr
.context == "
board
"
return v.
layer_type == "
signal
" && v
.context == "
board
"
})
console.log("
=================>
setdrill
:
drillLayer
:
" + _.toString(drillLayer));
console.log("
=================>
setdrill
:
signalLayer
:
" + _.toString(signalLayer));
...
...
@@ -473,10 +478,10 @@ function setDrill(props){ // 设置钻孔
}
function doDrill(drills){ // 分析钻孔层
return drills.map(function(v){
if(v.
tl_name == "
drill
" || v.tl_name=="
rout
" || v.tl_
name=="
outline
"){
if(v.
name == "
drill
" || v.name=="
rout
" || v.
name=="
outline
"){
return {start:findSignal(1), end:findSignal(layerCount), layer:v.name}
} else {
var tmp = /(
\
d+)-(
\
d+)/ig.exec(v.
tl_
name);
var tmp = /(
\
d+)-(
\
d+)/ig.exec(v.name);
if(tmp){
var start = findSignal(tmp[1]);
var end = findSignal(tmp[2]);
...
...
@@ -504,12 +509,14 @@ function reName(props) { // 改名 par{job:要改名的料号, rule: {要改名
var new_name;
var tl_name = item.tl_name
var rule = item.rule
if(rule === tl_name){
new_name = item.new_name
} else {
var reg = new RegExp(rule,"
ig
")
var tmp = reg.exec(tl_name)
if(!tmp){return undefined}
// ["
1
","
10
","
np
"]
var replaceArr = tmp.slice(1)
new_name = item.new_name
var params = {}
...
...
@@ -517,20 +524,21 @@ function reName(props) { // 改名 par{job:要改名的料号, rule: {要改名
params["
$
"+(i+1)] = replaceArr[i]
}
replaceArr.forEach(function(v,i){
tl_name = tl_name.replace("
(
$
"+(i+1)+"
)
",v)
})
new_name = replaceTlName(new_name)
function replaceTlName(name){
var tmp = /(
\
([^)]*
\
))/ig.exec(name)
if(!tmp){ return name }
var param_arr = tmp[1].match(/
\
$
\
d+/ig)
var newname = tmp[1]
param_arr.forEach(function(v){
newname = newname.replace(new RegExp("
\\
"+v,"
ig
"), params[v])
new_name = new_name.replace("
(
$
"+(i+1)+"
)
",v)
})
newname = name.replace(tmp[1],eval(newname))
return replaceTlName(newname)
}
// new_name = replaceTlName(new_name)
// function replaceTlName(name){
// var tmp = /(
\
([^)]*
\
))/ig.exec(name)
// if(!tmp){ return name }
// var param_arr = tmp[1].match(/
\
$
\
d+/ig)
// var newname = tmp[1]
// param_arr.forEach(function(v){
// newname = newname.replace(new RegExp("
\\
"+v,"
ig
"), params[v])
// })
// newname = name.replace(tmp[1],eval(newname))
// return replaceTlName(newname)
// }
}
return {
orig_name: item.name,
...
...
ats/topcam/config_ats.js
0 → 100644
View file @
171681b2
(
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"
:
3
,
"units"
:
"mm"
,
"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"
:
"mm"
,
"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"
:
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_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
},
"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$/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"
:
[
"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_paste"
,
"^spt$"
,
"^past_top$"
],
"tl_name"
:
"past_top"
},
{
"orig_name"
:
[
"bottom_paste"
,
"^spb$"
,
"^past_botm$"
],
"tl_name"
:
"past_botm"
},
{
"orig_name"
:
[
"top_silk"
,
"^sst$"
,
"^silk_top$"
],
"tl_name"
:
"silk_top"
},
{
"orig_name"
:
[
"bottom_silk"
,
"^ssb$"
,
"^silk_bot$"
],
"tl_name"
:
"silk_bot"
},
{
"orig_name"
:
[
"top_solder"
,
"^smt$"
,
"^sm_top$"
],
"tl_name"
:
"sm_top"
},
{
"orig_name"
:
[
"bottom_solder"
,
"^smb$"
,
"^sm_botm$"
],
"tl_name"
:
"sm_botm"
},
{
"orig_name"
:
"^top$"
,
"tl_name"
:
"top"
},
{
"orig_name"
:
"^drill$"
,
"tl_name"
:
"drill"
},
{
"orig_name"
:
[
"^board_outline$"
,
"outline.art"
,
"^outline$"
],
"tl_name"
:
"outline"
},
{
"orig_name"
:
[
"^rout$"
,
"
\\
.rou$"
],
"tl_name"
:
"rout"
},
{
"orig_name"
:
"^bottom$"
,
"tl_name"
:
"bottom"
},
{
"orig_name"
:
[
"^l(
\\
d+)"
,
"^isl(
\\
d+)$"
,
"^layer_(
\\
d+)$"
],
"tl_name"
:
"l_($1)"
},
{
"orig_name"
:
[
"_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
/.+
\.
art$|
\.
l
\d
+$|
\.
r1$|
\.
sb$|
\.
st$/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$|
\.
d
(\d
+
)
-
(\d
+
)
/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
}
}
}
}
],
"tl_name"
:
[
{
"orig_name"
:
[
"^pm_top"
,
"paste.pri"
,
"assytop
\\
.art"
,
"past_top"
,
"paste_top"
],
"tl_name"
:
"past_top"
},
{
"orig_name"
:
[
"^pm_bot"
,
"paste.sec"
,
"assybot
\\
.art"
,
"past_bot"
,
"paste_bot"
],
"tl_name"
:
"past_botm"
},
{
"orig_name"
:
[
"silk.pri"
,
"pleg
\\
.art"
,
"^ss_top"
,
"silk_top"
],
"tl_name"
:
"silk_top"
},
{
"orig_name"
:
[
"silk.sec"
,
"sleg
\\
.art"
,
"^ss_bot"
,
"silk_bot"
],
"tl_name"
:
"silk_bot"
},
{
"orig_name"
:
[
"
\\
.st$"
,
"mask.top
\\
.art"
,
"mask.pri
\\
.art"
,
"psm
\\
.art"
,
"sm_top"
],
"tl_name"
:
"sm_top"
},
{
"orig_name"
:
[
"
\\
.sb$"
,
"mask.bot
\\
.art"
,
"mask.sec
\\
.art"
,
"ssm
\\
.art"
,
"sm_bot"
],
"tl_name"
:
"sm_botm"
},
{
"orig_name"
:
[
"^top$"
,
"^top.art$"
],
"tl_name"
:
"top"
},
{
"orig_name"
:
[
"
\\
.l(
\\
d+)$"
,
"^l(
\\
d+).*
\\
.art$"
,
"^0?(
\\
d+)_.*
\\
.art$"
,
"^l(
\\
d+)
\\
.art$"
,
"^0(
\\
d+).*ccp_ms"
,
"^s(
\\
d+)
\\
.art"
,
"lay(
\\
d+)
\\
.art"
,
"layer_(
\\
d+)"
],
"tl_name"
:
"l_($1)"
},
{
"orig_name"
:
[
"^bottom$"
,
"^bottom
\\
.art$"
],
"tl_name"
:
"bottom"
},
{
"orig_name"
:
[
"
\\
.d(
\\
d+)-(
\\
d+)([A-Za-z]+)$"
],
"tl_name"
:
"d($1)-($2)-($3)"
},
{
"orig_name"
:
[
"
\\
.d(
\\
d+)-(
\\
d+)$"
,
"-(
\\
d+)-(
\\
d+)
\\
.drl$"
,
"(
\\
d+)-(
\\
d+)-laser
\\
.drl$"
,
"d(
\\
d+)-(
\\
d+)"
],
"tl_name"
:
"d_($1)-($2)"
},
{
"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"
:
[
"
\\
.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"
}
],
"mergerule"
:
{
profile
:[
"past_top"
]
},
"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
res
=
tmp
.
map
(
function
(
v
,
i
)
{
var
tmp2
=
/Holesize
\d\.
=
([\d\.]
+
)
Tolerance =
([\S]
+
)
([\S]
+
)
([\S]
+
)
Quantity =
\d
+
\n
/igm
.
exec
(
v
);
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","row":1}]
GEN
.
units
({
type
:
"mm"
})
var
toolsInfo
=
GEN
.
getTool
({
job
:
job
,
step
:
step
,
layer
:
layer
,
units
:
"mm"
})
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
){
var
info
=
toolsInfo
[
row
];
var
numberrow
=
row
-
1
;
var
type
=
res
[
numberrow
]?
res
[
numberrow
].
type
.
toLowerCase
()
:
info
.
type
.
toLowerCase
();
var
min_tol
=
res
[
numberrow
]?
Math
.
abs
(
res
[
numberrow
].
tolerance
.
split
(
"/"
)[
1
]
*
1000
):
info
.
min_tol
;
var
max_tol
=
res
[
numberrow
]?
Math
.
abs
(
res
[
numberrow
].
tolerance
.
split
(
"/"
)[
0
]
*
1000
)
:
info
.
max_tol
;
var
drill_size
=
res
[
numberrow
]?
res
[
numberrow
].
size
*
1000
:
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"
)
// {"layer":"gfp2_1216_lte_rl03_am_m1610201_r01-bl-2-3-laser.drl",
// "info":[{"size":"0.090300","tolerance":"+0.020000/-0.020000","type":"PLATED","unit":"MM","row":1}]}
}
})
}
}
]
},
"New_data"
:
{
"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$/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
}
}
}
}
],
"tl_name"
:
[
{
"orig_name"
:
[
"pasttop.art"
,
"^past_top$"
,
"top_solderpaste"
],
"tl_name"
:
"past_top"
},
{
"orig_name"
:
[
"^silk_top
\\
.art$"
,
"pleg
\\
.art"
,
"^silk_top$"
,
"top_silkscreen"
],
"tl_name"
:
"silk_top"
},
{
"orig_name"
:
[
"_r1
\\
.phd$"
,
"_r1
\\
.fph$"
,
"^smt
\\
.art$"
,
"soldtop.art"
,
"^sm_top$"
,
"top_soldermask"
],
"tl_name"
:
"sm_top"
},
{
"orig_name"
:
[
"^top
\\
.art$"
,
"^top$"
],
"tl_name"
:
"top"
},
{
"orig_name"
:
[
"_l(
\\
d+)
\\
.phd$"
,
"_l(
\\
d+)
\\
.fph$"
,
"^in_(
\\
d+)
\\
.art$"
,
"^l(
\\
d+)
\\
.art$"
,
"inner_(
\\
d+)
\\
.art"
,
"layer_(
\\
d+)"
],
"tl_name"
:
"l_($1)"
},
{
"orig_name"
:
[
"^bot
\\
.art$"
,
"^bottom
\\
.art"
,
"^bottom$"
],
"tl_name"
:
"bottom"
},
{
"orig_name"
:
[
"_r
\\
d
\\
.phd$"
,
"_r
\\
d
\\
.fph$"
,
"^smb
\\
.art$"
,
"soldbotm.art"
,
"^sm_botm$"
,
"bot_soldermask"
],
"tl_name"
:
"sm_botm"
},
{
"orig_name"
:
[
"^silk_bottom
\\
.art$"
,
"sleg
\\
.art"
,
"^silk_bot$"
,
"bot_silkscreen"
],
"tl_name"
:
"silk_bot"
},
{
"orig_name"
:
[
"pastbotm
\\
.art"
,
"^past_botm$"
,
"bot_solderpaste"
],
"tl_name"
:
"past_botm"
},
{
"orig_name"
:
[
"^nc_drill$"
,
"^drill$"
],
"tl_name"
:
"drill"
},
{
"orig_name"
:
"multipack
\\
.art"
,
"tl_name"
:
"array"
},
{
"orig_name"
:
[
"
\\
.rou$"
,
"^rout$"
],
"tl_name"
:
"rout"
},
{
"orig_name"
:
[
"outline.art"
,
"^outline$"
],
"tl_name"
:
"outline"
},
{
"orig_name"
:
[
"fab.art"
,
"fab"
],
"tl_name"
:
"fab"
},
{
"orig_name"
:
"top-enig"
,
"tl_name"
:
"top-enig"
},
{
"orig_name"
:
"bot-enig"
,
"tl_name"
:
"bot-enig"
},
{
"orig_name"
:
"fab_page2"
,
"tl_name"
:
"fab_page2"
},
{
"orig_name"
:
[
"_d(
\\
d)(
\\
d+)
\\
.drd"
,
"_d(
\\
d)(
\\
d+)
\\
.fdr"
,
"^d(
\\
d)(
\\
d+)
\\
.art$"
,
"(
\\
d+)-(
\\
d+)-laser
\\
.drl"
,
"d(
\\
d+)-(
\\
d+)"
],
"tl_name"
:
"d_($1)-($2)"
}
]
},
"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
)
||
/
\.
gdo$|
\.
bol$|
\.
gdo$|
\.
pma$|
\.
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"
:
[
"^pmt
\\
.art$"
,
"
\\
.pma$"
,
"SoldPasteTop
\\
.ger"
,
"past_top"
],
"tl_name"
:
"past_top"
},
{
"orig_name"
:
[
"^pmb
\\
.art$"
,
"
\\
.pmb$"
,
"SoldPasteBot
\\
.ger"
,
"past_botm"
],
"tl_name"
:
"past_botm"
},
{
"orig_name"
:
[
"tsilk"
,
"^sst
\\
.art$"
,
"
\\
.ssa$"
,
"SilkScrnTop
\\
.ger"
,
"silk_top"
],
"tl_name"
:
"silk_top"
},
{
"orig_name"
:
[
"bsilk"
,
"^ssb
\\
.art$"
,
"
\\
.ssb$"
,
"SilkScrnBot
\\
.ger"
,
"silk_bot"
],
"tl_name"
:
"silk_bot"
},
{
"orig_name"
:
[
"tmask"
,
"^smt
\\
.art$"
,
"
\\
.sma$"
,
"SoldMask1Top
\\
.ger"
,
"sm_top"
],
"tl_name"
:
"sm_top"
},
{
"orig_name"
:
[
"bmask"
,
"^smb
\\
.art$"
,
"
\\
.smb$"
,
"SoldMask1Bot
\\
.ger"
,
"sm_bot"
],
"tl_name"
:
"sm_botm"
},
{
"orig_name"
:
[
"^top$"
,
"^top.art$"
],
"tl_name"
:
"top"
},
{
"orig_name"
:
[
"^l(
\\
d+).*
\\
.art$"
,
"^v(
\\
d+)
\\
.art$"
,
"^g(
\\
d+)
\\
.art$"
,
"^s(
\\
d+)
\\
.art$"
,
"
\\
.l(
\\
d+)$"
,
"Copper(
\\
d+)
\\
.ger$"
,
"^layer_(
\\
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"
:
[
"thruHolePlated_(
\\
d+)_(
\\
d+)
\\
.ncd"
,
"(
\\
d+)-(
\\
d+)
\\
.drl$"
,
"^drill(
\\
d+)-(
\\
d+)$"
,
"^d_(
\\
d+)-(
\\
d+)$"
],
"tl_name"
:
"d_($1)-($2)"
},
{
"orig_name"
:
[
"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"
:
[
"outline
\\
.art$"
,
"
\\
.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"
},
]
},
"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
/
\.
gdo$|
\.
pho$/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"
:
[
"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"
:
[
"soldermask-top"
,
"top-solder-mask
\\
.pho"
,
"soldermasktop"
,
"sm_top"
],
"tl_name"
:
"sm_top"
},
{
"orig_name"
:
[
"soldermask-bottom"
,
"bottom-solder-mask
\\
.pho"
,
"soldermaskbottom"
,
"sm_bot"
],
"tl_name"
:
"sm_botm"
},
{
"orig_name"
:
[
"top
\\
.pho"
,
"^top$"
,
"layertop"
],
"tl_name"
:
"top"
},
{
"orig_name"
:
[
"^lay(
\\
d+)"
,
"layer(
\\
d+)
\\
.gdo"
,
"layer_(
\\
d+)"
],
"tl_name"
:
"l_($1)"
},
{
"orig_name"
:
[
"^bottom
\\
.pho$"
,
"^bottom$"
,
"layerbottom"
],
"tl_name"
:
"bottom"
},
{
"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"
:
[
"pcb-set
\\
.gdo"
,
"^pcb-set
\\
.pho$"
,
"^pcb-set$"
,
"^array$"
],
"tl_name"
:
"array"
},
{
"orig_name"
:
[
"^outline"
],
"tl_name"
:
"outline"
},
{
"orig_name"
:
[
"au_mask-bottom
\\
.gdo"
,
"au_mask_bottom
\\
.gdo"
,
"enig_top"
],
"tl_name"
:
"enig_top"
},
{
"orig_name"
:
[
"au_mask-top
\\
.gdo"
,
"au_mask_top
\\
.gdo"
,
"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
:[
"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"
:
[
"pasttop
\\
.art"
,
"past_top"
],
"tl_name"
:
"past_top"
},
{
"orig_name"
:
[
"pastbotm
\\
.art"
,
"past_botm"
],
"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"
],
"tl_name"
:
"sm_top"
},
{
"orig_name"
:
[
"soldbotm
\\
.art"
,
"sm_bot"
],
"tl_name"
:
"sm_botm"
},
{
"orig_name"
:
[
"^top$"
,
"^top.art$"
],
"tl_name"
:
"top"
},
{
"orig_name"
:
[
"^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"
:
[
"^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$"
]
}
}
}
},
"data_format"
:
[
{
"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"
:
"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"
}})()
\ No newline at end of file
public_script/scotttest.js
View file @
171681b2
...
...
@@ -30,7 +30,7 @@ PARAMETER:
HELP:
<html><body bgcolor="#DDECFE">
<font size="3" color="#003DB2"><p>功能简介</p></font>
<p>
ol转孔
</p>
<p>
分刀与合刀
</p>
<br>
<font size="3" color="#003DB2"><p>参数配置</p></font>
<p> step信息 </p>
...
...
@@ -51,13 +51,10 @@ var mode = $.ikm ? "topcam" : "aimdfm";
var
IKM
=
$
.
ikm
;
if
(
IKM
==
undefined
)
{
IKM
=
require
(
'topcam.ikm6'
)(
$
)
}
var
GEN
=
$
.
gen
;
require
(
"topsin.genmath"
)
var
zip
=
require
(
'topsin.zip'
);
var
GUI
=
$
.
gui
||
{};
var
Job
=
$
.
job
||
$
.
job_name
;
var
JobId
=
$
.
job_id
;
var
db
=
$
.
db
||
IKM
.
db
var
genMath
=
new
GenMath
();
var
PAR
=
{}
if
(
$
.
par
)
{
PAR
=
$
.
par
...
...
@@ -87,8 +84,7 @@ try {
var
default_par
=
{
step
:
"unit"
,
auto_save
:
"No"
,
units
:
"mm"
,
rout
:
"ol"
units
:
'mm'
}
for
(
var
key
in
default_par
){
// 设置默认属性
if
(
!
par
.
hasOwnProperty
(
key
)
||
par
[
key
]
==
""
){
...
...
@@ -103,98 +99,58 @@ try {
if
(
GEN
.
checkInout
({
job
:
job
,
mode
:
"test"
})
!=
0
){
throw
"the job check"
}
GEN
.
checkInout
({
job
:
job
,
mode
:
"out"
});
}
var
step
=
"unit"
// var layer = "gto_font"
// GEN.workLayer({name:layer,display_number:2,clear_before:'yes'})
// var tmp_con = GEN.MOUSE({type:'r',text:"Please Select"});
// GEN.COM("filter_area_strt")
// GEN.COM("filter_area_xy,x="+tmp_con.x1+",y="+tmp_con.y1)
// GEN.COM("filter_area_xy,x="+tmp_con.x2+",y="+tmp_con.y2)
// GEN.COM("filter_area_end,layer=,filter_name=popup,operation=select,area_type=rectangle,inside_area=yes,intersect_area=no")
// if(GEN.getSelectCount() > 0) {
// var tmp_layer = layer + '_temp'
// // 倾斜文字处理
// // 1. 拷贝到辅助层
// if(GEN.isLayerExists({job:job, layer:tmp_layer})){GEN.deleteLayer({job:job, layer:[tmp_layer]})}
// GEN.selCopyOther({dest:'layer_name',target_layer:tmp_layer})
// GEN.workLayer({name:tmp_layer,display_number:2,clear_before:'yes'})
// GEN.selCopyOther({dest:'layer_name',target_layer:"_ok"})
// var limits = GEN.getLayerLimits({job:job,step:step,layer:tmp_layer, units:"mm"})
// for (var key in limits) {
// limits[key] = limits[key] - 0;
// }
// limits.xc = limits.xmin + limits.xsize/2
// limits.yc = limits.ymin + limits.ysize/2
job
=
"1"
;
var
step
=
"cad"
var
layer
=
"drl"
// // 获取里面有几个字母 每一个字母的limits信息
// GEN.selChangeSym({symbol:"r1"})
// GEN.selContourize()
// var feas = GEN.getFeatures({job:job,step:"unit",layer:tmp_layer,options:"feat_index",units:"mm"})
// var limits_info = [];
// feas.forEach(function(item) {
// var index = item.index;
// GEN.selLayerFeat({layer:tmp_layer, index:index,operation:"select"});
// if(GEN.getSelectCount() > 0) {
// var tmp_l = GEN.getLayerLimits({job:job,step:step,layer:tmp_layer, units:"mm", options:"select"})
// for (var key in tmp_l) {
// tmp_l[key] = tmp_l[key] - 0;
// }
// tmp_l.xc = tmp_l.xmin + tmp_l.xsize/2
// tmp_l.yc = tmp_l.ymin + tmp_l.ysize/2
// limits_info.push({index:index, limits:tmp_l })
// GEN.selClearFeature()
// }
// })
// var rodata = []
// limits_info.forEach(function (item, i) {
// if(limits_info[i+1]){
// rodata.push(getRodate({
// xs : item.limits.xc,
// ys : item.limits.yc,
// xe : limits_info[i+1].limits.xc,
// ye : limits_info[i+1].limits.yc
// }))
// }
// })
// var angle = rodata.reduce(function(a,b) {return a + b}) / rodata.length;
// if (Math.abs(angle) < 10) { angle = 0 }
// GEN.workLayer({name:"_ok",display_number:2,clear_before:'yes'});
// GEN.selTransform({mode:'anchor',oper:"rotate",x_anchor:limits.xc,y_anchor:limits.yc,angle:angle})
// // 按照中心放大
// var limits2 = GEN.getLayerLimits({job:job,step:step,layer:tmp_layer, units:"mm"})
// for (var key in limits) {
// limits2[key] = limits2[key] - 0;
// }
// limits2.xc = limits2.xmin + limits2.xsize/2
// limits2.yc = limits2.ymin + limits2.ysize/2
// GEN.selTransform({mode:'anchor',oper:'scale',x_anchor:limits2.xc,y_anchor:limits2.yc,x_scale:1.2,y_scale:1})
// GEN.selTransform({mode:'anchor',oper:"rotate",x_anchor:limits.xc,y_anchor:limits.yc,angle:360 - angle})
// }
if
(
GEN
.
isLayerExists
({
job
:
job
,
layer
:
"pt-rou"
})){
GEN
.
deleteLayer
({
job
:
'Job'
,
layer
:[
"pt-rou"
]})}
if
(
GEN
.
isLayerExists
({
job
:
job
,
layer
:
"ol_tmp"
})){
GEN
.
deleteLayer
({
job
:
'Job'
,
layer
:[
"ol_tmp"
]})}
GEN
.
createLayer
({
job
:
job
,
layer
:
'pt-rou'
,
conext
:
'misc'
,
type
:
'rout'
})
GEN
.
matrixMoveRow
({
job
:
job
,
layer
:
'pt-rou'
,
after
:
'---'
})
var
feats
=
GEN
.
getFeatures
({
job
:
job
,
step
:
step
,
layer
:
layer
,
options
:
"feat_index"
,
units
:
"mm"
})
feats
.
forEach
(
function
(
item
)
{
if
(
item
.
type
==
"line"
)
{
// 槽孔
var
width
=
parseFloat
(
item
.
symbol
.
slice
(
1
))
var
length
=
width
+
Math
.
sqrt
((
item
.
xe
-
item
.
xs
)
*
(
item
.
xe
-
item
.
xs
)
+
(
item
.
ye
-
item
.
ys
)
*
(
item
.
ye
-
item
.
ys
))
if
(
item
.
attributes
&&
item
.
attributes
.
indexOf
(
".drill=non_plated"
)
>=
0
)
{
if
(
width
>=
6050
||
length
>=
12000
){
GEN
.
selLayerFeat
({
layer
:
layer
,
index
:
index
,
operation
:
"select"
});
if
(
GEN
.
getSelectCount
()
>
0
){
GEN
.
selMoveOther
({
target_layer
:
'ol_tmp'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})}
}
}
else
if
(
item
.
attributes
&&
item
.
attributes
.
indexOf
(
".drill=plated"
)
>=
0
)
{
if
(
width
>=
6050
||
length
>=
12000
){
GEN
.
selLayerFeat
({
layer
:
layer
,
index
:
index
,
operation
:
"select"
});
if
(
GEN
.
getSelectCount
()
>
0
){
GEN
.
selMoveOther
({
target_layer
:
'pt-rou'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})}
}
}
}
if
(
item
.
type
==
"pad"
)
{
var
size
=
parseFloat
(
item
.
symbol
.
slice
(
1
));
if
(
item
.
attributes
&&
item
.
attributes
.
indexOf
(
".drill=non_plated"
)
>=
0
)
{
if
(
size
>
6000
){
GEN
.
selLayerFeat
({
layer
:
layer
,
index
:
index
,
operation
:
"select"
});
if
(
GEN
.
getSelectCount
()
>
0
){
GEN
.
selMoveOther
({
target_layer
:
'ol_tmp'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})}
}
}
else
if
(
item
.
attributes
&&
item
.
attributes
.
indexOf
(
".drill=plated"
)
>=
0
)
{
if
(
size
>
12000
){
GEN
.
selLayerFeat
({
layer
:
layer
,
index
:
index
,
operation
:
"select"
});
if
(
GEN
.
getSelectCount
()
>
0
){
GEN
.
selMoveOther
({
target_layer
:
'pt-rou'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})}
}
}
}
})
// IKM.msg(feas[0].feats)
// 将ol_tmp 和 pt-rou的转为非闭合图形
GEN
.
clearLayers
()
GEN
.
affectedLayer
({
affected
:
'yes'
,
layer
:[
"ol_tmp"
,
"pt-rou"
],
clear_before
:
"yes"
})
GEN
.
COM
(
"sel_contourize,accuracy=0,break_to_islands=yes,clean_hole_size=0,clean_hole_mode=x_and_y"
)
GEN
.
COM
(
"sel_surf2outline,width=1"
)
GEN
.
affectedLayer
({
affected
:
'no'
,
mode
:
'all'
})
GEN
.
workLayer
({
name
:
'ol_tmp'
,
display_number
:
2
,
clear_before
:
'yes'
})
GEN
.
selMoveOther
({
target_layer
:
'ol'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})
// var ret = genMath.profile2Polygon(feas[0].feats)
// COM tools_tab_reset
// COM tools_tab_add,num=1,shape=hole,type=via,min_tol=0,max_tol=1,bit=,drill_size=300
// COM tools_tab_add,num=2,shape=hole,type=via,min_tol=0,max_tol=0,bit=,drill_size=500
// COM tools_tab_add,num=3,shape=hole,type=plate,min_tol=0,max_tol=0,bit=,drill_size=700
// COM tools_tab_add,num=4,shape=hole,type=plate,min_tol=0,max_tol=0,bit=,drill_size=800
// COM tools_tab_add,num=5,shape=hole,type=plate,min_tol=0,max_tol=0,bit=,drill_size=900
// COM tools_tab_add,num=6,shape=hole,type=plate,min_tol=0,max_tol=0,bit=,drill_size=1000
// COM tools_tab_add,num=7,shape=hole,type=nplate,min_tol=0,max_tol=0,bit=,drill_size=1600
// COM tools_tab_add,num=8,shape=hole,type=plate,min_tol=0,max_tol=0,bit=,drill_size=3000
// COM tools_tab_add,num=9,shape=hole,type=nplate,min_tol=0,max_tol=0,bit=,drill_size=3300
// COM tools_set,layer=drl,thickness=3235.96,user_params=,slots=no
setTool
({
job
:
job
,
step
:
step
,
layer
:
"drl_tmp"
,
callback
:
function
(
toolinfo
)
{
IKM
.
msg
(
toolinfo
)
}
})
...
...
@@ -228,75 +184,3 @@ try {
return
(
mode
===
"aimdfm"
)
?
{
status
:
Status
,
result_data
:
resultData
}
:
"Error"
;
}
function
selCopyLayer
(
props
){
// 拷贝选择的到辅助层
var
layer
=
props
.
layer
var
job
=
props
.
job
if
(
GEN
.
isLayerExists
({
job
:
job
,
layer
:
layer
})){
GEN
.
deleteLayer
({
job
:
job
,
layer
:
layer
})
}
GEN
.
selCopyOther
({
dest
:
'layer_name'
,
target_layer
:
layer
})
}
function
getMinSym
(
sym
)
{
var
min_size
;
for
(
var
key
in
sym
)
{
var
info
=
sym
[
key
]
if
(
info
.
size
){
info
.
size
=
Number
(
info
.
size
)}
if
(
!
info
.
size
)
{
var
width
=
Number
(
info
.
width
)
var
height
=
Number
(
info
.
height
)
info
.
size
=
width
>
height
?
height
:
width
;
}
if
(
info
.
size
)
{
if
(
!
min_size
){
min_size
=
info
.
size
}
else
if
(
info
.
size
<
min_size
)
{
min_size
=
info
.
size
}
}
}
return
min_size
}
function
getRodate
(
props
){
var
xs
=
props
.
xs
;
var
ys
=
props
.
ys
;
var
xe
=
props
.
xe
;
var
ye
=
props
.
ye
;
var
y
=
ye
-
ys
;
var
x
=
xe
-
xs
;
var
r
=
Math
.
atan
(
y
/
x
)
return
r
*
180
/
Math
.
PI
}
function
setTool
(
props
)
{
var
job
=
props
.
job
;
var
step
=
props
.
step
;
var
layer
=
props
.
layer
;
var
tool_info
=
GEN
.
getTool
({
job
:
job
,
step
:
step
,
layer
:
layer
,
units
:
"mm"
})
// 操作tool_info
props
.
callback
(
tool_info
)
GEN
.
COM
(
"tools_show,layer="
+
layer
)
GEN
.
COM
(
"tools_tab_reset"
)
var
typehash
=
{
non_plated
:
"nplate"
,
plated
:
"plate"
,
via
:
"via"
,
laser
:
"via"
}
Object
.
keys
(
tool_info
).
forEach
(
function
(
key
){
var
item
=
tool_info
[
key
]
if
(
item
.
shape
==
"hole"
)
{
GEN
.
COM
(
"tools_tab_add,num="
+
key
+
",shape="
+
item
.
shape
+
",type="
+
typehash
[
item
.
type
]
+
",min_tol="
+
item
.
min_tol
+
",max_tol="
+
item
.
max_tol
+
",bit=,finish_size="
+
item
.
finish_size
+
",drill_size="
+
item
.
drill_size
+
",combined=yes,orig_size=0"
)
}
else
if
(
item
.
shape
==
"slot"
)
{
GEN
.
COM
(
"tools_tab_add,num="
+
key
+
",shape=slot,type="
+
typehash
[
item
.
type
]
+
",min_tol="
+
item
.
min_tol
+
",max_tol="
+
item
.
max_tol
+
",finish_size="
+
item
.
finish_size
+
",bit=,drill_size="
+
item
.
drill_size
+
",slot_len="
+
item
.
slot_len
)
}
})
GEN
.
COM
(
"tools_set,layer="
+
layer
+
",slots=by_length"
)
}
\ No newline at end of file
public_script/silkScreenOptimize.js
View file @
171681b2
...
...
@@ -173,24 +173,24 @@ try {
if
(
!
GEN
.
isJobOpen
({
job
:
job
})){
GEN
.
openJob
({
job
:
job
})
}
if
(
mode
==
"aimdfm"
){
if
(
GEN
.
checkInout
({
job
:
job
,
mode
:
"test"
})
!=
0
){
throw
"the job check"
}
else
{
GEN
.
checkInout
({
job
:
job
,
mode
:
"out"
})
}
}
IKM
.
msg
(
"创建套层"
)
var
err
=
createCoverLayer
()
// 创建套层
if
(
err
)
{
throw
err
}
GEN
.
PAUSE
(
"end"
)
IKM
.
msg
(
"分离文字和文字框"
)
var
err
=
ssFrameSeparate
()
// 分离文字和文字框
if
(
err
)
{
throw
err
}
GEN
.
PAUSE
(
"end"
)
var
workstep
=
getWorkStep
()
if
(
!
Array
.
isArray
(
workstep
)){
throw
"工作step错误"
}
IKM
.
msg
(
"文字框优化"
)
var
err
=
slBoxOptimize
()
// 文字框优化
if
(
err
)
{
throw
err
}
GEN
.
PAUSE
(
"end"
)
// var err = createCoverLayer({workstep:workstep}) // 创建套层
// if (err) {throw err}
// GEN.PAUSE("createCoverLayer end; please check")
IKM
.
msg
(
"文字优化"
)
var
err
=
slOptimize
()
// 文字优化
if
(
err
)
{
throw
err
}
// var err = ssFrameSeparate({workstep:workstep}) // 分离文字和文字框
// if (err) {throw err}
// GEN.PAUSE("ssFrameSeparate end; please check")
// var err = slBoxOptimize({workstep:workstep}) // 文字框优化
// if (err) {throw err}
// GEN.PAUSE("slBoxOptimize end; please check")
var
err
=
slOptimize
({
workstep
:
workstep
})
// 文字优化
if
(
err
)
{
throw
err
}
GEN
.
PAUSE
(
"slOptimize end; please check"
)
...
...
@@ -212,8 +212,7 @@ try {
// 创建套层
function
createCoverLayer
(
props
){
// 1. step过滤
var
workstep
=
getWorkStep
()
if
(
!
Array
.
isArray
(
workstep
)){
throw
"工作step错误"
}
var
workstep
=
props
.
workstep
;
// 2.过滤工作层
var
work_layer
=
getLayer
({
layer_type
:
"silk_screen"
,
context
:
"board"
})
if
(
/yes/ig
.
test
(
par
.
select_lyr
)){
...
...
@@ -230,7 +229,7 @@ function createCoverLayer (props){
var
info
=
gui
.
showForm
({
title
:
'请手动匹配以下信息'
,
showcheck
:
1
,
gen
:
GEN
,
defaultsize
:[
500
,
25
0
],
defaultsize
:[
200
,
10
0
],
ui
:
{
type
:
'ScrollArea'
,
property
:
{
widget_resizable
:
true
,
frame_shape
:
'NoFrame'
,
align
:
'Top'
},
...
...
@@ -323,10 +322,9 @@ function createCoverLayer (props){
GEN
.
clearLayers
()
}
// 字符 和 文字框分开
function
ssFrameSeparate
()
{
function
ssFrameSeparate
(
props
)
{
// 1. step过滤
var
workstep
=
getWorkStep
()
if
(
!
Array
.
isArray
(
workstep
)){
throw
"工作step错误"
}
var
workstep
=
props
.
workstep
;
// 2.过滤工作层
var
work_layers
=
getLayer
({
layer_type
:
"silk_screen"
,
context
:
"board"
})
if
(
/yes/ig
.
test
(
par
.
select_lyr
)){
...
...
@@ -336,7 +334,7 @@ function ssFrameSeparate () {
tmp
[
key
]
=
key
;
return
tmp
})
work_layers
=
gui
.
selectMultiple
({
title
:
"请先择工作层"
,
list
:
layers
,
defaultvalue
:
work_layers
,
columns
:
4
,
gen
:
GEN
})
work_layers
=
gui
.
selectMultiple
({
defaultsize
:[
200
,
100
],
title
:
"请先择工作层"
,
list
:
layers
,
defaultvalue
:
work_layers
,
columns
:
4
,
gen
:
GEN
})
}
if
(
work_layers
.
length
==
0
)
{
return
"没有先择layer"
}
...
...
@@ -561,10 +559,9 @@ function ssFrameSeparate () {
})
}
// 文字框按阻焊扩大
function
slBoxOptimize
(){
function
slBoxOptimize
(
props
){
// 1. step过滤
var
workstep
=
getWorkStep
()
if
(
!
Array
.
isArray
(
workstep
)){
throw
"工作step错误"
}
var
workstep
=
props
.
workstep
;
// 2.过滤工作层
var
work_layers
=
getLayer
({
layer_type
:
"silk_screen"
,
context
:
"board"
})
if
(
/yes/ig
.
test
(
par
.
select_lyr
)){
...
...
@@ -574,7 +571,7 @@ function slBoxOptimize(){
tmp
[
key
]
=
key
;
return
tmp
})
work_layers
=
gui
.
selectMultiple
({
title
:
"请先择工作层"
,
list
:
layers
,
defaultvalue
:
work_layers
,
columns
:
4
,
gen
:
GEN
})
work_layers
=
gui
.
selectMultiple
({
defaultsize
:[
200
,
100
],
title
:
"请先择工作层"
,
list
:
layers
,
defaultvalue
:
work_layers
,
columns
:
4
,
gen
:
GEN
})
}
if
(
work_layers
.
length
==
0
)
{
return
"没有先择layer"
}
...
...
@@ -794,10 +791,11 @@ function slBoxOptimize(){
}
// 文字放大
function
slOptimize
()
{
function
slOptimize
(
props
)
{
var
x_scale
=
1
;
var
y_scale
=
1.2
;
// 1. step过滤
var
workstep
=
getWorkStep
()
if
(
!
Array
.
isArray
(
workstep
)){
throw
"工作step错误"
}
var
workstep
=
props
.
workstep
;
// 2.过滤工作层
var
work_layers
=
getLayer
({
layer_type
:
"silk_screen"
,
context
:
"board"
})
if
(
/yes/ig
.
test
(
par
.
select_lyr
)){
...
...
@@ -807,7 +805,7 @@ function slOptimize() {
tmp
[
key
]
=
key
;
return
tmp
})
work_layers
=
gui
.
selectMultiple
({
title
:
"请先择工作层"
,
list
:
layers
,
defaultvalue
:
work_layers
,
columns
:
4
,
gen
:
GEN
})
work_layers
=
gui
.
selectMultiple
({
defaultsize
:[
200
,
100
],
title
:
"请先择工作层"
,
list
:
layers
,
defaultvalue
:
work_layers
,
columns
:
4
,
gen
:
GEN
})
}
if
(
work_layers
.
length
==
0
)
{
return
"没有先择layer"
}
...
...
@@ -824,18 +822,18 @@ function slOptimize() {
var
tmp2
=
font_layer
+
"_2"
;
var
tmp3
=
font_layer
+
"_3"
;
var
bk
=
font_layer
+
"_bk"
;
var
bk2
=
font_layer
+
"_
bk2
"
;
var
bk2
=
font_layer
+
"_
ok
"
;
[
tmp1
,
tmp2
,
tmp3
,
bk
,
bk2
].
forEach
(
function
(
v
){
if
(
GEN
.
isLayerExists
({
job
:
job
,
layer
:
v
})){
GEN
.
deleteLayer
({
job
:
job
,
layer
:[
v
]})}
})
GEN
.
copyLayer
({
source_job
:
job
,
source_step
:
step
,
source_layer
:
font_layer
,
dest_layer
:
tmp1
,
mode
:
"replace"
})
//
GEN.copyLayer({source_job:job,source_step:step,source_layer:font_layer,dest_layer:tmp1, mode:"replace"})
GEN
.
copyLayer
({
source_job
:
job
,
source_step
:
step
,
source_layer
:
font_layer
,
dest_layer
:
tmp3
,
mode
:
"replace"
})
GEN
.
copyLayer
({
source_job
:
job
,
source_step
:
step
,
source_layer
:
font_layer
,
dest_layer
:
bk2
,
mode
:
"replace"
})
GEN
.
copyLayer
({
source_job
:
job
,
source_step
:
step
,
source_layer
:
font_layer
,
dest_layer
:
bk
,
mode
:
"replace"
})
//
GEN.copyLayer({source_job:job,source_step:step,source_layer:font_layer,dest_layer:bk, mode:"replace"})
GEN
.
affectedLayer
({
affected
:
'no'
,
mode
:
'all'
})
GEN
.
selClearFeature
()
GEN
.
workLayer
({
name
:
tmp1
,
display_number
:
2
,
clear_before
:
'yes'
})
GEN
.
selChangeSym
({
symbol
:
"r0.1"
})
//
GEN.workLayer({name:tmp1,display_number:2,clear_before:'yes'})
//
GEN.selChangeSym({symbol:"r0.1"})
// 利用tmp3 快速定位
GEN
.
workLayer
({
name
:
tmp3
,
display_number
:
2
,
clear_before
:
'yes'
})
...
...
@@ -855,6 +853,13 @@ function slOptimize() {
item
.
limit
.
ymin
=
Number
(
item
.
limit
.
ymin
);
item
.
xc
=
item
.
limit
.
xsize
/
2
+
item
.
limit
.
xmin
item
.
yc
=
item
.
limit
.
ysize
/
2
+
item
.
limit
.
ymin
if
(
item
.
limit
.
xsize
>
item
.
limit
.
ysize
)
{
item
.
x_scale
=
x_scale
item
.
y_scale
=
y_scale
}
else
{
item
.
y_scale
=
x_scale
item
.
x_scale
=
y_scale
}
GEN
.
selClearFeature
()
}
})
...
...
@@ -865,133 +870,205 @@ function slOptimize() {
GEN
.
COM
(
"filter_area_xy,x="
+
item
.
limit
.
xmax
+
",y="
+
item
.
limit
.
ymax
)
GEN
.
COM
(
"filter_area_end,layer=,filter_name=popup,operation=select,area_type=rectangle,inside_area=yes,intersect_area=yes"
)
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selTransform
({
mode
:
'anchor'
,
oper
:
'scale'
,
x_anchor
:
item
.
xc
,
y_anchor
:
item
.
yc
,
x_scale
:
1.2
,
y_scale
:
1.2
})
GEN
.
selTransform
({
mode
:
'anchor'
,
oper
:
'scale'
,
x_anchor
:
item
.
xc
,
y_anchor
:
item
.
yc
,
x_scale
:
item
.
x_scale
,
y_scale
:
item
.
y_scale
})
}
})
GEN
.
units
({
type
:
par
.
units
})
GEN
.
workLayer
({
name
:
tmp1
,
display_number
:
2
,
clear_before
:
'yes'
})
GEN
.
copyLayer
({
source_job
:
job
,
source_step
:
step
,
source_layer
:
tmp1
,
dest_layer
:
tmp2
,
mode
:
"replace"
})
GEN
.
COM
(
"sel_contourize,accuracy=0,break_to_islands=yes,clean_hole_size=0,clean_hole_mode=x_and_y"
)
GEN
.
affectedLayer
({
affected
:
'no'
,
mode
:
'all'
})
GEN
.
clearLayers
()
var
features
=
GEN
.
getFeatures
({
job
:
job
,
step
:
step
,
layer
:
tmp1
,
options
:
"feat_index"
})
var
indexes
=
[]
features
.
forEach
(
function
(
item
){
GEN
.
workLayer
({
name
:
tmp1
,
display_number
:
2
,
clear_before
:
'yes'
})
var
index
=
item
.
index
;
// 选中index 将它复制到tmp3 获取信息
GEN
.
selLayerFeat
({
layer
:
tmp1
,
index
:
index
,
operation
:
"select"
})
if
(
GEN
.
getSelectCount
()
>
0
){
item
.
limit
=
GEN
.
getLayerLimits
({
job
:
job
,
step
:
step
,
layer
:
tmp1
,
units
:
'mm'
,
options
:
"select"
})
}
})
var
xs
=
{};
var
ys
=
{};
//
GEN.units({type:par.units})
//
GEN.workLayer({name:tmp1,display_number:2,clear_before:'yes'})
//
GEN.copyLayer({source_job:job,source_step:step,source_layer:tmp1,dest_layer:tmp2, mode:"replace"})
//
GEN.COM("sel_contourize,accuracy=0,break_to_islands=yes,clean_hole_size=0,clean_hole_mode=x_and_y")
//
GEN.affectedLayer({affected:'no',mode:'all'})
//
GEN.clearLayers()
//
var features = GEN.getFeatures({job:job,step:step,layer:tmp1,options:"feat_index"})
//
var indexes = []
//
features.forEach(function(item){
//
GEN.workLayer({name:tmp1,display_number:2,clear_before:'yes'})
//
var index = item.index;
//
// 选中index 将它复制到tmp3 获取信息
//
GEN.selLayerFeat({layer:tmp1, index:index,operation:"select"})
//
if(GEN.getSelectCount() > 0){
//
item.limit = GEN.getLayerLimits({job:job,step:step,layer:tmp1,units:'mm', options:"select"})
//
}
//
})
//
var xs = {};
//
var ys = {};
features
.
forEach
(
function
(
item
){
surfaceAnalysis
(
item
)
indexes
.
push
({
index
:
item
.
index
,
xmin
:
item
.
limit
.
xmin
,
ymin
:
item
.
limit
.
ymin
,
xmax
:
item
.
limit
.
xmax
,
ymax
:
item
.
limit
.
ymax
,
xc
:
item
.
xc
,
yc
:
item
.
yc
})
if
(
!
ys
[
turnFix
(
item
.
yc
)]){
ys
[
turnFix
(
item
.
yc
)]
=
[]}
ys
[
turnFix
(
item
.
yc
)].
push
(
item
)
if
(
!
xs
[
turnFix
(
item
.
xc
)]){
xs
[
turnFix
(
item
.
xc
)]
=
[]}
xs
[
turnFix
(
item
.
xc
)].
push
(
item
)
})
// features.forEach(function(item){
// surfaceAnalysis(item)
// indexes.push({
// index:item.index,
// xmin : item.limit.xmin,
// ymin : item.limit.ymin,
// xmax : item.limit.xmax,
// ymax : item.limit.ymax,
// xc:item.xc,
// yc:item.yc
// })
// if(!ys[turnFix(item.yc)]){ys[turnFix(item.yc)] = []}
// ys[turnFix(item.yc)].push(item)
// if(!xs[turnFix(item.xc)]){xs[turnFix(item.xc)] = []}
// xs[turnFix(item.xc)].push(item)
// })
// var limitinfo = []
// indexes = sameDirection(ys, "xc", limitinfo, indexes)
// indexes = sameDirection(xs, "yc", limitinfo, indexes)
var
limitinfo
=
[]
indexes
=
sameDirection
(
ys
,
"xc"
,
limitinfo
,
indexes
)
indexes
=
sameDirection
(
xs
,
"yc"
,
limitinfo
,
indexes
)
// if(GEN.isLayerExists({job:job,layer:"_ok"})){GEN.deleteLayer({job:job,layer:["_ok"]})}
// if(GEN.isLayerExists({job:job,layer:"_fail"})){GEN.deleteLayer({job:job,layer:["_fail"]})}
// GEN.createLayer({job:job,layer:'_ok',conext:'misc',type:'document'})
// GEN.createLayer({job:job,layer:'_fail',conext:'misc',type:'document'})
if
(
GEN
.
isLayerExists
({
job
:
job
,
layer
:
"_ok"
})){
GEN
.
deleteLayer
({
job
:
job
,
layer
:[
"_ok"
]})}
if
(
GEN
.
isLayerExists
({
job
:
job
,
layer
:
"_fail"
})){
GEN
.
deleteLayer
({
job
:
job
,
layer
:[
"_fail"
]})}
GEN
.
createLayer
({
job
:
job
,
layer
:
'_ok'
,
conext
:
'misc'
,
type
:
'document'
})
GEN
.
createLayer
({
job
:
job
,
layer
:
'_fail'
,
conext
:
'misc'
,
type
:
'document'
})
// limitinfo.forEach(function(item){
// GEN.workLayer({name:bk,display_number:2,clear_before:'yes'})
// GEN.COM("filter_area_strt")
// GEN.COM("filter_area_xy,x="+item.xmin+",y=" + item.ymin)
// GEN.COM("filter_area_xy,x="+item.xmax+",y=" + item.ymax)
// GEN.COM("filter_area_end,layer=,filter_name=popup,operation=select,area_type=rectangle,inside_area=yes,intersect_area=yes")
// if(GEN.getSelectCount() > 0 ) {
// GEN.selMoveOther({target_layer:'transform_temp',invert:'no',dx:0,dy:0,size:0})
// GEN.workLayer({name:"transform_temp",display_number:2,clear_before:'yes'})
// GEN.selTransform({mode:'anchor',oper:'scale',
// x_anchor: item.xmin + Math.abs(item.xmax - item.xmin) / 2,
// y_anchor: item.ymin + Math.abs(item.ymax - item.ymin) / 2,
// x_scale:1.2,y_scale:1.2})
// // 与成功层touch 有碰移动到失败层 没碰移动到成功层
// GEN.selRefFeat({layers:"_ok",use:"filter",mode:"touch"})
// if(GEN.getSelectCount() > 0) {
// GEN.selClearFeature()
// GEN.selMoveOther({target_layer:'_fail',invert:'no',dx:0,dy:0,size:0})
// } else {
// GEN.selMoveOther({target_layer:'_ok',invert:'no',dx:0,dy:0,size:0})
// }
// }
// })
limitinfo
.
forEach
(
function
(
item
){
GEN
.
workLayer
({
name
:
bk
,
display_number
:
2
,
clear_before
:
'yes'
})
// indexes.forEach(function(item){
// var xc = item.xc;
// var yc = item.yc;
// GEN.workLayer({name:bk,display_number:2,clear_before:'yes'})
// GEN.COM("filter_area_strt")
// GEN.COM("filter_area_xy,x="+item.xmin+",y=" + item.ymin)
// GEN.COM("filter_area_xy,x="+item.xmax+",y=" + item.ymax)
// GEN.COM("filter_area_end,layer=,filter_name=popup,operation=select,area_type=rectangle,inside_area=yes,intersect_area=yes")
// if(GEN.getSelectCount() > 0 ) {
// GEN.selMoveOther({target_layer:'transform_temp',invert:'no',dx:0,dy:0,size:0})
// GEN.workLayer({name:"transform_temp",display_number:2,clear_before:'yes'})
// GEN.selTransform({mode:'anchor',oper:'scale',x_anchor: xc,y_anchor: yc,
// x_scale:1.2,y_scale:1.2})
// // 与成功层touch 有碰移动到失败层 没碰移动到成功层
// GEN.selRefFeat({layers:"_ok",use:"filter",mode:"touch"})
// if(GEN.getSelectCount() > 0) {
// GEN.selClearFeature()
// GEN.selMoveOther({target_layer:'_fail',invert:'no',dx:0,dy:0,size:0})
// } else {
// GEN.selMoveOther({target_layer:'_ok',invert:'no',dx:0,dy:0,size:0})
// }
// }
// })
// GEN.workLayer({name:bk,display_number:2,clear_before:'yes'})
// GEN.selAllFeat()
// if(GEN.getSelectCount() > 0) { GEN.selMoveOther({target_layer:'_fail',invert:'no',dx:0,dy:0,size:0}) }
// 框选
var
flag
=
true
;
IKM
.
msg
(
font_layer
+
"层:请选择需放大的文字,不需制作了请【左键框选空白处】"
)
while
(
flag
){
var
bk2_tmp
=
bk2
+
"_tmp"
GEN
.
workLayer
({
name
:
font_layer
,
display_number
:
1
,
clear_before
:
'yes'
});
var
tmp_con
=
GEN
.
MOUSE
({
type
:
'r'
,
text
:
"Please Select"
});
GEN
.
workLayer
({
name
:
font_layer
,
display_number
:
1
,
clear_before
:
'yes'
});
GEN
.
COM
(
"filter_area_strt"
)
GEN
.
COM
(
"filter_area_xy,x="
+
item
.
xmin
+
",y="
+
item
.
ymin
)
GEN
.
COM
(
"filter_area_xy,x="
+
item
.
xmax
+
",y="
+
item
.
ymax
)
GEN
.
COM
(
"filter_area_end,layer=,filter_name=popup,operation=select,area_type=rectangle,inside_area=yes,intersect_area=yes"
)
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selMoveOther
({
target_layer
:
'transform_temp'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})
GEN
.
workLayer
({
name
:
"transform_temp"
,
display_number
:
2
,
clear_before
:
'yes'
})
GEN
.
selTransform
({
mode
:
'anchor'
,
oper
:
'scale'
,
x_anchor
:
item
.
xmin
+
Math
.
abs
(
item
.
xmax
-
item
.
xmin
)
/
2
,
y_anchor
:
item
.
ymin
+
Math
.
abs
(
item
.
ymax
-
item
.
ymin
)
/
2
,
x_scale
:
1.2
,
y_scale
:
1.2
})
// 与成功层touch 有碰移动到失败层 没碰移动到成功层
GEN
.
selRefFeat
({
layers
:
"_ok"
,
use
:
"filter"
,
mode
:
"touch"
})
GEN
.
COM
(
"filter_area_xy,x="
+
tmp_con
.
x1
+
",y="
+
tmp_con
.
y1
)
GEN
.
COM
(
"filter_area_xy,x="
+
tmp_con
.
x2
+
",y="
+
tmp_con
.
y2
)
GEN
.
COM
(
"filter_area_end,layer=,filter_name=popup,operation=select,area_type=rectangle,inside_area=yes,intersect_area=no"
)
if
(
GEN
.
getSelectCount
()
>
0
){
var
tmp_layer
=
font_layer
+
"_tmp"
;
selCopyOther
({
delExist
:
true
,
layer
:
tmp_layer
})
GEN
.
workLayer
({
name
:
tmp_layer
,
display_number
:
1
,
clear_before
:
'yes'
});
GEN
.
selAllFeat
()
selCopyOther
({
delExist
:
true
,
layer
:
bk2_tmp
})
GEN
.
workLayer
({
name
:
bk2
,
display_number
:
1
,
clear_before
:
'yes'
});
GEN
.
COM
(
"filter_area_strt"
)
GEN
.
COM
(
"filter_area_xy,x="
+
tmp_con
.
x1
+
",y="
+
tmp_con
.
y1
)
GEN
.
COM
(
"filter_area_xy,x="
+
tmp_con
.
x2
+
",y="
+
tmp_con
.
y2
)
GEN
.
COM
(
"filter_area_end,layer=,filter_name=popup,operation=select,area_type=rectangle,inside_area=yes,intersect_area=no"
)
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selDelete
()}
GEN
.
workLayer
({
name
:
tmp_layer
,
display_number
:
1
,
clear_before
:
'yes'
});
var
limits
=
GEN
.
getLayerLimits
({
job
:
job
,
step
:
step
,
layer
:
tmp_layer
,
units
:
"mm"
})
for
(
var
key
in
limits
)
{
limits
[
key
]
=
limits
[
key
]
-
0
;
}
limits
.
xc
=
limits
.
xmin
+
limits
.
xsize
/
2
limits
.
yc
=
limits
.
ymin
+
limits
.
ysize
/
2
// 获取里面有几个字母 每一个字母的limits信息
GEN
.
selChangeSym
({
symbol
:
"r1"
})
GEN
.
selContourize
()
var
feas
=
GEN
.
getFeatures
({
job
:
job
,
step
:
step
,
layer
:
tmp_layer
,
options
:
"feat_index"
,
units
:
"mm"
})
if
(
feas
.
length
==
1
)
{
GEN
.
workLayer
({
name
:
bk2_tmp
,
display_number
:
2
,
clear_before
:
'yes'
});
GEN
.
selTransform
({
mode
:
'anchor'
,
oper
:
'scale'
,
x_anchor
:
limits
.
xc
,
y_anchor
:
limits
.
yc
,
x_scale
:
x_scale
,
y_scale
:
y_scale
})
GEN
.
selMoveOther
({
target_layer
:
bk2
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})
}
else
if
(
feas
.
length
>
1
)
{
var
limits_info
=
[];
feas
.
forEach
(
function
(
item
)
{
var
index
=
item
.
index
;
GEN
.
selLayerFeat
({
layer
:
tmp_layer
,
index
:
index
,
operation
:
"select"
});
if
(
GEN
.
getSelectCount
()
>
0
)
{
var
tmp_l
=
GEN
.
getLayerLimits
({
job
:
job
,
step
:
step
,
layer
:
tmp_layer
,
units
:
"mm"
,
options
:
"select"
})
for
(
var
key
in
tmp_l
)
{
tmp_l
[
key
]
=
tmp_l
[
key
]
-
0
;
}
tmp_l
.
xc
=
tmp_l
.
xmin
+
tmp_l
.
xsize
/
2
tmp_l
.
yc
=
tmp_l
.
ymin
+
tmp_l
.
ysize
/
2
limits_info
.
push
({
index
:
index
,
limits
:
tmp_l
})
GEN
.
selClearFeature
()
GEN
.
selMoveOther
({
target_layer
:
'_fail'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})
}
else
{
GEN
.
selMoveOther
({
target_layer
:
'_ok'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})
}
})
var
rodata
=
[]
limits_info
.
forEach
(
function
(
item
,
i
)
{
if
(
limits_info
[
i
+
1
]){
rodata
.
push
(
getRodate
({
xs
:
item
.
limits
.
xc
,
ys
:
item
.
limits
.
yc
,
xe
:
limits_info
[
i
+
1
].
limits
.
xc
,
ye
:
limits_info
[
i
+
1
].
limits
.
yc
}))
}
})
indexes
.
forEach
(
function
(
item
){
var
xc
=
item
.
xc
;
var
yc
=
item
.
yc
;
GEN
.
workLayer
({
name
:
bk
,
display_number
:
2
,
clear_before
:
'yes'
})
GEN
.
COM
(
"filter_area_strt"
)
GEN
.
COM
(
"filter_area_xy,x="
+
item
.
xmin
+
",y="
+
item
.
ymin
)
GEN
.
COM
(
"filter_area_xy,x="
+
item
.
xmax
+
",y="
+
item
.
ymax
)
GEN
.
COM
(
"filter_area_end,layer=,filter_name=popup,operation=select,area_type=rectangle,inside_area=yes,intersect_area=yes"
)
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selMoveOther
({
target_layer
:
'transform_temp'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})
GEN
.
workLayer
({
name
:
"transform_temp"
,
display_number
:
2
,
clear_before
:
'yes'
})
GEN
.
selTransform
({
mode
:
'anchor'
,
oper
:
'scale'
,
x_anchor
:
xc
,
y_anchor
:
yc
,
x_scale
:
1.2
,
y_scale
:
1.2
})
// 与成功层touch 有碰移动到失败层 没碰移动到成功层
GEN
.
selRefFeat
({
layers
:
"_ok"
,
use
:
"filter"
,
mode
:
"touch"
})
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selClearFeature
()
GEN
.
selMoveOther
({
target_layer
:
'_fail'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})
var
angle
=
rodata
.
reduce
(
function
(
a
,
b
)
{
return
a
+
b
})
/
rodata
.
length
;
if
(
Math
.
abs
(
angle
)
<
10
)
{
angle
=
0
}
GEN
.
workLayer
({
name
:
bk2_tmp
,
display_number
:
2
,
clear_before
:
'yes'
});
GEN
.
selTransform
({
mode
:
'anchor'
,
oper
:
"rotate"
,
x_anchor
:
limits
.
xc
,
y_anchor
:
limits
.
yc
,
angle
:
angle
})
// 按照中心放大
var
limits2
=
GEN
.
getLayerLimits
({
job
:
job
,
step
:
step
,
layer
:
tmp_layer
,
units
:
"mm"
})
for
(
var
key
in
limits
)
{
limits2
[
key
]
=
limits2
[
key
]
-
0
;
}
limits2
.
xc
=
limits2
.
xmin
+
limits2
.
xsize
/
2
limits2
.
yc
=
limits2
.
ymin
+
limits2
.
ysize
/
2
if
(
limits2
.
xsize
>
limits2
.
ysize
)
{
limits2
.
x_scale
=
x_scale
limits2
.
y_scale
=
y_scale
}
else
{
GEN
.
selMoveOther
({
target_layer
:
'_ok'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})
limits2
.
y_scale
=
x_scale
limits2
.
x_scale
=
y_scale
}
GEN
.
selTransform
({
mode
:
'anchor'
,
oper
:
'scale'
,
x_anchor
:
limits2
.
xc
,
y_anchor
:
limits2
.
yc
,
x_scale
:
limits2
.
x_scale
,
y_scale
:
limits2
.
y_scale
})
GEN
.
selTransform
({
mode
:
'anchor'
,
oper
:
"rotate"
,
x_anchor
:
limits
.
xc
,
y_anchor
:
limits
.
yc
,
angle
:
360
-
angle
})
GEN
.
selMoveOther
({
target_layer
:
bk2
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})
}
})
GEN
.
workLayer
({
name
:
bk
,
display_number
:
2
,
clear_before
:
'yes'
})
GEN
.
selAllFeat
()
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selMoveOther
({
target_layer
:
'_fail'
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})
}
IKM
.
msg
(
layer
+
"层完毕,请确认,将正确的移动到_ok层"
)
GEN
.
PAUSE
(
"PAUSE"
)
// 框选
}
else
{
flag
=
false
}
}
GEN
.
workLayer
({
name
:
"_ok"
,
display_number
:
2
,
clear_before
:
'yes'
})
// 将ok的移动到文字层
GEN
.
workLayer
({
name
:
font_layer
,
display_number
:
2
,
clear_before
:
'yes'
})
GEN
.
selDelete
()
GEN
.
workLayer
({
name
:
"_ok"
,
display_number
:
2
,
clear_before
:
'yes'
})
GEN
.
workLayer
({
name
:
bk2
,
display_number
:
2
,
clear_before
:
'yes'
})
GEN
.
selMoveOther
({
target_layer
:
font_layer
,
invert
:
'no'
,
dx
:
0
,
dy
:
0
,
size
:
0
})
GEN
.
PAUSE
(
"check"
);
[
tmp1
,
tmp2
,
tmp3
,
bk
,
bk2
,
"_ok"
,
"_fail"
].
forEach
(
function
(
v
){
...
...
@@ -1051,6 +1128,7 @@ function NewGUI (gui) {
"title"
:
props
.
title
||
"select"
,
"list"
:
props
.
list
||
[],
"defaultvalue"
:
props
[
"defaultvalue"
]
||
[
""
],
"defaultsize"
:
props
[
"defaultsize"
]
||
[
200
,
100
],
"columns"
:
props
.
columns
||
2
,
"gen"
:
props
.
gen
||
GEN
});
...
...
@@ -1144,6 +1222,8 @@ function getWorkStep(props){
if
(
steplists
.
length
==
0
){
return
"根据脚本参数过滤出来的step不存在,请检查资料或者脚本参数配置!"
}
var
workstep
=
gui
.
selectMultiple
({
title
:
"请先择工作step"
,
size
:[
200
,
100
],
defaultsize
:[
200
,
100
],
list
:
steplists
.
map
(
function
(
v
){
var
tmp
=
{};
tmp
[
v
]
=
v
;
return
tmp
}),
defaultvalue
:
steps_tmp
,
columns
:
1
,
...
...
public_script/tmp3.js
0 → 100644
View file @
171681b2
saveMeans
({
job
:
job
,
step
:
pcs_step
,
chklist
:
oChecklistName
})
function
mkPath
(
path
,
list
)
{
if
(
list
.
length
)
{
var
newPath
=
path
+
'/'
+
list
.
shift
()
if
(
!
fs
.
dirExists
(
newPath
))
{
fs
.
mkdir
(
newPath
)}
return
mkPath
(
newPath
,
list
)
}
else
{
return
path
}
}
function
saveMeans
(
props
){
var
job
=
props
.
job
var
custstep
=
props
.
step
var
chklist
=
props
.
chklist
var
nact
=
props
.
nact
var
jobpath
=
GEN
.
getJobPath
({
job
:
job
})
var
filter
=
props
.
filter
var
afterPath
=
mkPath
(
jobpath
,
[
"user"
,
"opencam"
,
"steps"
])
var
steps
;
if
(
custstep
)
{
steps
=
[
custstep
]
}
else
{
steps
=
GEN
.
getStepList
({
job
:
job
})
}
if
(
!
steps
||
steps
.
length
==
0
){
return
}
steps
.
forEach
(
function
(
step
)
{
var
chkPath
=
mkPath
(
afterPath
,
[
step
,
"chk"
])
var
chks
if
(
chklist
)
{
chks
=
[
chklist
]}
else
{
chks
=
GEN
.
getChecklist
({
job
:
job
,
step
:
step
})
}
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
})
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
)
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'
,
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
())
}
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
})
}
}
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
)
}
fs
.
writeFile
(
nackPath
+
"/meas"
,
means
)
})
}
})
}
})
}
// 自定义信息
saveCustChk
({
job
:
job
,
custChk
:
custChk
})
function
saveCustChk
(
props
){
var
job
=
props
.
job
var
chkinfo
=
props
.
custChk
var
path
=
mkPath
(
GEN
.
getJobPath
({
job
:
job
}),
[
"user"
,
"opencam"
,
"steps"
])
chkinfo
.
forEach
(
function
(
chk
){
var
ckpath
=
mkPath
(
path
,
[
chk
.
step
,
"chk"
,
"custom_chk"
])
// 写入action hdr
fs
.
writeFile
(
ckpath
+
"/hdr"
,
"{
\n
\
\"
title
\"
:
\"
cust_chk
\"
,
\n
\
\"
sequence
\"
: 0
\n
\
}"
)
var
actionPath
=
mkPath
(
ckpath
,
[
"actions"
])
chk
.
action
.
forEach
(
function
(
action
,
i
){
var
nact
=
i
+
1
var
nactPath
=
mkPath
(
actionPath
,
[
nact
+
"-"
+
action
.
name
])
// nactPath 写入 meas hdr display
fs
.
writeFile
(
nactPath
+
"/hdr"
,
"{
\n
\
\"
title
\"
:
\"
"
+
(
nact
+
"-"
+
action
.
name
)
+
"
\"
,
\n
\
\"
sequence
\"
: "
+
nact
+
",
\n
\
\"
dfm_name
\"
:
\"
"
+
action
.
name
+
"
\"\n
\
}"
)
if
(
Array
.
isArray
(
action
.
meas
)){
action
.
meas
=
action
.
meas
.
map
(
function
(
mea
,
i
){
return
mea
+
" "
+
nact
+
" R "
+
String
(
i
+
1
)
})
action
.
meas
=
action
.
meas
.
join
(
"
\n
"
)
}
else
{
action
.
meas
=
action
.
meas
+
" "
+
nact
+
" G "
+
1
}
if
(
!
/string/ig
.
test
(
typeof
action
.
disp
)
)
{
action
.
disp
=
action
.
disp
.
workLayer
+
" "
+
nact
+
" "
+
action
.
disp
.
showLayers
.
join
(
" "
)
}
fs
.
writeFile
(
nactPath
+
"/disp"
,
action
.
disp
)
fs
.
writeFile
(
nactPath
+
"/meas"
,
action
.
meas
)
})
})
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment