⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 border1.scr

📁 CAM350宏全集
💻 SCR
📖 第 1 页 / 共 5 页
字号:
'输出路径
workpath$="c:\awork"

'外围孔距中心距离
holedistcenx#=8
holedistceny#=5
cenctl%=0

'耙孔位置
aimplace#=6

'警戒距离
limitdist#=0.325

'时间模式
timemode%=1

'设置单位为mm
setunit@ 1
update_buttonbars@
layer_renumber@
view_SuppressGrphcs@ 1

'自定义D 码库
lib_setextlib@ 1,1,1,"c:\ACT_60\scripts\work.clb"
set_caplib@ 1

'最小线宽扫描参数(mil)
reslt#=5
box#=1000

'调整开关
first%=1

'设置默认值
mergedrl%=0
ts$=time!		'取日期#
ts1$=mid$(ts$,21,4)
ts2$=mid$(ts$,5,3)
if timemode%=1 then
	select case ts2$
		case "Jan"
			ts2$="01"		
		case "Feb"
			ts2$="02"		
		case "Mar"
			ts2$="03"		
		case "Apr"
			ts2$="04"		
		case "May"
			ts2$="05"		
		case "Jun"
			ts2$="06"		
		case "Jul"
			ts2$="07"		
		case "Aug"
			ts2$="08"		
		case "Sep"
			ts2$="09"		
		case "Oct"
			ts2$="10"		
		case "Nov"
			ts2$="11"		
		case "Dec"
			ts2$="12"		
	end select
end if
ts3$=mid$(ts$,9,2)
ts$=ts1$+"-"+ts2$+"-"+ts3$

lay%=0
maxlayer%=highestlayer!
setlayer@ lay%
do while lay%<maxlayer% and layertype!<>6
	lay%=lay%+1
	setlayer@ lay%
loop
if lay%=maxlayer% and layertype!<>6 then
	lay%=0
	setlayer@ lay%
	do while lay%<maxlayer% and ucase$(right$(ltrim$(rtrim$(layername!)),3))<>"GKO"
		lay%=lay%+1
		setlayer@ lay%
	loop
end if
if lay%=maxlayer% and layertype!<>6 and ucase$(right$(ltrim$(rtrim$(layername!)),3))<>"GKO" then
	print_msg "没有外形层,"+CR!+"请手工输入板边坐标!"
	delay 1000
	close_msg
	maxx#=0			'最大点坐标#
	maxy#=0
	minx#=0			'最小点坐标#
	miny#=0
else
	setlayer@ lay%
	layer_alloff@ 1
	maxx#=vismaxx!			'最大点坐标#
	maxy#=vismaxy!
	minx#=visminx!			'最小点坐标#
	miny#=visminy!
end if
scope%=0		'是否输入单元范围坐标#
varx#=0
vary#=0
lsize#=0.1		'框线D 码#
psize#=0.2		'多义线填充D 码#
tsize#=0.25		'文字D 码#
lhsize#=3.0		'最大尾孔D 码#
holesize#=2.1		'外围孔D 码#
aimpinsize#=3.15
talg1%=1		'文字对齐方式#
talg2%=3
talg3%=5
widx#=5			'外框到单元距离X,Y#
widy#=7			
ldist#=2.5		'尾孔到单元距离#
lastx#=0
lasty#=0
lastxtmp#=0
lastytmp#=0
ldisty#=2.5
lhalg%=1		'尾孔位置#
lwid#=0.1		'外围孔线宽#
holedist#=3.0		'外围孔到单元距离#
horizx#=0
horizy#=0
vertx#=0
verty#=0
horizxtmp#=0
horizytmp#=0
vertxtmp#=0
vertytmp#=0
widint#=2		'内框到单元距离#
tstr1$="LONGSTAR "+ts$			'字符#
la$="GTL"
latmp$=""
lasel%=1		'选择层#
tstr2$="0 1 2 3 4 5 6 7 8 9"
tstr3$=""
tstrtmp1$=tstr1$			'暂存字符#
tstrtmp2$=tstr2$
tstrtmp3$=tstr3$
pcbname$=""		'生产编号#
firstpcbname$=""
tl1%=0			'文字是否连接#
tl2%=1
thigh#=2		'字符高度#
hdcode1%=0		'线路层外围孔D 码ID#
hdcode2%=0
hdcode3%=0
hdcodetmp%=0
hdcodesel%=1		'选择外围孔#
ori%=1			'是否改变原点#
redo%=0			'是否重做#
deldrl%=1			'是否删除无用钻嘴
liuc%=1

