增加一个,分离当前配置名
- Option Explicit
- Dim swApp As SldWorks.SldWorks
- Dim Part As SldWorks.ModelDoc2
- Dim ConfigName As String
- Dim ConfigNameSplit As Variant
- Dim PartCode As String
- Dim PartName As String
- Sub main()
- Set swApp = Application.SldWorks
- Set Part = swApp.ActiveDoc
- ConfigName = Part.GetActiveConfiguration.Name
- ConfigNameSplit = Split(ConfigName, " ")
- PartCode = ConfigNameSplit(0)
- PartName = ConfigNameSplit(UBound(ConfigNameSplit))
- Part.DeleteCustomInfo2 ConfigName, "名称"
- Part.DeleteCustomInfo2 ConfigName, "图号"
- Part.AddCustomInfo3 ConfigName, "名称", 30, PartName
- Part.AddCustomInfo3 ConfigName, "图号", 30, PartCode
- End Sub
复制代码 |