|
如下 是圖號分離 宏代碼 圖號在前 名稱在后 用此宏可以 一鍵 分離 到自定義屬性上面去,,問題來了 我現(xiàn)在調(diào)用的 3D制造云標(biāo)準(zhǔn)件 都是名稱在前 代號再后 這個(gè)宏 得更改一下了 誰會(huì) 幫我改改,。
'從這里開始復(fù)制:
'定義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
Dim a As Integer
Dim b As String
Dim m As String
Dim e As String
Dim k As String
Dim t As String
Dim c As String
Dim j As Integer
Dim strmat As String
Dim tempvalue As String
Sub main()
'link solidworks
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
'設(shè)定變量
c = swApp.ActiveDoc.GetTitle() '零件名
strmat = Chr(34) + Trim("SW-Material" + "@") + c + Chr(34)
blnretval = Part.DeleteCustomInfo2("", "代號")
blnretval = Part.DeleteCustomInfo2("", "名稱")
a = InStr(c, " ") - 1 '重點(diǎn):分隔標(biāo)識符,,這里是一個(gè)空格
If a > 0 Then
k = Left(c, a)
t = Left(LTrim(e), 3)
If t = "GBT" Then
e = "GB/T" + Mid(k, 4)
Else
e = k
End If
b = Mid(c, a + 2)
t = Right(c, 7)
If t = ".SLDPRT" Or t = ".SLDASM" Then
j = Len(b) - 7
Else
j = Len(b)
End If
m = Left(b, j)
End If
blnretval = Part.AddCustomInfo3("", "代號", swCustomInfoText, e) '代號
blnretval = Part.AddCustomInfo3("", "名稱", swCustomInfoText, m) '名稱
blnretval = Part.AddCustomInfo3("", "表面處理", swCustomInfoText, " ")
End Sub
|
|