coppercount%=0			'记录电气层
dim copperlyr%(1 to 10)

maskcount%=0			'记录阻焊层
dim masklyr%(1 to 10)	
dim maskmir%(1 to 10)

silkcount%=0			'记录白字层
dim silklyr%(1 to 10)
dim silkmir%(1 to 10)

bluecount%=0			'记录蓝胶层
dim bluelyr%(1 to 10)
dim bluemir%(1 to 10)
dim blue%(1 to 4)

gcount%=0				'记录内层
gmircount%=0
dim glyr%(1 to 10)
dim gnum%(1 to 10)
dim ginvert%(1 to 10)
ginvertcount%=0
ginvertflag%=0
dim gmir%(1 to 10)
gclearlyr%=-2
dim gadd%(1 to 10)
dim gname$(1 to 10)
dim clearcompplace%(1 to 10)
dim gcompplace%(1 to 10)


autoboard%=1	'是否自动加板框

dim ToolNum% (1 to 99)
dim ToolRef% (1 to 99)
dim ToolSize# (1 to 99)
dim slotnum%(1 to 99)
dim slotref%(1 to 99)
dim slotsize#(1 to 99)
slotcount%=0
dim editlayer% (1 to 40)	'记录已修改的层ID#
dim addclear%(1 to 10)
dim clearmir%(1 to 10)
dim samelyrdrl%(1 to 10)	'有相同Table表的NC层ID
samelyrnum%=0
editcount%=1
editflag%=0
dim DcodeAdd%(1 to 99)
counter%=0
dim unusedref%(1 to 40)
dim unusedsize#(1 to 40)
unused%=0
blknum%=0
holesel%=2
dim algwidth#(1 to 8)
ttt%=1
dim gtlclearly%(1 to 10)
dim gblclearly%(1 to 10)
gtlclearcount%=0
gblclearcount%=0
dim slototherlyr%(1 to 10)
slotothercount%=0
'提示窗体
do

10
'重置部分参数
slotcount%=0
slotothercount%=0
slottable%=-1
slotlyr=-1
layer_renumber@
placestr$="00000000"
compnum%=0
compid%=first_composite!
if compid%>-1 then
	do
		compnum%=compid%
		compid%=next_composite!	
	loop until compid%=-1
	compnum%=compnum%+1
end if

lastholemir%=0
lasel%=1
hdcodesel%=1
editcount%=0
clearcount%=0
ginvertcount%=0
ginvertflag%=0
edgeref%=-1
maskcount%=0
silkcount%=0
bluecount%=0
editflag%=0
borderlyr%=-1
coppercount%=0
gcount%=0
gmircount%=0
'返回CAM_Edit界面
util_camed@
			
'ldist#=2.5
tmir%=0
rehole%=0
horizxtmp#=0
horizytmp#=0
vertxtmp#=0
vertytmp#=0
lastxtmp#=0
lastytmp#=0
gtlclearcount%=0
gblclearcount%=0
for t=1 to 10
	gtlclearly%(t)=-1
	gblclearly%(t)=-1
