📄 border1.scr
字号:
edit_layer@ t,-2,-2,8,-2,""
case "GTS"
edit_layer@ t,-2,-2,11,-2,""
case "GBS"
edit_layer@ t,-2,-2,12,-2,""
case "GKO"
edit_layer@ t,-2,-2,6,-2,""
end select
next
view_SuppressGrphcs@ 0
suspend "没有指定电气层,"+CR!+"系统已自动为您指定,请按Y 核对"
view_SuppressGrphcs@ 1
util_camed@
flag1%=0
topnum%=0
botnum%=0
for t=0 to highestlayer!
setlayer@ t
if layertype!=0 then
topnum%=topnum%+1
flag%=flag%+1
end if
if layertype!=3 then
botnum%=botnum%+1
flag%=flag%+1
end if
next
end if
if topnum%=0 and botnum%>0 then lastholemir%=1
loop until flag%>0 and flag1%=0
else
9940
OpenForm #1,20,5, "提示", character, YESNO
AddForm #1, 4, 0, "如果是单面板,且线路",print
AddForm #1, 0, 1,"面在底面,即GBL 面,则应",print
AddForm #1, 0, 2,"将尾孔置于左下角",Print
AddForm #1, 2, 3, "将尾孔置于左下角?", check,lastholemir%
AddForm #1, 2, 4, "查看", check,look%
DisplayForm #1,LOWERRIGHT
frmno% = formno(1)
frmyes%=formyes(1)
DeleteForm #1
if frmno% then goto 10
if look% then
view_SuppressGrphcs@ 0
suspend "请查看..."
view_SuppressGrphcs@ 1
look%=0
goto 9940
end if
end if
'寻找内层
9905
for lay%=0 to highestlayer!
setlayer@ lay%
if ucase$(right$(Layername!,2))>="G1" and ucase$(right$(Layername!,2))<="G9" and layertype!=4 then
layer_alloff@ 1
view_all@
invert%=0
mir%=0
OpenForm #1,26,3, "找到一个内层", character, YESNOCANCEL
AddForm #1, 0, 0, "找到一个内层: "+ucase$(layername!),Print
AddForm #1, 2, 1, "反相", check,invert%
AddForm #1, 2, 2, "随GBL面", check,mir%
AddForm #1, 20, 1, "查看", check,look%
AddForm #1, 20, 2, "按Cancel 忽略该层", print
DisplayForm #1,LOWERRIGHT
frmno% = formno(1)
frmyes%=formyes(1)
DeleteForm #1
'if frmno% then goto 10
if look% or frmno% then
view_SuppressGrphcs@ 0
suspend "请查看..."
view_SuppressGrphcs@ 1
look%=0
goto 9905
end if
if frmyes% then
gcount%=gcount+1
glyr%(gcount%)=lay%
ginvert%(gcount%)=invert%
gmir%(gcount%)=mir%
gname$(gcount%)=ucase$(right$(layername!,2))
gnum%(gcount%)=val(right$(layername!,1))
end if
end if
next
if gcount%>0 and flag%<2 then
OpenForm #1,20,2, "错误", character, YESNO
AddForm #1, 0, 0, "有内层,但外层不够2 层",Print
AddForm #1, 4, 1, "Yes-重设 No-返回",print
DisplayForm #1,LOWERRIGHT
frmno% = formno(1)
frmyes%=formyes(1)
DeleteForm #1
if frmno% then goto 10
if frmyes% then
view_SuppressGrphcs@ 0
suspend "层设置有误,请按Y 重设"
view_SuppressGrphcs@ 1
gcount%=0
gmircount%=0
goto 9903
end if
end if
if gcount%>0 then
aimdcode%=blankdcode!
edit_aperture@ aimdcode%,6,0,0,aimdcode%,"mid"
paddcode%=blankdcode!
edit_aperture@ paddcode%,1,1.5,1.5,paddcode%,""
hdcode4%=blankdcode!
edit_aperture@ hdcode4%,7,Holesize#+lwid#*8,Holesize#-lwid#*8,hdcode4%,""
for t = 1 to gcount%
if gmir%(t)=0 then
z = t + 1
For x = z to gcount%
if gnum%(t)>gnum%(x) and gmir%(x)=0 then
swap gnum%(t), gnum%(x)
swap glyr%(t), glyr%(x)
swap gname$(t),gname$(x)
swap ginvert%(t), ginvert%(x)
end if
next
end if
next
For t = 1 to gcount%
if gmir%(t)=1 then
z = t + 1
For x = z to gcount%
if gnum%(t)>gnum%(x) and gmir%(x)=1 then
swap gnum%(t), gnum%(x)
swap glyr%(t), glyr%(x)
swap gname$(t),gname$(x)
swap ginvert%(t), ginvert%(x)
end if
next
end if
next
for t=1 to gcount%
if gmir%(t)=1 then gmircount%=gmircount%+1
next
x1=0
for t=1 to gcount%
if gmir%(t)=0 then
x1=x1+1
gnum%(t)=x1*2
end if
next
x2=0
for t=1 to gcount%
if gmir%(t)=1 then
x2=x2+1
gnum%(t)=x2*2+1
end if
next
if x1>x2 then
gg%=0
ff%=0
for t=1 to gcount%
if gmir%(t)=0 then
gg%=gg%+1
if gg%>x2 then
ff%=ff%+1
gnum%(t)=x2*2+1+ff%
end if
end if
next
else
gg%=0
ff%=0
for t=1 to gcount%
if gmir%(t)=1 then
gg%=gg%+1
if gg%>x1 then
ff%=ff%+1
gnum%(t)=x1*2+1+ff%
end if
end if
next
end if
if abs(x1-x2)>1 then
OpenForm #1,20,2, "错误", character, YESNO
AddForm #1, 0, 0, "正反内层数相差大于 1",Print
AddForm #1, 4, 1, "Yes-重设 No-返回",print
DisplayForm #1,LOWERRIGHT
frmno% = formno(1)
frmyes%=formyes(1)
DeleteForm #1
if frmno% then
frmno%=0
goto 10
end if
if frmyes% then
gcount%=0
gmircount%=0
frmyes%=0
goto 9905
end if
end if
for t=1 to gcount%
if ginvert%(t)=1 then ginvertflag%=ginvertflag%+1
next
' suspend
end if
pcbno$=""
pcbname$=ltrim$(rtrim$(pcbname$))
zkh%=0
ykh%=0
do
zkh%=zkh%+1
loop until mid$(pcbname$,zkh%,1)="(" or zkh%>=len(pcbname$)
do
ykh%=ykh%+1
loop until mid$(pcbname$,ykh%,1)=")" or ykh%>=len(pcbname$)
if zkh%>ykh% then swap zkh%,ykh%
if zkh%=len(pcbname$) and (mid$(pcbname$,zkh%,1)<>"(" or mid$(pcbname$,zkh%,1)<>")") then
pcbno$=lcase$(pcbname$)
else
if ykh%<len(pcbname$) then
pcbno$=lcase$(mid$(pcbname$,1,zkh%-1)+mid$(pcbname$,ykh%+1))
else
pcbno$=lcase$(mid$(pcbname$,1,zkh%-1))
end if
end if
if mid$(ucase$(pcbname$),1,1)="-" then
ts%=1
pcbtmpname$=ucase$(pcbname$)
pcbname$=mid$(ucase$(pcbname$),2)
pcbno$=mid$(pcbno$,2)
else
ts%=0
end if
if first%<>1 then
if firstpcbname$<>pcbname$ then
rehole%=1
holesize#=firstholesize#
else
rehole%=0
end if
end if
if first%=1 or rehole%=1 then
firstholesize#=holesize#
if (mid$(ucase$(pcbname$),1,1)<>"S" and ts%=0) and autoboard%=1 then
if mid$(ucase$(pcbname$),4,1)="1" then
holesize#=holesize#-0.05
else
select case mid$(ucase$(pcbname$),3,1)
case "A","C"
holesize#=holesize#
case "B","D"
holesize#=holesize#+0.05
end select
end if
else
openform #1,34,2,"选择外围孔",character,yesno
addform #1,2,0,"外围孔径",input,holesize#
displayform #1
frmno%=formno(1)
deleteform #1
if frmno% then
goto 10
end if
end if
end if
if (holesize#+lwid#*12)/2.0+limitdist#>holedist#-horizy# then
OpenForm #1,30,4, "警告!", character, yesno
addform #1, 2, 0, "横向外围孔可能与线路重合",print
addform #1, 4, 2, "按Yes 程序将自动调整",print
addform #1, 4, 3, "按No 重置",print
displayform #1
frmyes%=formyes(1)
deleteform #1
if frmyes% then
' holedist#=(holesize#+lwid#*12)/2.0+1.0
horizy#=holedist#-(holesize#+lwid#*12)/2.0-1.0
' horizy#=0
else
if cenctl%=1 then
horizx#=horizx#-horizxtmp#
horizy#=horizy#-horizytmp#
vertx#=vertx#-vertxtmp#
verty#=verty#-vertytmp#
lastx#=lastx#-lastxtmp#
lasty#=lasty#-lastytmp#
goto 15
else
goto 10
end if
end if
end if
if (holesize#+lwid#*12)/2.0+limitdist#>holedist#+vertx# then
OpenForm #1,30,4, "警告!", character, yesno
addform #1, 2, 0, "纵向外围孔可能与线路重合",print
addform #1, 4, 2, "按Yes 程序将自动调整",print
addform #1, 4, 3, "按No 重置",print
displayform #1
frmyes%=formyes(1)
deleteform #1
if frmyes% then
' holedist#=(holesize#+lwid#*12)/2.0+1.0
vertx#=(holesize#+lwid#*12)/2.0+1.0-holedist#
' vertx#=0
else
if cenctl%=1 then
horizx#=horizx#-horizxtmp#
horizy#=horizy#-horizytmp#
vertx#=vertx#-vertxtmp#
verty#=verty#-vertytmp#
lastx#=lastx#-lastxtmp#
lasty#=lasty#-lastytmp#
goto 15
else
goto 10
end if
end if
end if
9930
'dr%=drilllayer! '保存钻孔层ID#
setlayer@ dr%
Table% = tooltable! '寻找Tool表 #
for lay%=1 to highestlayer!
if dr%<>lay% then
setlayer@ lay%
if layertype!=21 and table%=tooltable! then
samelyrnum%=samelyrnum%+1
samelyrdrl%(samelyrnum%)=lay%
end if
end if
next
print_msg "收集Tool信息"
'如果有内层,加切边孔
if lhalg%=2 then
if widx#<widy# then swap widx#,widy#
else
if widx#>widy# then swap widx#,widy#
end if
if gcount%>0 then
setlayer@ dr%
for A=1 to 99
set_drill_tool@ A
if toolsize!>=0.9 and toolsize!<=1.1 then
edgeref%=A
'exit for
end if
next
if edgeref%=-1 then
nc_add_tool@ table%,highesttoolref!+1
nc_set_tool_type@ table%,highesttoolref!,3
nc_set_tool_size@ table%,highesttoolref!,1.1
' nc_set_tool_size@ table%,highesttoolref!,holesize#
nc_set_tool_id@ table%,highesttoolref!,highesttoolref!
edgeref%=highesttoolref!
end if
nc_add_drill_hit@
set_current_toolref@ edgeref%
select case lhalg%
case 1,3
axy@ minx#+5,miny#-widy#
axy@ maxx#-5,miny#-widy#
axy@ maxx#+widx#,miny#
axy@ maxx#+widx#,maxy#
axy@ maxx#-5,maxy#+widy#
axy@ minx#+5,maxy#+widy#
axy@ minx#-widx#,maxy#
axy@ minx#-widx#,miny#
case 2
axy@ minx#-widx#,miny#+5
axy@ minx#,miny#-widy#
axy@ maxx#,miny#-widy#
axy@ maxx#+widx#,maxy#+5
axy@ maxx#+widx#,maxy#-5
axy@ maxx#,maxy#+widy#
axy@ minx#,maxy#+widy#
axy@ minx#-widx#,miny#-5
end select
back@
end if
'合并相同钻嘴
setlayer@ dr%
toolmaxref%=Highesttoolref!
for a1=1 to toolmaxref%-1
setlayer@ dr%
flag%=0
set_drill_tool@ a1
toolsizetmp#=toolsize!
for a2=a1+1 to toolmaxref%
set_drill_tool@ a2
if toolsize!=toolsizetmp# then
if flag%=0 then nc_set_tool_type@ table%,a1,1
setlayer@ dr%
layer_alloff@ 1
nc_edit_change_tool@
seteditmill@ 0
setbydcode@ ""
setbytoolref@ ltrim$(rtrim$(str$(a2)))
setbytabid@ ltrim$(rtrim$(str$(table%)))
edit_selectall2@
nc_change_tool@ a1
back@
if samelyrnum%>0 then
for lay%=1 to samelyrnum%
setlayer@ samelyrdrl%(lay%)
layer_alloff@ 1
nc_edit_change_tool@
seteditmill@ 0
setbydcode@ ""
setbytoolref@ ltrim$(rtrim$(str$(a2)))
setbytabid@ ltrim$(rtrim$(str$(table%)))
edit_selectall2@
nc_change_tool@ a1
back@
next
end if
nc_delete_tool@ table%,a2
flag%=flag%+1
end if
next
next
'找出已使用的Tool
setlayer@ dr%
flagsame%=0
flagused%=0
For A = 1 to 99
set_drill_tool@ A
if holesize#<>toolsize! then
if toolused! = 1 then
if lyrdrillcount!>0 then
Counter% = Counter% + 1
ToolNum%(Counter%) = toolnum!
ToolRef%(Counter%) = A
ToolSize#(Counter%) = toolsize!
else
slotcount%=slotcount+1
slotnum%(slotcount%)=toolnum!
slotref%(slotcount%)=A
slotsize#(slotcount%)=toolsize!
end if
else
if toolnum!<>0 then
unused%=unused%+1
unusedref%(unused%)=a
unusedsize#(unused%)=toolsize!
end if
if deldrl% then nc_delete_tool@ table%,a
end if
else
' if sharehole%=1 then
nc_set_tool_type@ table%,A,1
Counter% = Counter% + 1
ToolNum%(Counter%) = toolnum!
ToolRef%(Counter%) = A
ToolSize#(Counter%) = toolsize!
flagsame%=1
if lyrdrillcount!>0 then
flagused%=1
end if
' else
' end if
end if
next
if flagsame%=0 and mergedrl%=0 then
nc_add_tool@ table%,Highesttoolref!+1
nc_set_tool_type@ table%,Highesttoolref!,3
nc_set_tool_size@ table%,Highesttoolref!,holesize#
nc_set_tool_id@ table%,Highesttoolref!,Highesttoolref!
set_drill_tool@ Highesttoolref!
counter%=counter%+1
holeadd%=1
toolnum%(counter%)=Highestdeftoolnum!
toolref%(counter%)=Highesttoolref!
toolsize#(counter%)=holesize#
else
holeadd%=0
end if
'suspend "暂停"
'将Tools 由大到小排序
60
For T = 1 to Counter%
Z = T + 1
For X = Z to Counter%
' Check #T tool in last against all others
' - transcode info for smaller tool to become tool T
if ToolSize#(T) < ToolSize#(X) then
' Swap smaller tools for larger ones
swap ToolNum%(T), ToolNum%(X)
swap ToolRef%(T), ToolRef%(X)
swap ToolSize#(T), ToolSize#(X)
end if
next
next
'排Tools输出顺序
if mergedrl%=0 then
for t=1 to counter%
if toolsize#(t)=holesize# then
tmp%=t
addtool%=t
goto 80
end if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -