国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
API 批量修改solidwork屬性

'定義solidwork
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
 

Dim Feature As Object
'定義excel
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
 
Dim a As String
Dim b As String
Dim m As String
Dim e As String
Dim c As String
Dim j As Integer
Dim t As Integer
Dim f As String
Dim g As String
Dim h As String
Dim i As Integer
Dim k As Integer
Dim p As Integer
 
 
 
Sub main()
 
On Error GoTo aa
 

'link solidworks
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
 
'設(shè)定零件地址
f = "D:\"
 

'link excel
Set oExcel = Excel.Application
oExcel.Visible = False
Set oWB = oExcel.Workbooks.Open("f:\***.xls")   'excel表格位置
Set oWS = oWB.Worksheets(1)
 

'設(shè)置在excel中的查找代碼,查找各個屬性
j = 2
 
Do Until Sheets(1).Cells(j, 2) = ""
 
h = Sheets(1).Cells(j, 2)
 
i = 1
Do Until Mid(h, i, 1) = "."
i = i + 1
Loop
i = i + 1
 
b = Mid(h, i, 6)
 
Select Case b
Case Is = "SLDPRT"
k = 1
Case Is = "SLDASM"
k = 2
End Select
 

'生成零件具體位置
g = f & h ' & ".SLDPRT"
 

Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
'打開零件
'Part.OpenCompFile
Set Part = swApp.OpenDoc6(g, k, 0, "", longstatus, longwarnings)
 
'記錄零件名稱
h = Sheets(1).Cells(j, 2)
 

'經(jīng)excel賦值
a = Sheets(1).Cells(j, 3) 'Description
'm = Sheets(1).Cells(j, 4)
'e = Sheets(1).Cells(j, 3)
 
'編輯零件
 
'清空solidwork舊的屬性
 
blnretval = Part.DeleteCustomInfo2("", "物料編碼")
'blnretval = Part.DeleteCustomInfo2("", "坯料尺寸")
 

'加入新的solidwork屬性
 
blnretval = Part.AddCustomInfo3("", "Material", swCustomInfoText, a)
'blnretval = Part.AddCustomInfo3("", "坯料尺寸", swCustomInfoText, m)
 

'關(guān)閉編輯完的零件
Set Part = swApp.ActivateDoc2(g, False, longstatus)
Part.Save2 True
Part.ClearSelection2 True
Set Part = Nothing
swApp.CloseDoc g
 
'顯示當(dāng)前文件
Set Part = swApp.ActivateDoc2("****.SLDPRT", False, longstatus)
 

aa:
j = j + 1
 
Loop
 

'關(guān)閉excel
oExcel.DisplayAlerts = False
oWB.Close
oExcel.Quit
Set oWS = Nothing
Set oWB = Nothing
Set oExcel = Nothing
 

strErrMsg = "SetCustomProps Sub Routine" & strErrMsg
End Sub
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
solidworks打印教程之拼圖打印宏方法(把多頁工程圖批量輸出1:1TIF檔案)
讀取Excel內(nèi)容到MSHFlexgrid
Excel VBA代碼保護(hù)方案討論及總結(jié)
excel 導(dǎo)入導(dǎo)出 vb.net版,網(wǎng)上很難找的哦
在ASP .NET中讀寫Excel文件
DataSet資料轉(zhuǎn)到Exec的做法
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服