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
b22f98b8
Commit
b22f98b8
authored
Oct 13, 2020
by
Scott Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scott
parent
9080de4b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
214 additions
and
107 deletions
+214
-107
20200929_wistarn.md
ats/topcam/20200929_wistarn.md
+7
-0
ATS_AIM_customer_data_analysis.js
ats/topcam/ATS_AIM_customer_data_analysis.js
+1
-2
ATS_AIM_data_format.js
ats/topcam/ATS_AIM_data_format.js
+16
-3
config_ats.js
ats/topcam/config_ats.js
+27
-19
emai.js
ats/topcam/emai.js
+3
-3
SEC_DRC_analysis.js
public_script/SEC_DRC_analysis.js
+0
-7
scotttest.js
public_script/scotttest.js
+160
-73
No files found.
ats/topcam/20200929_wistarn.md
View file @
b22f98b8
## wistarn
## wistarn
*
100 rule更改 ok
*
101 102 103(profile错误) 7z压缩包
*
104 多套gerber文件
*
106 107 113 147 无文件
*
114 profile 直接创建失败
*
136 139 144 多套数据
*
141 tgz+gerber多套
\ No newline at end of file
ats/topcam/ATS_AIM_customer_data_analysis.js
View file @
b22f98b8
...
@@ -1031,9 +1031,8 @@ try {
...
@@ -1031,9 +1031,8 @@ try {
})
})
});
});
var
err
=
mail
.
sendMail
({
var
err
=
mail
.
sendMail
({
host
:
'cshas.ats.net'
,
host
:
"10.90.79.37"
,
port
:
"25"
,
port
:
"25"
,
auth_method
:
mail
.
AuthMethod
.
LOGIN
,
connection_type
:
mail
.
ConnectionType
.
TCP
,
connection_type
:
mail
.
ConnectionType
.
TCP
,
// user:'ferre.zhang@cn.ats.net',
// user:'ferre.zhang@cn.ats.net',
// password:'159482673Sun',
// password:'159482673Sun',
...
...
ats/topcam/ATS_AIM_data_format.js
View file @
b22f98b8
...
@@ -128,7 +128,8 @@ try {
...
@@ -128,7 +128,8 @@ try {
}
}
}
}
if
(
/string/ig
.
test
(
typeof
(
mergeRule
.
drill
[
0
]))){
// drill层 计算
if
(
/string/ig
.
test
(
typeof
(
mergeRule
.
drill
[
0
]))){
// drill层 计算
var
drill_layers
=
[]
var
drill_layers
=
[];
var
tmp_layers
=
[];
var
matrix
=
GEN
.
getMatrix
({
job
:
job
})
var
matrix
=
GEN
.
getMatrix
({
job
:
job
})
// 计算最大值
// 计算最大值
var
layers
=
Object
.
keys
(
matrix
)
var
layers
=
Object
.
keys
(
matrix
)
...
@@ -144,6 +145,7 @@ try {
...
@@ -144,6 +145,7 @@ try {
var
tmp
=
reg
.
exec
(
v
)
var
tmp
=
reg
.
exec
(
v
)
var
num1
=
Number
(
tmp
[
1
])
var
num1
=
Number
(
tmp
[
1
])
var
num2
=
Number
(
tmp
[
2
])
var
num2
=
Number
(
tmp
[
2
])
tmp_layers
.
push
({
num1
:
num1
,
num2
:
num2
,
layer
:
v
})
if
(
num1
==
1
){
if
(
num1
==
1
){
drill_layers
.
push
({
num1
:
num1
,
num2
:
num2
,
layer
:
v
})
drill_layers
.
push
({
num1
:
num1
,
num2
:
num2
,
layer
:
v
})
}
}
...
@@ -152,6 +154,10 @@ try {
...
@@ -152,6 +154,10 @@ try {
}
}
})
})
var
max
=
maxnum
.
sort
(
function
(
a
,
b
){
return
b
-
a
})[
0
]
var
max
=
maxnum
.
sort
(
function
(
a
,
b
){
return
b
-
a
})[
0
]
if
(
drill_layers
.
length
>
0
&&
String
(
drill_layers
[
0
].
num2
)
==
"NaN"
)
{
var
maxLayer
=
tmp_layers
.
filter
(
function
(
v
)
{
return
v
.
num1
==
max
})
GEN
.
COM
(
"matrix_rename_layer"
,{
job
:
job
,
matrix
:
"matrix"
,
layer
:
maxLayer
[
0
].
layer
,
new_name
:
"drill"
})
}
var
drill_layer
=
drill_layers
.
filter
(
function
(
v
){
return
v
.
num2
==
max
})
var
drill_layer
=
drill_layers
.
filter
(
function
(
v
){
return
v
.
num2
==
max
})
if
(
drill_layer
.
length
){
if
(
drill_layer
.
length
){
drill_layer
=
drill_layer
[
0
].
layer
drill_layer
=
drill_layer
[
0
].
layer
...
@@ -204,7 +210,6 @@ try {
...
@@ -204,7 +210,6 @@ try {
profileRule
=
mergeRule
.
profile
profileRule
=
mergeRule
.
profile
}
}
}
}
// start martix_tl_name
// start martix_tl_name
console
.
log
(
"get matrix ====== ======== job:"
+
job
);
console
.
log
(
"get matrix ====== ======== job:"
+
job
);
var
matrix
=
GEN
.
getMatrix
({
job
:
job
});
var
matrix
=
GEN
.
getMatrix
({
job
:
job
});
...
@@ -600,6 +605,7 @@ function reName(props) { // 改名 par{job:要改名的料号, rule: {要改名
...
@@ -600,6 +605,7 @@ function reName(props) { // 改名 par{job:要改名的料号, rule: {要改名
}
}
function mergeLaser(props){ // 合并钻孔
function mergeLaser(props){ // 合并钻孔
var tmp = []
if(!props.mergeRule){return}
if(!props.mergeRule){return}
var mergeRuleRegs = props.mergeRule.regs
var mergeRuleRegs = props.mergeRule.regs
var mergeTlname = props.mergeRule.tl_name
var mergeTlname = props.mergeRule.tl_name
...
@@ -644,12 +650,18 @@ function mergeLaser(props){ // 合并钻孔
...
@@ -644,12 +650,18 @@ function mergeLaser(props){ // 合并钻孔
newdrills.push(layerName.toLowerCase())
newdrills.push(layerName.toLowerCase())
}
}
GEN.workLayer({name:layerName.toLowerCase(),display_number:1,clear_before:'yes'});
GEN.workLayer({name:layerName.toLowerCase(),display_number:1,clear_before:'yes'});
GEN.copyLayer({source_job:job ,mode:'append',source_step:step,source_layer:val.name,dest_layer:layerName.toLowerCase()});
GEN.copyLayer({source_job:job ,mode:'append',source_step:step,source_layer:val.name,dest_layer:layerName.toLowerCase()});
if(/drl|drill/ig.test(val.name) && tmp.indexOf(val.name) < 0) {
tmp.push(val.name)
}
})
})
}
}
}
}
GEN.affectedLayer({affected:"
no
",mode:"
all
"});
GEN.affectedLayer({affected:"
no
",mode:"
all
"});
GEN.clearLayers();
GEN.clearLayers();
tmp.forEach(function(layer) {
GEN.COM("
matrix_rename_layer
,
job
=
"+job+"
,
matrix
=
matrix
,
layer
=
"+layer+"
,
new_name
=
"+layer.replace(/drl|drill/, "
merage
"))
})
GEN.closeStep();
GEN.closeStep();
return newdrills
return newdrills
}
}
...
@@ -678,6 +690,7 @@ function createOutline(props){
...
@@ -678,6 +690,7 @@ function createOutline(props){
GEN.openStep({job:job, name:step})
GEN.openStep({job:job, name:step})
GEN.affectedLayer({affected:'yes',layer:drill_layer})
GEN.affectedLayer({affected:'yes',layer:drill_layer})
GEN.selCopyOther({dest:'layer_name',target_layer:tmp,invert:'no',dx:0,dy:0,size:0})
GEN.selCopyOther({dest:'layer_name',target_layer:tmp,invert:'no',dx:0,dy:0,size:0})
GEN.affectedLayer({affected:'no',mode:'all'})
GEN.closeStep()
GEN.closeStep()
var tmp_outline
var tmp_outline
...
...
ats/topcam/config_ats.js
View file @
b22f98b8
...
@@ -190,8 +190,8 @@
...
@@ -190,8 +190,8 @@
"Excellon2_4"
:
{
"Excellon2_4"
:
{
"nf1"
:
2
,
"nf1"
:
2
,
"nf2"
:
3
,
"nf2"
:
3
,
"units"
:
"
mm
"
,
"units"
:
"
inch
"
,
"zeroes"
:
"
lead
ing"
,
"zeroes"
:
"
trail
ing"
,
"decimal"
:
"no"
,
"decimal"
:
"no"
,
"nf_comp"
:
0
,
"nf_comp"
:
0
,
"break_sr"
:
"yes"
,
"break_sr"
:
"yes"
,
...
@@ -201,7 +201,7 @@
...
@@ -201,7 +201,7 @@
"drill_only"
:
"no"
,
"drill_only"
:
"no"
,
"multiplier"
:
1
,
"multiplier"
:
1
,
"resolution"
:
3
,
"resolution"
:
3
,
"tool_units"
:
"
mm
"
,
"tool_units"
:
"
inch
"
,
"coordinates"
:
"absolute"
,
"coordinates"
:
"absolute"
,
"merge_by_rule"
:
"no"
,
"merge_by_rule"
:
"no"
,
"signed_coords"
:
"no"
,
"signed_coords"
:
"no"
,
...
@@ -828,7 +828,7 @@
...
@@ -828,7 +828,7 @@
{
{
"valid"
:
function
(
props
){
"valid"
:
function
(
props
){
var
file
=
props
.
file
;
var
file
=
props
.
file
;
return
/.+
\.
ger$/ig
.
test
(
file
.
name
)
||
/
\.
gdo$|
\.
bol$|
\.
gdo$|
\.
pma$|
\.
sma$|
\.
smb$|
\.
ssa$|
\.
ssb$/ig
.
test
(
file
.
name
)
||
return
/.+
\.
ger$/ig
.
test
(
file
.
name
)
||
/
\.
pho$|
\.
bol$|
\.
gdo$|
\.
pma$|
\.
pmb$|
\.
spa$|
\.
spb$
\.
sma$|
\.
smb$|
\.
ssa$|
\.
ssb$/ig
.
test
(
file
.
name
)
||
/.+
\.
l
\d
+$/ig
.
test
(
file
.
name
)
/.+
\.
l
\d
+$/ig
.
test
(
file
.
name
)
},
},
"type"
:
"Gerber274x"
,
"type"
:
"Gerber274x"
,
...
@@ -943,25 +943,33 @@
...
@@ -943,25 +943,33 @@
}
}
],
],
"tl_name"
:
[
"tl_name"
:
[
{
"orig_name"
:
[
"^pmt
\\
.art$"
,
"
\\
.pma$
"
,
"SoldPasteTop
\\
.ger
"
,
"past_top"
],
"tl_name"
:
"past_top"
},
{
"orig_name"
:
[
"^pmt
\\
.art$"
,
"
\\
.pma$
|
\\
.spa$"
,
"paste.top|soldPasteTop|pastemask.?top
"
,
"past_top"
],
"tl_name"
:
"past_top"
},
{
"orig_name"
:
[
"^pmb
\\
.art$"
,
"
\\
.pmb$
"
,
"SoldPasteBot
\\
.ger
"
,
"past_botm"
],
"tl_name"
:
"past_botm"
},
{
"orig_name"
:
[
"^pmb
\\
.art$"
,
"
\\
.pmb$
|
\\
.spb$"
,
"paste.bot|soldPasteBot|pastemask.?bot
"
,
"past_botm"
],
"tl_name"
:
"past_botm"
},
{
"orig_name"
:
[
"tsilk"
,
"^sst
\\
.art$"
,
"
\\
.ssa$"
,
"
SilkScrnTop
\\
.ger"
,
"silk_
top"
],
"tl_name"
:
"silk_top"
},
{
"orig_name"
:
[
"tsilk"
,
"^sst
\\
.art$"
,
"
\\
.ssa$"
,
"
silkscrntop|silkscreentop"
,
"silk.top|silk-
top"
],
"tl_name"
:
"silk_top"
},
{
"orig_name"
:
[
"bsilk"
,
"^ssb
\\
.art$"
,
"
\\
.ssb$"
,
"
SilkScrnBot
\\
.ger"
,
"silk_
bot"
],
"tl_name"
:
"silk_bot"
},
{
"orig_name"
:
[
"bsilk"
,
"^ssb
\\
.art$"
,
"
\\
.ssb$"
,
"
silkscrnbot|silkscreenbot"
,
"silk.bot|silk-
bot"
],
"tl_name"
:
"silk_bot"
},
{
"orig_name"
:
[
"tmask"
,
"^smt
\\
.art$"
,
"
\\
.sma$"
,
"
SoldMask1Top
\\
.ger"
,
"sm_
top"
],
"tl_name"
:
"sm_top"
},
{
"orig_name"
:
[
"tmask"
,
"^smt
\\
.art$"
,
"
\\
.sma$"
,
"
soldmask1top|soldermask.?top"
,
"sm.top|solder.
top"
],
"tl_name"
:
"sm_top"
},
{
"orig_name"
:
[
"bmask"
,
"^smb
\\
.art$"
,
"
\\
.smb$"
,
"
SoldMask1Bot
\\
.ger"
,
"sm_
bot"
],
"tl_name"
:
"sm_botm"
},
{
"orig_name"
:
[
"bmask"
,
"^smb
\\
.art$"
,
"
\\
.smb$"
,
"
soldmask1bot|soldermask.?bot"
,
"sm.bot|solder.
bot"
],
"tl_name"
:
"sm_botm"
},
{
"orig_name"
:
[
"^
top$"
,
"^top
.art$"
],
"tl_name"
:
"top"
},
{
"orig_name"
:
[
"^
(?:(?!assy|enig|pm|past|paste|silk|mask).)+top
\\
.(pho|art)$"
,
"^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"
:
[
"^
(?:(?!ref).)+l(
\\
d)
\\
.art$"
,
"-(
\\
d+)l
\\
.pho$"
,
"^
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"
:
[
"^
(?:(?!assy|enig|pm|past|paste|silk|mask).)+bot
\\
.(pho|art)$"
,
"^
bot
\\
.art$"
,
"^bottom$"
,
"^bottom.art$"
],
"tl_name"
:
"bottom"
},
{
"orig_name"
:
[
"
\\
.d(
\\
d+)$"
],
"tl_name"
:
"d_($1)-($1+1)"
},
{
"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"
:
[
"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"
:
[
"
(
\\
d+)-(
\\
d+)-np
\\
.drl$"
,
"
ThruHoleNonPlated
\\
.ncd$"
,
"^drill$"
],
"tl_name"
:
"drill"
},
{
"orig_name"
:
[
"
\\
.rou$"
,
"^rout$"
],
"tl_name"
:
"rout"
},
{
"orig_name"
:
[
"
\\
.rou$"
,
"^rout$"
],
"tl_name"
:
"rout"
},
{
"orig_name"
:
"fab.art"
,
"tl_name"
:
"fab.art"
},
{
"orig_name"
:
"fab.art"
,
"tl_name"
:
"fab.art"
},
{
"orig_name"
:
[
"multipack.art"
,
"^array$"
],
"tl_name"
:
"array"
},
{
"orig_name"
:
[
"multipack
\\
.art"
,
"^array$"
],
"tl_name"
:
"array"
},
{
"orig_name"
:
[
"outline
\\
.art$"
,
"
\\
.bol$"
,
"PnlContourNonPlated
\\
.ger"
,
"^outline"
],
"tl_name"
:
"outline"
},
{
"orig_name"
:
[
"p_outline
\\
.art"
,
"panel
\\
.art$"
,
"paneloutline
\\
.pho"
,
"outline
\\
.art$"
,
"
\\
.bol$"
,
"PnlContourNonPlated
\\
.ger"
,
"^outline"
],
"tl_name"
:
"outline"
},
{
"orig_name"
:
[
"top-enig"
,
"enig_top"
],
"tl_name"
:
"enig_top"
},
{
"orig_name"
:
[
"topside-golden"
,
"top-enig"
,
"enig_top"
],
"tl_name"
:
"enig_top"
},
{
"orig_name"
:
[
"bot-enig"
,
"enig_bot"
],
"tl_name"
:
"enig_bot"
},
{
"orig_name"
:
[
"botside-golden"
,
"bot-enig"
,
"enig_bot"
],
"tl_name"
:
"enig_bot"
},
]
],
"mergerule"
:
{
profile
:[
"silk_top"
],
drill
:[
"(
\\
d+)-(
\\
d+)
\\
.drl$"
,
"
\\
.d(
\\
d+)$"
],
laser
:
{
tl_name
:
"drill($1)-($2)"
,
regs
:
[
"(
\\
d+)-(
\\
d+)
\\
.drl$"
]
}
}
},
},
"Vivo"
:{
"Vivo"
:{
"step"
:
"cad"
,
"step"
:
"cad"
,
...
...
ats/topcam/emai.js
View file @
b22f98b8
...
@@ -3,10 +3,10 @@ var error = require('topsin.error');
...
@@ -3,10 +3,10 @@ var error = require('topsin.error');
var
err
=
mail
.
sendMail
({
var
err
=
mail
.
sendMail
({
// host:'smtp.exmail.qq.com',
// host:'smtp.exmail.qq.com',
// host:'cshas.ats.net',
// host:'cshas.ats.net',
host
:
"
cshas.ats.net
"
,
host
:
"
10.90.79.37
"
,
port
:
"25"
,
port
:
"25"
,
// auth_method:mail.AuthMethod.LOGIN,
// auth_method:mail.AuthMethod.LOGIN,
//
connection_type:mail.ConnectionType.TCP,
connection_type
:
mail
.
ConnectionType
.
TCP
,
// user: "ferre.zhang@cn.ats.net",
// user: "ferre.zhang@cn.ats.net",
// user:'scott.sun@topibd.com',
// user:'scott.sun@topibd.com',
// password:'159482673Sun',
// password:'159482673Sun',
...
...
public_script/SEC_DRC_analysis.js
View file @
b22f98b8
...
@@ -487,13 +487,6 @@ try {
...
@@ -487,13 +487,6 @@ try {
GEN
.
closeStep
()
GEN
.
closeStep
()
})
})
...
...
public_script/scotttest.js
View file @
b22f98b8
...
@@ -5,9 +5,15 @@ PARAMETER:
...
@@ -5,9 +5,15 @@ PARAMETER:
[
[
{
{
name : 'step',
name : 'step',
title : 'step',
title : '
操作
step',
type : 'LineEdit',
type : 'LineEdit',
property : {tool_tip : '目标step,默认是orig'},
property : {tool_tip : '操作step,默认是net'},
},
{
name : 'cutting_marign',
title : '切除profile外数值',
type : 'LineEdit',
property : {tool_tip : '切除profile外数值,默认是0.2mm'},
},
},
{
{
name : 'auto_save',
name : 'auto_save',
...
@@ -24,16 +30,16 @@ PARAMETER:
...
@@ -24,16 +30,16 @@ PARAMETER:
]
]
VERSION_HISTORY:
VERSION_HISTORY:
V1.00 2020-0
9-01
Scott Sun
V1.00 2020-0
4-20
Scott Sun
1.新版本
1.新版本
HELP:
HELP:
<html><body bgcolor="#DDECFE">
<html><body bgcolor="#DDECFE">
<font size="3" color="#003DB2"><p>功能简介</p></font>
<font size="3" color="#003DB2"><p>功能简介</p></font>
<p>
标题
</p>
<p>
删除板外
</p>
<br>
<br>
<font size="3" color="#003DB2"><p>参数配置</p></font>
<font size="3" color="#003DB2"><p>参数配置</p></font>
<p>
step信息
</p>
<p>
切除值
</p>
<br>
<br>
<font size="3" color="#003DB2"><p>注意事项</p></font>
<font size="3" color="#003DB2"><p>注意事项</p></font>
<p> 无 </p>
<p> 无 </p>
...
@@ -42,15 +48,13 @@ PARAMETER:
...
@@ -42,15 +48,13 @@ PARAMETER:
*/
*/
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
console
.
log
(
"==============================>
template
"
);
console
.
log
(
"==============================>
删除板外
"
);
// 引入模块 包
// 引入模块 包
var
$
=
require
(
'topcam.scriptfunc'
).
argv
();
var
$
=
require
(
'topcam.scriptfunc'
).
argv
();
var
fs
=
require
(
'fs'
);
var
fs
=
require
(
'fs'
);
var
_
=
require
(
'lodash'
);
var
_
=
require
(
'lodash'
);
var
mode
=
$
.
ikm
?
"topcam"
:
"aimdfm"
;
var
mode
=
$
.
ikm
?
"topcam"
:
"aimdfm"
;
var
IKM
=
$
.
ikm
;
var
IKM
=
$
.
ikm
;
require
(
"topsin.genmath"
)
var
genMath
=
new
GenMath
();
if
(
IKM
==
undefined
)
{
IKM
=
require
(
'topcam.ikm6'
)(
$
)
}
if
(
IKM
==
undefined
)
{
IKM
=
require
(
'topcam.ikm6'
)(
$
)
}
var
GEN
=
$
.
gen
;
var
GEN
=
$
.
gen
;
var
GUI
=
$
.
gui
||
{};
var
GUI
=
$
.
gui
||
{};
...
@@ -58,91 +62,174 @@ var Job = $.job || $.job_name;
...
@@ -58,91 +62,174 @@ var Job = $.job || $.job_name;
var
JobId
=
$
.
job_id
;
var
JobId
=
$
.
job_id
;
var
db
=
$
.
db
||
IKM
.
db
var
db
=
$
.
db
||
IKM
.
db
var
PAR
=
{}
var
PAR
=
{}
if
(
$
.
par
)
{
PAR
=
$
.
par
}
else
if
(
$
.
hasOwnProperty
(
'script_parameter'
)){
PAR
=
JSON
.
parse
(
$
.
script_parameter
);
}
if
(
$
.
par
)
{
PAR
=
$
.
par
}
else
if
(
$
.
hasOwnProperty
(
'script_parameter'
)){
PAR
=
JSON
.
parse
(
$
.
script_parameter
);
}
if
(
mode
===
"aimdfm"
)
{
if
(
mode
===
"aimdfm"
)
{
var
database
=
require
(
"topsin.database"
);
var
database
=
require
(
"topsin.database"
);
database
.
addConnection
(
$
.
conf
.
database_conf
,
"DFM"
);
database
.
addConnection
(
$
.
conf
.
database_conf
,
"DFM"
);
var
QDfm
=
database
.
query
(
"DFM"
);
var
QDfm
=
database
.
query
(
"DFM"
);
$
.
QDfm
=
QDfm
;
$
.
QDfm
=
QDfm
;
if
(
$
.
conf
.
product_type
==
"aimdfm"
)
{
if
(
$
.
conf
.
product_type
==
"aimdfm"
)
{
QDfm
.
updateRow
({
table
:
"pdm_aimdfm_task"
,
data
:
{
current_process_title
:
$
.
process_title
},
where
:
{
id
:
$
.
task_id
}
});
QDfm
.
updateRow
({
table
:
"pdm_aimdfm_task"
,
data
:
{
current_process_title
:
$
.
process_title
},
where
:
{
id
:
$
.
task_id
}
});
}
}
}
}
var
Status
=
'ok'
;
var
Status
=
'ok'
;
var
resultData
=
[];
var
resultData
=
[];
var
par
=
PAR
;
var
default_par
=
{
step
:
"orig"
,
auto_save
:
"No"
,
units
:
"mm"
}
for
(
var
key
in
default_par
){
if
(
!
par
.
hasOwnProperty
(
key
)
||
par
[
key
]
==
""
){
par
[
key
]
=
default_par
[
key
]
}}
var
job
=
Job
;
try
{
try
{
if
(
_
.
isEmpty
(
job
)){
throw
"参数job不存在"
}
else
{
job
=
job
.
toLowerCase
()
}
var
par
=
PAR
;
var
default_par
=
{
step
:
"net"
,
cutting_marign
:
"0.2mm"
,
auto_save
:
"No"
,
}
for
(
var
key
in
default_par
){
// 设置默认属性
if
(
!
par
.
hasOwnProperty
(
key
)
||
par
[
key
]
==
""
){
par
[
key
]
=
default_par
[
key
]
}
}
par
.
cutting_marign
=
parseFloat
(
par
.
cutting_marign
)
if
(
!
/^
(([^
0
][
0-9
]
+|0
)\.([
0-9
]{1,2})
$
)
|^
([^
0
][
0-9
]
+|0
)
$/ig
.
test
(
par
.
cutting_marign
)){
throw
"cutting_marign failed"
}
var
cutting_marign_symbol
=
"r"
+
String
(
par
.
cutting_marign
*
1000
)
if
(
_
.
isEmpty
(
Job
)){
throw
"参数Job不存在"
}
var
job
=
"08ha0010hq0a0"
if
(
!
GEN
.
isJobExists
({
job
:
job
})){
throw
"料号"
+
job
+
"不存在"
}
if
(
!
GEN
.
isJobExists
({
job
:
job
})){
throw
"料号"
+
job
+
"不存在"
}
if
(
!
GEN
.
isJobOpen
({
job
:
job
})){
GEN
.
openJob
({
job
:
job
})
}
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"
})
}
}
if
(
mode
==
"aimdfm"
){
var
stepList
=
GEN
.
getStepList
({
job
:
job
})
if
(
GEN
.
checkInout
({
job
:
job
,
mode
:
"test"
})
!=
0
){
throw
"the job check"
}
stepList
=
stepList
.
filter
(
function
(
step
){
GEN
.
checkInout
({
job
:
job
,
mode
:
"out"
});
var
reg
=
new
RegExp
(
par
.
step
,
"ig"
)
}
return
reg
.
test
(
step
)
// 通过matrix获取board层
var
matrix
=
GEN
.
getMatrix
({
job
:
job
})
var
board_layers
=
Object
.
keys
(
matrix
).
reduce
(
function
(
a
,
b
){
if
(
matrix
[
b
].
context
==
"board"
){
a
.
push
(
b
)
}
return
a
},[])
var
all_layers
=
Object
.
keys
(
matrix
)
var
outline_layer
=
[
"gko"
,
"gm1"
,
"ol"
]
outline_layer
=
outline_layer
.
filter
(
function
(
v
){
return
all_layers
.
indexOf
(
v
)
>=
0
})
})
stepList
.
forEach
(
function
(
step
){
// 影响board层
GEN
.
openStep
({
job
:
job
,
name
:
step
})
var
steplist
=
GEN
.
getStepList
({
job
:
job
})
GEN
.
clearLayers
();
//清除层显示
steplist
=
steplist
.
filter
(
function
(
v
){
GEN
.
affectedLayer
({
mode
:
'all'
,
affected
:
'no'
});
//设置影响层全部不影响
var
tmpreg
=
new
RegExp
(
par
.
step
,
"ig"
)
GEN
.
COM
(
"sel_options,clear_mode=clear_after,display_mode=all_layers,area_inout=inside,area_select=select,select_mode=standard,area_touching_mode=exclude"
);
return
tmpreg
.
test
(
v
)
GEN
.
units
({
type
:
par
.
units
});
GEN
.
zoomHome
();
var
feas
=
GEN
.
getFeatures
({
job
:
job
,
step
:
step
,
layer
:
"tmp"
,
surface
:
1
,
units
:
"mm"
})
IKM
.
msg
(
featsToLimits
(
feas
))
})
})
steplist
.
forEach
(
function
(
step
){
GEN
.
openStep
({
job
:
job
,
name
:
step
})
GEN
.
units
({
type
:
"mm"
})
var
outline_tmp
=
"outline_tmp"
// 创建outline参考层
if
(
GEN
.
isLayerExists
({
job
:
job
,
layer
:
outline_tmp
})){
GEN
.
deleteLayer
({
job
:
job
,
layer
:
outline_tmp
})
}
GEN
.
COM
(
"profile_to_rout,layer="
+
outline_tmp
+
",width=1"
)
GEN
.
clearLayers
()
// 切除profile以外0.2mm(cutting_marign)物件
board_layers
.
forEach
(
function
(
layer
){
if
(
outline_layer
.
indexOf
(
layer
)
<
0
){
GEN
.
affectedLayer
({
affected
:
"no"
,
mode
:
"all"
})
// GEN.workLayer({name:layer,display_number:1,clear_before:'yes'});
// GEN.clipArea({layers_mode:'affected_layers',area:'profile',inout:'outside',margin:0,contour_cut:'no'});
GEN
.
workLayer
({
name
:
layer
,
display_number
:
2
,
clear_before
:
'yes'
})
GEN
.
selectByFilter
({
profile
:
"out"
})
// GEN.selRefFeat({layers:outline_tmp,use:'filter',mode:'include'});
if
(
GEN
.
getSelectCount
()
>
0
){
GEN
.
selDelete
()}
GEN
.
COM
(
"clip_area_strt"
)
GEN
.
COM
(
"clip_area_end,layers_mode=affected_layers,layer=,area=profile,area_type=rectangle,inout=outside,contour_cut=yes,margin=0,feat_types=line
\
;pad
\
;surface
\
;arc
\
;text"
)
// var outline_ref = 'ol_tl_tmp';
// var tmp_work_layer = '_tmp_work_layer';
// if(GEN.isLayerExists({job:job,layer:tmp_work_layer})){
// GEN.deleteLayer({job:job,layer:[tmp_work_layer],step:step})
// }
// if(GEN.isLayerExists({job:job,layer:outline_ref})){
// GEN.deleteLayer({job:job,layer:[outline_ref],step:step})
// }
// GEN.createLayer({job:job,layer:tmp_work_layer,conext:'misc',type:'document',delete_exists:"yes"})
// GEN.createLayer({job:job,layer:outline_ref,conext:'misc',type:'document',delete_exists:"yes"})
// GEN.workLayer({name:outline_tmp,display_number:2,clear_before:'yes'})
// GEN.selCopyOther({dest:'layer_name',target_layer:outline_ref,invert:'no',dx:0,dy:0,size:0})
// GEN.affectedLayer({affected:'yes',layer:[outline_ref],clear_before:'yes'});
// GEN.COM('sel_resize',{size:200,corner_ctl:'no'});
// GEN.workLayer({name:layer,display_number:2,clear_before:'yes'})
// GEN.selRefFeat({layers:outline_ref,use:'filter',mode:'cover'});
// if ( GEN.getSelectCount() > 0 ) {
// GEN.selCopyOther({dest:'layer_name',target_layer:tmp_work_layer,invert:'no',dx:0,dy:0,size:0});
// GEN.affectedLayer({affected:'yes',mode:'single',layer:tmp_work_layer,clear_before:'yes'});
// GEN.COM('sel_all_feat');
// GEN.selChangeSym({symbol:'r1'});
// GEN.affectedLayer({affected:'yes',mode:'single',layer:outline_ref,clear_before:'yes'});
// GEN.COM('sel_all_feat');
// GEN.selChangeSym({symbol:'r2'});
// GEN.affectedLayer({affected:'yes',mode:'single',layer:tmp_work_layer,clear_before:'yes'});
// GEN.selRefFeat({layers:outline_ref,use:'filter',mode:'cover'});
// GEN.selReverse();
// if ( GEN.getSelectCount() > 0 ){GEN.selDelete() };
// GEN.affectedLayer({affected:'yes',mode:'single',layer:layer,clear_before:'yes'});
// GEN.selRefFeat({layers:tmp_work_layer,use:'filter',mode:'include'});
// if ( GEN.getSelectCount() > 0 ){GEN.selDelete() };
// }
// GEN.deleteLayer({job:job,layer:[outline_ref,tmp_work_layer]});
}
})
GEN
.
affectedLayer
({
affected
:
'no'
,
mode
:
'all'
})
GEN
.
deleteLayer
({
job
:
job
,
layer
:[
outline_tmp
]})
})
// 保存
// 保存
if
(
/yes/ig
.
test
(
par
.
auto_save
)){
GEN
.
checkInout
({
job
:
job
,
mode
:
"out"
});
GEN
.
saveJob
({
job
:
job
});
GEN
.
checkInout
({
job
:
job
,
mode
:
"in"
});
GEN
.
closeJob
({
job
:
job
});}
else
{
GEN
.
checkInout
({
job
:
job
,
mode
:
"in"
})}
if
(
/yes/ig
.
test
(
par
.
auto_save
)){
if
(
mode
===
"aimdfm"
)
{
GEN
.
checkInout
({
job
:
job
,
mode
:
"out"
})
// 结束保存料号 关闭料号
$
.
QDfm
.
updateRow
({
table
:
"pdm_aimdfm_task"
,
data
:
{
progress
:
33.33
},
where
:
{
id
:
$
.
task_id
}});
GEN
.
saveJob
({
job
:
job
});
if
(
GEN
.
hasError
())
{
Status
=
'error'
;
resultData
.
push
({
type
:
"error"
,
title
:
"GEN错误!"
,
detail
:
[{
desc
:
_
.
join
(
GEN
.
STATUS
,
"
\n
"
)
}]
});
GEN
.
checkInout
({
job
:
job
,
mode
:
"in"
})
return
{
status
:
Status
,
result_data
:
resultData
};
GEN
.
closeJob
({
job
:
job
})
}
else
{
resultData
.
push
({
type
:
"info"
,
title
:
"操作完成, 请注意检查!"
});
return
{
status
:
Status
,
result_data
:
resultData
};
}
}
else
{
}
else
{
return
"Done"
}
GEN
.
checkInout
({
job
:
job
,
mode
:
"in"
})
}
if
(
mode
===
"aimdfm"
)
{
$
.
QDfm
.
updateRow
({
table
:
"pdm_aimdfm_task"
,
data
:
{
progress
:
33.33
},
where
:
{
id
:
$
.
task_id
}
});
if
(
GEN
.
hasError
())
{
Status
=
'error'
;
resultData
.
push
({
type
:
"error"
,
title
:
"GEN错误!"
,
detail
:
[{
desc
:
_
.
join
(
GEN
.
STATUS
,
"
\n
"
)
}]
});
return
{
status
:
Status
,
result_data
:
resultData
};
}
else
{
resultData
.
push
({
type
:
"info"
,
title
:
"操作完成, 请注意检查!"
});
return
{
status
:
Status
,
result_data
:
resultData
};
}
}
else
{
return
"Done"
}
}
catch
(
e
)
{
}
catch
(
e
)
{
IKM
.
msg
(
_
.
join
(
GEN
.
STATUS
,
"
\n
"
));
IKM
.
msg
(
e
);
Status
=
'error'
;
IKM
.
msg
(
_
.
join
(
GEN
.
STATUS
,
"
\n
"
))
IKM
.
msg
(
e
)
Status
=
'error'
;
resultData
.
push
({
type
:
"error"
,
title
:
"脚本执行出错!"
,
detail
:
[{
desc
:
_
.
toString
(
e
)}]});
resultData
.
push
({
type
:
"error"
,
title
:
"脚本执行出错!"
,
detail
:
[{
desc
:
_
.
toString
(
e
)}]});
return
(
mode
===
"aimdfm"
)
?
{
status
:
Status
,
result_data
:
resultData
}
:
"Error"
;
return
(
mode
===
"aimdfm"
)
?
{
status
:
Status
,
result_data
:
resultData
}
:
"Error"
;
}
}
function
featsToLimits
(
feats
)
{
feats
.
forEach
(
function
(
item
)
{
if
(
item
.
feats
)
{
var
polygon
=
genMath
.
profile2Polygon
(
item
.
feats
.
join
(
"
\n
"
),
0
)
var
res
=
polygon
.
reduce
(
function
(
a
,
b
){
a
.
xmin
=
b
.
x
>
a
.
xmin
?
a
.
xmin
:
b
.
x
;
a
.
ymin
=
b
.
y
>
a
.
ymin
?
a
.
ymin
:
b
.
y
;
a
.
xmax
=
b
.
x
<
a
.
xmax
?
a
.
xmax
:
b
.
x
;
a
.
ymax
=
b
.
y
<
a
.
ymax
?
a
.
ymax
:
b
.
y
;
return
a
},
{
xmin
:
polygon
[
0
].
x
,
ymin
:
polygon
[
0
].
y
,
xmax
:
polygon
[
0
].
x
,
ymax
:
polygon
[
0
].
y
})
res
.
xsize
=
Math
.
abs
(
res
.
xmax
-
res
.
xmin
)
res
.
ysize
=
Math
.
abs
(
res
.
ymax
-
res
.
ymin
)
res
.
xc
=
res
.
xmin
+
res
.
xsize
/
2
res
.
yc
=
res
.
ymin
+
res
.
ysize
/
2
item
.
limits
=
res
}
})
return
feats
}
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