next
OpenForm #1,102,15, "制作板框", character, okcancel
AddForm #1, 30, 0, "将根据以下参数制作板框(单位mm):",Print
AddForm #1, 0, 2, "生产编号:    ", input,pcbname$
AddForm #1, 0, 1, "板框文字D 码(mm):   ", input,tsize#
AddForm #1, 82, 2, " 文字3 ", choice,talg3%,"左下X ","左下Y ","右下X ","右下Y ","右上X ","右上Y","左上X ","左上Y "
AddForm #1, 2, 3, "文字1 :    ", input,tstr1$
AddForm #1, 66, 2, "文字2 ", choice,talg2%,"左下X ","左下Y ","右下X ","右下Y ","右上X ","右上Y","左上X ","左上Y "
AddForm #1, 2, 4, "文字2(P/N):", input,tstr2$
AddForm #1, 70, 0, "仅合并钻嘴", check,mergedrl%
AddForm #1, 2, 5, "文字3 :    ", input,tstr3$
AddForm #1, 98, 2, "", check,ttt%
AddForm #1, 98, 3, "随", print
AddForm #1, 98, 4, "尾", print
AddForm #1, 98, 5, "孔", print
AddForm #1, 98, 6, "位", print
AddForm #1, 98, 7, "置", print
AddForm #1, 50, 1, "文字对齐方式:",print
AddForm #1, 50, 2, "文字1 ", choice,talg1%,"左下X ","左下Y ","右下X ","右下Y ","右上X ","右上Y","左上X ","左上Y "
AddForm #1, 0, 6, "文字连接:   文字1", print
AddForm #1, 20, 6, "文字2 ", check,tl1%
AddForm #1, 18, 7, "最大尾孔(mm):  ", print
AddForm #1, 32, 6, "文字3 ", check,tl2%
AddForm #1, 20, 8, "", input,lhsize#
AddForm #1, 90, 0, "重置原点", check,ori%
AddForm #1, 70, 1, "删除无用钻嘴", check,deldrl%
AddForm #1, 90, 1, "自动", check,autoboard%
AddForm #1, 0, 11, "多义线填充D 码(mm): ",input,psize#
AddForm #1, 20, 12, "", print
AddForm #1, 18, 9, "尾孔到单元距离(mm):",print
AddForm #1, 20, 10, "", input,ldist#
AddForm #1, 48, 10, "外框到单元距离(mm):",print
AddForm #1, 0, 7, "尾孔位置:", choice,lhalg%,"右下X ","右上Y ","左上X"
AddForm #1, 48, 11, "X:", input,widx#,3 to 10
AddForm #1, 48, 12, "Y:", input,widy#,3 to 10
AddForm #1, 0, 12, "外围孔(mm):         ", input,holesize#
AddForm #1, 0, 13, "外围孔内外径差(mm): ", input,lwid#
AddForm #1, 0, 14, "外围孔到单元距离(mm)", input,holedist#
AddForm #1, 48, 13, "内框到单元距离(mm):", print
AddForm #1, 48, 14, "  ", input,widint#
addform #1, 74, 10, "单元范围:",check,scope%
addform #1, 90, 10, "加流程",check,liuc%
addform #1, 76, 11, "X1:",input,minx#
addform #1, 76, 12, "Y1:",input,miny#
addform #1, 76, 13, "X2:",input,maxx#
addform #1, 76, 14, "Y2:",input,maxy#
addform #1, 82, 15, "尺寸X*Y: "+FMTUSING$("#.##",maxx#-minx#)+"*"+FMTUSING$("#.##",maxy#-miny#),print
AddForm #1, 0, 15, "外围孔位置调节", check,cenctl%

DisplayForm #1
canceled% = formCancel(1)
DeleteForm #1

if canceled% then goto 995
if drilllayer! < 0 then goto 999
lastlyr%=highestlayer!
kkk%=-1
do
	kkk%=kkk%+1
	setlayer@ kkk%
loop until (layertype!=21 and (ucase$(right$(ltrim$(rtrim$(layername!)),3))="TXT" or ucase$(right$(ltrim$(rtrim$(layername!)),3))="DRL")) or kkk%>=lastlyr%

setlayer@ kkk%
tmpn$=ucase$(right$(ltrim$(rtrim$(layername!)),3))
if kkk%=lastlyr% and (layertype!<>21 or (tmpn$<>"TXT" and tmpn$<>"DRL")) then
	goto 999
else
	dr%=kkk%
end if
'suspend dr%

