|
经典案例图书![](data/attachment/common/cf/SW2016.jpg) - Dim swApp As SldWorks.SldWorks
- Dim swModel As SldWorks.ModelDoc2
- Dim swCustPrpMgr As SldWorks.CustomPropertyManager
- Dim swConfCustPrpMgr As SldWorks.CustomPropertyManager
-
- Sub main()
-
- Set swApp = Application.SldWorks
-
- Set swModel = swApp.ActiveDoc
- If Not swModel Is Nothing Then
-
- Set swCustPrpMgr = swModel.Extension.CustomPropertyManager("")
-
- Dim vNames As Variant
- Dim vTypes As Variant
- Dim vValues As Variant
- swCustPrpMgr.GetAll vNames, vTypes, vValues
-
- Dim activeConfName As String
- activeConfName = swModel.ConfigurationManager.ActiveConfiguration.Name
- Set swConfCustPrpMgr = swModel.Extension.CustomPropertyManager(activeConfName)
-
- Dim i As Integer
-
- For i = 0 To UBound(vNames)
-
- swConfCustPrpMgr.Add2 vNames(i), vTypes(i), vValues(i)
-
- swConfCustPrpMgr.Set vNames(i), vValues(i)
- Next
- Else
- MsgBox "请打开零件或装配体文档!"
- End If
-
- End Sub
复制代码 |
|