' pads logic bom output
' by lyp ([email protected])
dim fn as
string
sub main
fn = activedocument
if fn = ""
then
fn = "untitled"
endif
tempfile = defaultfilepath & "\temp.txt"
open tempfile for output as
#1 item = 0
statusbartext = "generating report..."
print #1, "item";vbtab;"part type"; vbtab;"p/n_1"; vbtab;"manufacturer_1_p/n"; vbtab;"description"; vbtab;"manufacturer_1"; vbtab; "value"; vbtab; "qty"; vbtab; "ref-des"
foreach pkg in activedocument.parttypes
'print #1, pkg.name; vbtab; note
qty = 0
value = ""
description = ""
manufacturer = ""
pn = ""
manufacturerpn = ""
symbol = ""
item = item + 1
'print #1, item; vbtab;
foreach part in pkg.components
value = attrvalue(part, "value")
description = attrvalue(part, "description")
manufacturer = attrvalue(part, "manufacturer_1")
pn = attrvalue(part, "p/n_1")
value = attrvalue(part, "value")
manufacturerpn = attrvalue(part, "manufacturer_1_p/n")
sysid = attrvalue(part, "sysid")
qty = qty+1
symbol = symbol + part.name + ", "
next
symbol_len = len(symbol)
symbol = mid(symbol,1, symbol_len - 2)
print #1, item; vbtab; part.parttype ; vbtab; pn ; vbtab;manufacturerpn; vbtab;description; vbtab;manufacturer; vbtab;value; vbtab; qty; vbtab; symbol;
print #1
next pkg
statusbartext = ""
close #1
exporttoexcel
endsub
sub exporttoexcel
fillclipboard
dim xl as
object
onerror
resume
next
onerror
if xl is
nothing
then
endif xl.visible = true
xl.workbooks.add
xl.activesheet.paste
xl.range("a1:i1").font.bold = true
xl.range("a1:i1").numberformat = "@"
xl.range("a1:i1").autofilter
xl.activesheet.usedrange.columns.autofit
'output report header
xl.rows(1).insert
xl.rows(1).cells(1) = space(1) & "part report "& " wwzl-bom " & " on " & now
xl.rows(2).insert
xl.rows(1).font.bold = true
'output design totals
lastrow = xl.activesheet.usedrange.rows.count + 1
xl.rows(lastrow + 1).font.bold = true
xl.rows(lastrow + 1).cells(1) = space(1) & "design part count: " & activedocument.components.count
xl.range("a1").select
onerror
goto
0exit
sub
excelerror:
msgbox err.description, vbexclamation, "error running excel"
onerror
goto
0exit
subend
subsub fillclipboard
statusbartext = "export data to clipboard..."
' load whole file to string variable
tempfile = defaultfilepath & "\temp.txt"
open tempfile for input as
#1 l = lof(1)
alldata$ = input$(l,1)
close #1
'copy whole data to clipboard
clipboard alldata$
kill tempfile
statusbartext = ""
endsub
function attrvalue (comp as
object, atrname as
string) as
string
if comp.attributes(atrname) is
nothing
then
attrvalue = ""
else
attrvalue = comp.attributes(atrname).value
endifend
function
指令碼儲存為:pads_logic_bom_to_excel.bas
載入指令碼步驟:
bom輸出結果,有亂碼是ascii不包含特殊符號,安裝open office解決:
1、檔案->報告->材料清單->設定,可以匯出bom
新建excel,pads全選複製到excel
匯出後用beyond compare 比較內容
sqoop匯出指令碼
sqoop匯出指令碼 bin sh source exitcodecheck.sh opts getparam incstart getparam inc start incend getparam inc end pg connection getparam jdbc str pg usernam...
sqoop匯出指令碼
bin bash if 1 then export hive db name 1 else echo 請指定要匯出的源資料庫 exit 1 fiif 2 then export hive t name 2 else echo 請指定要匯出的源表名 exit 1 fiif 3 then export ...
exp匯出指令碼問題
hp ux的系統下exp 匯出的時候 出現exp 00056 oracle error 932 encountered ora 00932 inconsistent datatypes expected blob,clob got char exp 00000 export terminated u...