Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
A
ats_cam_script
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
ats_cam_script
Commits
f9173440
Commit
f9173440
authored
Oct 17, 2022
by
Scott Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s
parent
9e0658fe
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
383 additions
and
96 deletions
+383
-96
ATS_rout_break_connect.js
rout/ATS_rout_break_connect.js
+75
-38
ATS_rout_optimize_connect.js
rout/ATS_rout_optimize_connect.js
+308
-58
No files found.
rout/ATS_rout_break_connect.js
View file @
f9173440
...
@@ -117,39 +117,48 @@ try {
...
@@ -117,39 +117,48 @@ try {
throw
"没有找到工作层"
throw
"没有找到工作层"
}
}
var
drls
=
getLayer
({
layer_type
:
"drill"
,
context
:
"board"
})
var
specialAttr
=
".drill_noopt"
stepList
.
forEach
(
function
(
step
)
{
stepList
.
forEach
(
function
(
step
)
{
//
GEN.openStep({ job: job, name: step });
GEN
.
openStep
({
job
:
job
,
name
:
step
});
//
GEN.clearLayers(); //清除层显示
GEN
.
clearLayers
();
//清除层显示
//
GEN.affectedLayer({ mode: 'all', affected: 'no' }); //设置影响层全部不影响
GEN
.
affectedLayer
({
mode
:
'all'
,
affected
:
'no'
});
//设置影响层全部不影响
//
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");
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"
);
//
GEN.units({ type: par.units }); //单位初始化
GEN
.
units
({
type
:
par
.
units
});
//单位初始化
//
GEN.zoomHome(); //窗口显示回到原始位置
GEN
.
zoomHome
();
//窗口显示回到原始位置
//
GEN.selClearFeature()
GEN
.
selClearFeature
()
workLayers
.
forEach
(
function
(
layer
)
{
workLayers
.
forEach
(
function
(
layer
)
{
// todo GEN.workLayer({name:layer, clear_before:"yes"})
// 前处理 将特殊钻孔和层的线弧拷贝到辅助层
// 前处理 将特殊钻孔和层的线弧拷贝到辅助层
drls
.
forEach
(
function
(
drl
)
{
GEN
.
workLayer
({
name
:
drl
,
clear_before
:
"yes"
})
GEN
.
selectByFilter
({
feat_types
:
"pad"
,
attribute
:
specialAttr
})
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selCopyOther
({
dest
:
"layer_name"
,
target_layer
:
layer
})
}
})
GEN
.
workLayer
({
name
:
layer
,
clear_before
:
"yes"
})
delLayer
([
"tmp"
,
layer
+
"_tmp"
])
// 1. 找特殊钻孔 计算特殊钻孔间距 小于xxx的为一组
// 1. 找特殊钻孔 计算特殊钻孔间距 小于xxx的为一组
layer
=
GEN
.
getWorkLayer
()
GEN
.
selectByFilter
({
feat_types
:
"pad"
,
attribute
:
specialAttr
})
GEN
.
selectByFilter
({
feat_types
:
"pad"
,
attribute
:
".smd"
})
if
(
GEN
.
getSelectCount
()
>
0
)
{
if
(
GEN
.
getSelectCount
()
>
0
)
{
var
feats
=
GEN
.
getFeatures
({
job
:
job
,
step
:
step
,
layer
:
layer
,
units
:
"mm"
,
options
:
"select+feat_index"
})
var
feats
=
GEN
.
getFeatures
({
job
:
job
,
step
:
step
,
layer
:
layer
,
units
:
"mm"
,
options
:
"select+feat_index"
})
GEN
.
selClearFeature
()
;
GEN
.
selClearFeature
()
feats
.
forEach
(
function
(
feat
)
{
feats
.
forEach
(
function
(
feat
,
i1
)
{
feats
.
forEach
(
function
(
feat2
)
{
feats
.
forEach
(
function
(
feat2
,
i2
)
{
if
(
feat
.
index
!=
feat2
.
index
)
{
if
(
feat
.
index
!=
feat2
.
index
&&
i2
>
i1
)
{
var
p2p
=
Math
.
sqrt
((
feat2
.
x
-
feat
.
x
)
*
(
feat2
.
x
-
feat
.
x
)
+
(
feat2
.
y
-
feat
.
y
)
*
(
feat2
.
y
-
feat
.
y
))
var
p2p
=
Math
.
sqrt
((
feat2
.
x
-
feat
.
x
)
*
(
feat2
.
x
-
feat
.
x
)
+
(
feat2
.
y
-
feat
.
y
)
*
(
feat2
.
y
-
feat
.
y
))
if
(
p2p
>
2
&&
p2p
<
5
)
{
if
(
p2p
>
2
&&
p2p
<
5
)
{
GEN
.
workLayer
({
name
:
layer
,
clear_before
:
"yes"
})
GEN
.
workLayer
({
name
:
layer
,
clear_before
:
"yes"
})
GEN
.
selLayerFeat
({
layer
:
layer
,
index
:
feat
.
index
,
operation
:
"select"
})
GEN
.
selLayerFeat
({
layer
:
layer
,
index
:
feat
.
index
,
operation
:
"select"
})
GEN
.
selLayerFeat
({
layer
:
layer
,
index
:
feat2
.
index
,
operation
:
"select"
})
GEN
.
selLayerFeat
({
layer
:
layer
,
index
:
feat2
.
index
,
operation
:
"select"
})
delLayer
([
"tmp"
])
GEN
.
selCopyOther
({
dest
:
"layer_name"
,
target_layer
:
"tmp"
,
size
:
2000
})
GEN
.
selCopyOther
({
dest
:
"layer_name"
,
target_layer
:
"tmp"
,
size
:
2000
})
GEN
.
workLayer
({
name
:
"tmp"
,
clear_before
:
"yes"
})
GEN
.
workLayer
({
name
:
"tmp"
,
clear_before
:
"yes"
})
GEN
.
PAUSE
(
0
)
GEN
.
selRefFeat
({
layers
:
layer
,
use
:
"filter"
,
mode
:
"touch"
})
GEN
.
selRefFeat
({
layers
:
layer
,
use
:
"filter"
,
mode
:
"touch"
})
if
(
GEN
.
getSelectCount
()
>
0
)
{
if
(
GEN
.
getSelectCount
()
>
0
)
{
var
line
=
{
xs
:
feat
.
x
,
ys
:
feat
.
y
,
xe
:
feat2
.
x
,
ye
:
feat2
.
y
,
symbol
:
"r10"
}
var
line
=
{
xs
:
feat
.
x
-
0
,
ys
:
feat
.
y
-
0
,
xe
:
feat2
.
x
-
0
,
ye
:
feat2
.
y
-
0
,
symbol
:
"r10"
}
var
lineLen
=
p2p
var
lineLen
=
p2p
var
k
=
(
line
.
xe
-
line
.
xs
)
/
(
line
.
ye
-
line
.
ys
)
var
k
=
(
line
.
xe
-
line
.
xs
)
/
(
line
.
ye
-
line
.
ys
)
var
q
=
(
line
.
ye
-
line
.
ys
)
/
(
line
.
xe
-
line
.
xs
)
var
q
=
(
line
.
ye
-
line
.
ys
)
/
(
line
.
xe
-
line
.
xs
)
...
@@ -161,7 +170,16 @@ try {
...
@@ -161,7 +170,16 @@ try {
GEN
.
selectByFilter
({
feat_types
:
"line"
})
GEN
.
selectByFilter
({
feat_types
:
"line"
})
GEN
.
COM
(
"sel_transform,mode=anchor,oper=rotate,duplicate=no,x_anchor="
+
lineCenter
.
x
+
",y_anchor="
+
lineCenter
.
y
GEN
.
COM
(
"sel_transform,mode=anchor,oper=rotate,duplicate=no,x_anchor="
+
lineCenter
.
x
+
",y_anchor="
+
lineCenter
.
y
+
",angle=90,x_scale=1,y_scale=1,x_offset=0,y_offset=0"
)
+
",angle=90,x_scale=1,y_scale=1,x_offset=0,y_offset=0"
)
GEN
.
selectByFilter
({
feat_types
:
"line"
})
GEN
.
selReverse
()
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selDelete
()
}
GEN
.
workLayer
({
name
:
layer
,
clear_before
:
"yes"
})
GEN
.
workLayer
({
name
:
layer
,
clear_before
:
"yes"
})
GEN
.
selectByFilter
({
attribute
:
".imp_line"
})
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selDelete
()
}
GEN
.
selRefFeat
({
layers
:
"tmp"
,
use
:
"filter"
,
mode
:
"touch"
})
GEN
.
selRefFeat
({
layers
:
"tmp"
,
use
:
"filter"
,
mode
:
"touch"
})
GEN
.
selectByFilter
({
feat_types
:
"pad
\
;text
\
;arc
\
;surface"
,
operation
:
"unselect"
})
GEN
.
selectByFilter
({
feat_types
:
"pad
\
;text
\
;arc
\
;surface"
,
operation
:
"unselect"
})
if
(
GEN
.
getSelectCount
()
>
0
)
{
if
(
GEN
.
getSelectCount
()
>
0
)
{
...
@@ -169,38 +187,57 @@ try {
...
@@ -169,38 +187,57 @@ try {
// 获取ines里面最大的symbol
// 获取ines里面最大的symbol
var
ls
=
[];
var
ls
=
[];
lines
.
forEach
(
function
(
l
)
{
lines
.
forEach
(
function
(
l
)
{
var
l_k
=
(
l
.
xe
-
l
.
xs
)
/
(
l
.
ye
-
l
.
ys
)
if
(
Math
.
abs
(
l_k
-
k
)
<
0.001
)
{
var
p2l
=
p2line
(
lineCenter
.
x
,
lineCenter
.
y
,
l
.
xs
,
l
.
ys
,
l
.
xe
,
l
.
ye
)
var
p2l
=
p2line
(
lineCenter
.
x
,
lineCenter
.
y
,
l
.
xs
,
l
.
ys
,
l
.
xe
,
l
.
ye
)
if
(
p2l
>
0.001
)
{
if
(
p2l
>
0.001
)
{
var
xmid
=
l
.
xs
+
(
l
.
xe
-
l
.
xs
)
/
2
var
ymid
=
l
.
ys
+
(
l
.
ye
-
l
.
ys
)
/
2
ls
.
push
({
ls
.
push
({
p2l
:
p2l
,
l
:
l
p2l
:
p2l
,
l
:
l
,
symbol
:
l
.
symbol
,
xmid
:
xmid
,
ymid
:
ymid
})
})
}
}
}
})
})
GEN
.
selClearFeature
()
if
(
ls
&&
ls
.
length
)
{
if
(
ls
&&
ls
.
length
)
{
var
length
=
ls
[
0
].
p2l
ls
.
forEach
(
function
(
lsv
)
{
var
line
=
{
xs
:
feat
.
x
,
ys
:
feat
.
y
,
xe
:
feat2
.
x
,
ye
:
feat2
.
y
,
symbol
:
"r420"
}
var
length
=
lsv
.
p2l
var
xChange
=
(
line
.
xe
-
line
.
xs
)
*
(
length
/
p2p
)
var
line
=
{
xs
:
feat
.
x
-
0
,
ys
:
feat
.
y
-
0
,
xe
:
feat2
.
x
-
0
,
ye
:
feat2
.
y
-
0
,
symbol
:
lsv
.
symbol
}
var
yChange
=
(
line
.
ye
-
line
.
ys
)
*
(
length
/
p2p
)
var
yChange
=
(
line
.
xe
-
line
.
xs
)
*
(
length
/
p2p
)
var
xChange
=
(
line
.
ye
-
line
.
ys
)
*
(
length
/
p2p
)
GEN
.
addLine
({
xs
:
feat
.
x
+
xChange
,
ys
:
feat
.
y
+
yChange
,
xe
:
feat2
.
x
+
xChange
,
ye
:
feat2
.
y
+
yChange
,
symbol
:
"r420"
,
attributes
:
".imp_line"
});
GEN
.
addLine
({
xs
:
feat
.
x
-
0
+
xChange
,
ys
:
feat
.
y
-
0
+
yChange
,
xe
:
feat2
.
x
-
0
+
xChange
,
ye
:
feat2
.
y
-
0
+
yChange
,
symbol
:
"r420"
,
attributes
:
".imp_line"
});
GEN
.
addLine
({
xs
:
feat
.
x
-
xChange
,
ys
:
feat
.
y
-
yChange
,
xe
:
feat2
.
x
-
xChange
,
ye
:
feat2
.
y
-
yChange
,
symbol
:
"r420"
,
attributes
:
".imp_line"
});
GEN
.
addLine
({
xs
:
feat
.
x
-
0
-
xChange
,
ys
:
feat
.
y
-
0
-
yChange
,
xe
:
feat2
.
x
-
0
-
xChange
,
ye
:
feat2
.
y
-
yChange
,
symbol
:
"r420"
,
attributes
:
".imp_line"
});
})
GEN
.
selectByFilter
({
attribute
:
".imp_line"
})
GEN
.
selRefFeat
({
layers
:
layer
,
use
:
"select"
,
mode
:
"cover"
})
GEN
.
selectByFilter
({
feat_types
:
"pad
\
;text
\
;arc
\
;surface"
,
operation
:
"unselect"
})
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selMoveOther
({
target_layer
:
layer
+
"_tmp"
})
}
}
GEN
.
selectByFilter
({
attribute
:
".imp_line"
})
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selDelete
()
}
// todo ls 循环 incam特殊命令点选
ls
.
forEach
(
function
(
lsv
)
{
var
xmid
=
lsv
.
xmid
var
ymid
=
lsv
.
ymid
GEN
.
COM
(
"sel_single_feat,operation=select,x="
+
xmid
+
",y="
+
ymid
+
",cyclic=yes"
)
})
}
}
GEN
.
PAUSE
(
0
)
}
}
}
}
}
}
}
})
})
})
})
GEN
.
workLayer
({
name
:
layer
,
clear_before
:
"yes"
})
GEN
.
selectByFilter
({
feat_types
:
"pad"
,
attribute
:
specialAttr
})
if
(
GEN
.
getSelectCount
()
>
0
)
{
GEN
.
selDelete
()
}
}
}
...
...
rout/ATS_rout_optimize_connect.js
View file @
f9173440
This diff is collapsed.
Click to expand it.
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