正树 发表于 2017-6-14 13:49:37

删除配置属性的源码

1.删除当前配置的所有属性

Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
ConfName = Part.GetActiveConfiguration.Name
Set CusPropMgr = Part.Extension.CustomPropertyManager(ConfName)
Vnamearr = CusPropMgr.GetNames
If Not IsEmpty(Vnamearr) Then
    For Each Vnamearr2 In Vnamearr
    bRet = Part.DeleteCustomInfo2(ConfName, Vnamearr2)
    Next
End If2.删除所有配置的所有属性
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
CurCFGname = Part.GetConfigurationNames
CurCFGnameCount = Part.GetConfigurationCount
For i = 0 To CurCFGnameCount - 1
    Set CusPropMgr = Part.Extension.CustomPropertyManager(CurCFGname(i))
    Vnamearr = CusPropMgr.GetNames
    If Not IsEmpty(Vnamearr) Then
      For Each Vnamearr2 In Vnamearr
            bRet = Part.DeleteCustomInfo2(CurCFGname(i), Vnamearr2)
      Next
    End If
Next


页: [1]
查看完整版本: 删除配置属性的源码