if mergedrl%=1 then pcbname$="-Tmp"
if (maxx#-minxx#<=0 or maxy#-miny#<=0) and mergedrl%=0 then
	print_msg "板面积等于零,返回主界面"
	delay 2000
	close_msg
	goto 10
end if
15
if cenctl%=1 then
	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#
	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#
else
	horizx#=0
	horizy#=0
	vertx#=0
	verty#=0
	lastx=0
	lasty#=0
end if

if scope%=1 then
	OpenForm #1,40,6, "提示", character, yesno
	addform #1,2,0,"当前范围是(mm):",print
	addform #1,4,1,"左下  X1: ",input,minx#
	addform #1,4,2,"      Y1: ",input,miny#
	addform #1,4,3,"右上  X1: ",input,maxx#
	addform #1,4,4,"      Y1: ",input,maxy#
	addform #1,2,5,"确认吗? ",print
	DisplayForm #1 
	frmno% = formno(1)
	DeleteForm #1
	if frmno% then
		goto 10
	end if
else
	if redo%=0 then
		maxx#=Vismaxx!		
		maxy#=Vismaxy!
		minx#=Visminx!		
		miny#=Visminy!
	end if
end if
re%=0


do while pcbname$="" and mergedrl%=0
	openform #1,40,2,"提示", character, OKCANCEL
	addform #1,2,0,"没有生产编号,请输入:",print
	addform #1,4,1,"P/N:",input,pcbname$
	DisplayForm #1 
	frmcancel% = formcancel(1)
	DeleteForm #1
	if frmcancel% then goto 10
loop
aptable_remunused@
aptable_compress@

for t5=0 to highestlayer!
	setlayer@ t5
	tmpstring1$=right$(rtrim$(ltrim$(ucase$(layername!))),1)
	tmpstring2$=mid$(rtrim$(ltrim$(ucase$(layername!))),len(rtrim$(ltrim$(ucase$(layername!))))-2,2)
	tmpstring3$=left$(ucase$(rtrim$(ltrim$(layername!))),3)
	if (tmpstring1$="-" or tmpstring1$="C" or tmpstring1$="_" or ((tmpstring2$="-C" or tmpstring2$="_C") and tmpstring1$>="0" and tmpstring1$<="9")) and tmpstring3$="GTL" then
		gtlclearcount%=gtlclearcount%+1
		gtlclearly%(gtlclearcount%)=t5
	end if
	if (tmpstring1$="-" or tmpstring1$="C" or tmpstring1$="_" or ((tmpstring2$="-C" or tmpstring2$="_C") and tmpstring1$>="0" and tmpstring1$<="9")) and tmpstring3$="GBL" then
		gblclearcount%=gblclearcount%+1
		gblclearly%(gblclearcount%)=t5
	end if
next

if mergedrl%=1 then goto 9930
firstslot%=0
for t=0 to highestlayer!
	setlayer@ t
	if layertype!=21 and (right$(rtrim$(ltrim$(ucase$(layername!))),3)="SLT" or right$(rtrim$(ltrim$(ucase$(layername!))),4)="SLOT") then
		firstslot%=firstslot%+1
		if firstslot%=1 then
			slotlyr%=t
			slottable%=tooltable!
		else
			slotothercount%=slotothercount%+1
			slototherlyr%(slotothercount%)=t
			layer_alloff@ 1
			edit_copy@
			setcopies@ 1
			seteditflash@ 0
			edit_selectall2@
			setcoplayer@ slotlyr%,1
			copy_to_layer@
		end if
	end if
next
if slotlyr%>-1 then
	OpenForm #1,40,3, "提示", character, yesno
	addform #1,2,0,"发现有SLOT层",print
	addform #1,4,1,"合并SLOT层到钻孔层?",print
	DisplayForm #1 
	frmyes% = formyes(1)
	DeleteForm #1
	if frmyes% then
		mergeslot%=1
	else
		mergeslot%=0
	end if
end if
9903
if autoboard%=1 then
	flag%=0
	flag1%=0
	topnum%=0
	botnum%=0
	do
		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
			select case right$(rtrim$(ltrim$(ucase$(layername!))),3)
				case "GTL"
					if layertype!<>0 then flag1%=flag1%+1
				case "GBL"
					if layertype!<>3 then flag1%=flag1%+1
				case "GTO"
					if layertype!<>7 then flag1%=flag1%+1
				case "GBO"
					if layertype!<>8 then flag1%=flag1%+1
				case "GTS"
					if layertype!<>11 then flag1%=flag1%+1
				case "GBS"
					if layertype!<>12 then flag1%=flag1%+1
				case "GKO"
					if layertype!<>6 then flag1%=flag1%+1
			end select
		next
		if flag%=0 or flag1%>0 then
			for t=0 to highestlayer!
				setlayer@ t
				select case right$(ltrim$(rtrim$(ucase$(layername!))),3)
					case "GTL"
						edit_layer@ t,-2,-2,0,-2,""
					case "GBL"
						edit_layer@ t,-2,-2,3,-2,""
					case "GTO"
						edit_layer@ t,-2,-2,7,-2,""
					case "GBO"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -