AnsweredAssumed Answered

Delete Custom Property from "Custom Tab" API

Question asked by Pichaiyan Prabaharan on Dec 16, 2020
Latest reply on Dec 16, 2020 by Alex Burnett

Hi,

I tried to delete all custom Properties in part.

I able to achive with below code. But its working only for "Configuration Specific Tab". May I know how to delete "Custom Tab" ?

 

Private Sub ProcesssWx(ByRef selectedFilePath As String, ByRef Type As Integer)

Dim swConfig As Configuration
Dim swCustPropMgr As CustomPropertyManager
Dim vPropNames As Object
Dim vPropName As Object
Dim configNames As Object
Dim configName As Object

Try
SWApp = GetObject(Nothing, "SldWorks.application")
Catch ex As Exception
SWApp = CreateObject("SldWorks.application")
End Try

Options = SolidWorks.Interop.swconst.swOpenDocOptions_e.swOpenDocOptions_Silent

Try
SWModel = SWApp.OpenDoc6(selectedFilePath, Type, Options, "", Errors, Warnings)
configNames = SWModel.GetConfigurationNames
For Each configName In configNames
swConfig = SWModel.GetConfigurationByName(configName)
swCustPropMgr = swConfig.CustomPropertyManager
vPropNames = swCustPropMgr.GetNames

If vPropNames IsNot Nothing Then
For Each vPropName In vPropNames
swCustPropMgr.Delete(vPropName)
Next
End If
Next

Catch ex As Exception
MessageBox.Show("Error - " & ex.Message.ToString, "AEM Design Center", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
saveStatus = SWModel.Save3(swSaveAsOptions_e.swSaveAsOptions_Silent + swSaveAsOptions_e.swSaveAsOptions_SaveReferenced, Errors, Warnings)

SWApp.CloseDoc(SWModel.GetTitle)

End Sub

 

Thanks

Outcomes