📄 border1.scr
字号:
next
else
tmp%=0
addtool%=0
end if
80
if mergedrl%=0 then
nc_set_tool_exportorder@ table%,toolref%(tmp%),1
nc_set_tool_id@ table%,toolref%(tmp%),1
toolnum%(tmp%)=1
end if
sortnum%=1
blknum%=0
for t=1 to counter%
if toolnum%(t)=0 then
blknum%=blknum%+1
end if
next
if mergedrl%=0 then
if tmp%=1 then
for t=2 to counter%
sortnum%=sortnum%+1
nc_set_tool_exportorder@ table%,toolref%(t),counter%-sortnum%-blknum%+2
nc_set_tool_id@ table%,toolref%(t),counter%-sortnum%-blknum%+2
toolnum%(t)=counter%-sortnum%-blknum%+2
next
else
for t=1 to tmp%-1
sortnum%=sortnum%+1
nc_set_tool_exportorder@ table%,toolref%(t),counter%-sortnum%-blknum%+2
nc_set_tool_id@ table%,toolref%(t),counter%-sortnum%-blknum%+2
toolnum%(t)=counter%-sortnum%-blknum%+2
next
for t=tmp%+1 to counter%
sortnum%=sortnum%+1
nc_set_tool_exportorder@ table%,toolref%(t),counter%-sortnum%-blknum%+2
nc_set_tool_id@ table%,toolref%(t),counter%-sortnum%-blknum%+2
toolnum%(t)=counter%-sortnum%-blknum%+2
next
end if
else
for t=1 to counter%
sortnum%=sortnum%+1
nc_set_tool_exportorder@ table%,toolref%(t),counter%-sortnum%-blknum%+2
nc_set_tool_id@ table%,toolref%(t),counter%-sortnum%-blknum%+2
toolnum%(t)=counter%-sortnum%-blknum%+2
next
end if
maxorder%=counter%-blknum%
for t=1 to slotcount%
nc_set_tool_exportorder@ table%,slotref%(t),counter%+t-blknum%
nc_set_tool_id@ table%,slotref%(t),counter%+t-blknum%
next
maxorder%=maxorder%+slotcount%
if deldrl%=0 and unused%>0 then
for t=1 to unused%
nc_set_tool_exportorder@ table%,unusedref%(t),counter%+t-blknum%
nc_set_tool_id@ table%,unusedref%(t),counter%+t-blknum%
next
maxorder%=maxorder%+unused%
end if
if mergedrl%=1 then goto 990
close_msg
for t=1 to counter%
if toolsize#(t)=holesize# then
tmp%=t
addtool%=t
goto 100
end if
next
100
select case lhalg%
case 1,3
tmpdist#=ldist#-lasty#
case 2
tmpdist#=ldist#+lastx#
end select
'if toolsize#(1)>=3.0 then
if tmpdist#-lhsize#/2.0<=limitdist# then
OpenForm #1,30,3, "警告!", character, yesno
addform #1, 2, 0, "最大尾孔孔径过大!",print
addform #1, 4, 1, "按Yes 程序将自动调整",print
addform #1, 4, 2, "按No 重置",print
displayform #1
frmyes=formyes(1)
deleteform #1
if frmyes then
select case lhalg%
case 1,3
lasty#=ldist#-lhsize#/2.0-1.0
case 2
lastx#=lhsize#/2.0+1.0-ldist#
end select
' ldist#=lhsize#/2.0+1.0
else
if cenctl%=1 then
horizx#=horizx#-horizxtmp#
horizy#=horizy#-horizytmp#
vertx#=vertx#-vertxtmp#
verty#=verty#-vertytmp#
lastx#=lastx#-lastxtmp#
lasty#=lasty#-lastytmp#
OpenForm #1,40,9, "孔位调整", character, yesno
addform #1,2,0,"外围孔:",print
addform #1,4,1,"横向X:",input,horizxtmp#
addform #1,8,2,"Y:",input,horizytmp#
addform #1,4,3,"纵向X:",input,vertxtmp#
addform #1,8,4,"Y:",input,vertytmp#
addform #1,2,5,"尾孔:",print
addform #1,4,6,"横向X:",input,lastxtmp#
addform #1,8,7,"Y:",input,lastytmp#
' addform #1,2,8,"确认吗? ",print
DisplayForm #1
frmno% = formno(1)
DeleteForm #1
if frmno% then
goto 10
end if
horizx#=horizx#+horizxtmp#
horizy#=horizy#+horizytmp#
vertx#=vertx#+vertxtmp#
verty#=verty#+vertytmp#
lastx#=lastx#+lastxtmp#
lasty#=lasty#+lastytmp#
goto 100
else
goto 10
end if
end if
end if
'end if
'自动布局
if first%=1 then
if ttt%=1 then
select case lhalg%
case 1
talg1%=1
talg2%=3
talg3%=7
case 2
talg1%=4
talg2%=6
talg3%=2
case 3
talg1%=7
talg2%=5
talg3%=1
end select
end if
else
select case talg1%
case 1
talg2%=3
case 2
talg2%=8
case 3
talg2%=1
case 4
talg2%=6
case 5
talg2%=7
case 6
talg2%=4
case 7
talg2%=5
case 8
talg2%=2
end select
end if
'if lhalg%=2 then
' if widx#<widy# then swap widx#,widy#
'else
' if widx#>widy# then swap widx#,widy#
'end if
select case lhalg%
case 1
holelocx#=holedistcenx#*(1-2*lastholemir%)+horizx#
holelocy#=-holedistceny#+verty#
case 2
holelocx#=holedistceny#+horizx#
holelocy#=holedistcenx#*(1-2*lastholemir%)+verty#
case 3
holelocx#=holedistcenx#*(2*lastholemir%-1)+horizx#
holelocy#=holedistceny#+verty#
end select
select case lhalg%
case 1
algwidth#(1)=(maxx#-minx#)/2+holelocx#-9
algwidth#(2)=(maxy#-miny#)/2-holelocy#-9
algwidth#(3)=(maxx#-minx#)/2-holelocx#-9
algwidth#(4)=(maxy#-miny#)/2-holelocy#-9
algwidth#(5)=(maxx#-minx#)/2-holelocx#-9
algwidth#(6)=(maxy#-miny#)/2+holelocy#-9
algwidth#(7)=(maxx#-minx#)/2+holelocx#-9
algwidth#(8)=(maxy#-miny#)/2+holelocy#-9
case 2
algwidth#(1)=(maxx#-minx#)/2+holelocy#-9
algwidth#(2)=(maxy#-miny#)/2+holelocx#-9
algwidth#(3)=(maxx#-minx#)/2-holelocy#-9
algwidth#(4)=(maxy#-miny#)/2+holelocx#-9
algwidth#(5)=(maxx#-minx#)/2-holelocy#-9
algwidth#(6)=(maxy#-miny#)/2-holelocx#-9
algwidth#(7)=(maxx#-minx#)/2+holelocy#-9
algwidth#(8)=(maxy#-miny#)/2-holelocx#-9
case 3
algwidth#(1)=(maxx#-minx#)/2-holelocx#-9
algwidth#(2)=(maxy#-miny#)/2+holelocy#-9
algwidth#(3)=(maxx#-minx#)/2+holelocx#-9
algwidth#(4)=(maxy#-miny#)/2+holelocy#-9
algwidth#(5)=(maxx#-minx#)/2+holelocx#-9
algwidth#(6)=(maxy#-miny#)/2-holelocy#-9
algwidth#(7)=(maxx#-minx#)/2-holelocx#-9
algwidth#(8)=(maxy#-miny#)/2-holelocy#-9
end select
if talg1%=talg2% or talg1%=talg3% or talg2%=talg3% then
select case talg1%
case 1
talg2%=3
talg3%=7
case 2
talg2%=8
talg3%=4
case 3
talg2%=1
talg3%=5
case 4
talg2%=6
talg3%=2
case 5
talg2%=7
talg3%=3
case 6
talg2%=4
talg3%=8
case 7
talg2%=5
talg3%=1
case 8
talg2%=2
talg3%=6
end select
end if
select case talg1%
case 1
placestr$="1"+mid$(placestr$,2)
case 2
placestr$=mid$(placestr$,1,1)+"1"+mid$(placestr$,3)
case 3
placestr$=mid$(placestr$,1,2)+"1"+mid$(placestr$,4)
case 4
placestr$=mid$(placestr$,1,3)+"1"+mid$(placestr$,5)
case 5
placestr$=mid$(placestr$,1,4)+"1"+mid$(placestr$,6)
case 6
placestr$=mid$(placestr$,1,5)+"1"+mid$(placestr$,7)
case 7
placestr$=mid$(placestr$,1,6)+"1"+mid$(placestr$,8)
case 8
placestr$=mid$(placestr$,1,7)+"1"
end select
select case talg2%
case 1
placestr$="1"+mid$(placestr$,2)
case 2
placestr$=mid$(placestr$,1,1)+"1"+mid$(placestr$,3)
case 3
placestr$=mid$(placestr$,1,2)+"1"+mid$(placestr$,4)
case 4
placestr$=mid$(placestr$,1,3)+"1"+mid$(placestr$,5)
case 5
placestr$=mid$(placestr$,1,4)+"1"+mid$(placestr$,6)
case 6
placestr$=mid$(placestr$,1,5)+"1"+mid$(placestr$,7)
case 7
placestr$=mid$(placestr$,1,6)+"1"+mid$(placestr$,8)
case 8
placestr$=mid$(placestr$,1,7)+"1"
end select
select case talg3%
case 1
placestr$="1"+mid$(placestr$,2)
case 2
placestr$=mid$(placestr$,1,1)+"1"+mid$(placestr$,3)
case 3
placestr$=mid$(placestr$,1,2)+"1"+mid$(placestr$,4)
case 4
placestr$=mid$(placestr$,1,3)+"1"+mid$(placestr$,5)
case 5
placestr$=mid$(placestr$,1,4)+"1"+mid$(placestr$,6)
case 6
placestr$=mid$(placestr$,1,5)+"1"+mid$(placestr$,7)
case 7
placestr$=mid$(placestr$,1,6)+"1"+mid$(placestr$,8)
case 8
placestr$=mid$(placestr$,1,7)+"1"
end select
'钻外围孔
if flagsame% and flagused% then
dradd%=blanklayer!
edit_layer@ dradd%,-2,-2,21,0,"drl_tmp"
nc_assign_tool_table_to_layer@ dradd%,Table%
setlayer@ dradd%
else
setlayer@ dr%
end if
varx#=(maxx#+minx#)/2+holelocx#
vary#=miny#-holedist#+horizy#
nc_add_drill_hit@
set_current_toolref@ toolref%(tmp%)
axy@ varx#,vary#
back@
vary#=(maxy#+miny#)/2+holelocy#
varx#=maxx#+holedist#+vertx#
nc_add_drill_hit@
set_current_toolref@ toolref%(tmp%)
axy@ varx#,vary#
back@
varx#=(maxx#+minx#)/2+holelocx#
vary#=maxy#+holedist#-horizy#
nc_add_drill_hit@
set_current_toolref@ toolref%(tmp%)
axy@ varx#,vary#
back@
vary#=(maxy#+miny#)/2+holelocy#
varx#=minx#-holedist#-vertx#
nc_add_drill_hit@
set_current_toolref@ toolref%(tmp%)
axy@ varx#,vary#
back@
'增加D 码
for t=1 to counter%
dcodeadd%(t)=blankdcode!
edit_aperture@ blankdcode!,1,toolsize#(t),toolsize#(t),blankdcode!,""
next
longstar%=blankdcode!
edit_aperture@ longstar%,1,0.05,0.05,longstar%,""
pdcode%=blankdcode!
edit_aperture@ blankdcode!,1,psize#,psize#,blankdcode!,""
tdcode%=blankdcode!
edit_aperture@ blankdcode!,1,tsize#,tsize#,blankdcode!,""
ldcode%=blankdcode!
edit_aperture@ blankdcode!,1,lsize#,lsize#,blankdcode!,""
hdcode1%=blankdcode!
edit_aperture@ blankdcode!,7,Holesize#+lwid#*4,Holesize#+lwid#*2,blankdcode!,""
hdcode2%=blankdcode!
edit_aperture@ blankdcode!,7,Holesize#+lwid#*8,Holesize#+lwid#*6,blankdcode!,""
hdcode3%=blankdcode!
edit_aperture@ blankdcode!,7,Holesize#+lwid#*12,Holesize#+lwid#*10,blankdcode!,""
update_dcodebar@
'尾孔
dradd1%=blanklayer!
edit_layer@ dradd1%,-2,-2,21,0,"LastDrl_tmp"
nc_assign_tool_table_to_layer@ dradd1%,Table%
setlayer@ dradd1%
t=0
do
t=t+1
set_drill_tool@ toolref%(t)
loop until toolsize#(t)<=lhsize# or t>counter%
maxid%=t
tadd%=0
select case lhalg%
case 1
varx#=maxx#-(maxx#-minx#)*lastholemir%+lastx#
vary#=miny#-ldist#+lasty#
for t=maxid% to counter%
if toolsize#(t)<>holesize# or (flagsame%=1 and flagused%=1) then
tadd%=tadd%+1
nc_add_drill_hit@
set_current_toolref@ toolref%(t)
axy@ varx#-(tadd%-1)*(1-2*lastholemir%)*lhsize#,vary#
back@
end if
next
case 2
varx#=maxx#+ldist#+lastx#
vary#=maxy#-(maxy#-miny#)*lastholemir%+lasty#
for t=maxid% to counter%
if toolsize#(t)<>holesize# or (flagsame%=1 and flagused%=1) then
tadd%=tadd%+1
nc_add_drill_hit@
set_current_toolref@ toolref%(t)
axy@ varx#,vary#-(tadd%-1)*(1-2*lastholemir%)*lhsize#
back@
end if
next
case 3
varx#=minx#+(maxx#-minx#)*lastholemir%+lastx#
vary#=maxy#+ldist#+lasty#
for t=maxid% to counter%
if toolsize#(t)<>holesize# or (flagsame%=1 and flagused%=1) then
tadd%=tadd%+1
nc_add_drill_hit@
set_current_toolref@ toolref%(t)
axy@ varx#+(tadd%-1)*(1-2*lastholemir%)*lhsize#,vary#
back@
end if
next
end select
setlayer@ dr%
'记录尾孔数量
taddcount%=tadd%
if gcount%>0 then
pindrl%=blanklayer!
if mid$(ucase$(pcbname$),1,1)="S" or ts%=1 then
edit_layer@ pindrl%,-2,-2,21,0,pcbno$+".PIN"
else
edit_layer@ pindrl%,-2,-2,21,0,mid$(pcbno$,5)+".PIN"
end if
'增加新钻嘴表
setlayer@ pindrl%
for b%=1 to 99
nc_assign_tool_table_to_layer@ pindrl%,b%
if highesttoolref!>0 then pintableid%=b%
next
pintableid%=pintableid%+1
nc_add_table@ pintableid%
nc_assign_tool_table_to_layer@ pindrl%,pintableid%
aimpin%=Highesttoolref!+1
nc_add_tool@ pintableid%,aimpin%
nc_set_tool_type@ pintableid%,aimpin%,3
nc_set_tool_size@ pintableid%,aimpin%,aimpinsize#
nc_set_tool_id@ pintableid%,aimpin%,1
nc_set_tool_exportorder@ pintableid%,aimpin%,1
nc_set_table_name@ pintableid%,"Pin_table"
nc_set_table_type@ pintableid%,3
select case lhalg%
case 1
nc_add_drill_hit@
set_current_toolref@ aimpin%
axy@ minx#,miny#-aimplace#
axy@ maxx#,maxy#+aimplace#
axy@ minx#,maxy#+aimplace#
back@
case 2
nc_add_drill_hit@
set_current_toolref@ aimpin%
axy@ maxx#+aimplace#,miny#
axy@ minx#-aimplace#,miny#
axy@ minx#-aimplace#,maxy#
back@
case 3
nc_add_drill_hit@
set_current_toolref@ aimpin%
axy@ maxx#,maxy#+aimplace#
axy@ maxx#,miny#-aimplace#
axy@ minx#,miny#-aimplace#
back@
end select
end if
'生成板框
filt$=rtrim$(str$(pdcode%))+","+rtrim$(str$(tdcode%))+","+rtrim$(str$(longstar%))+","+rtrim$(str$(hdcode1%))+","+rtrim$(str$(hdcode2%))+","+rtrim$(str$(hdcode3%))
for t=maxid% to counter%
if toolsize#(t)<>holesize# or (flagsame%=1 and flagused%=1) then
filt$=filt$+","+rtrim$(str$(dcodeadd%(t)))
end if
next
if gcount%>0 then
filt$=filt$+","+rtrim$(str$(hdcode4%))
end if
for lay%=0 to highestlayer!
layertmp%=blanklayer!
edit_layer@ layertmp%,-2,-2,4,0,"Layer_Tmp"
setlayer@ layertmp%
if lay%<>layertmp% then
setlayer@ lay%
layer_alloff@ 1
view_all@
isglyr%=-2
if gcount%>0 then
t%=0
do
t%=t%+1
loop until glyr%(t%)=lay% or t%>gcount%
if t%<=gcount% then
isglyr%=t%
end if
end if
if layertype!<>9 and layertype!<>10 and layertype!<>21 then
'填充多义线
frmyes%=0
if autoboard%=1 or isglyr%>0 then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -