AnsweredAssumed Answered

Macro Deleting Revision From Drawing

Question asked by James Dickson on Mar 17, 2020
Latest reply on Mar 17, 2020 by James Dickson

I have simple code that is giving me a little trouble. I would appreciate any help you might be able to give.

 

I have a Macro that deletes all custom properties at drawing level and one that gets all the properties I want, and drives them into the drawing level. Everything is work except it’s clearing out $PRP:”Revision” in my drawing every time I run the Macro.

 

Can you please help me obi wan you're my only hope…

 

Private Sub Delete_ALL_Custom_Properties()

On Error Resume Next
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc

Dim names() As String

Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")
names = swCustPropMgr.GetNames

Dim i As Integer
For i = 0 To UBound(names)
swCustPropMgr.Delete names(i)
Next
If Err <> 0 Then

End If


End Sub

 

Private Sub Get_Custom_Properties()

On Error Resume Next
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swdraw = swModel
Set swview = swdraw.GetFirstView
Set swview = swview.GetNextView
v = swview.GetVisibleComponents
Set comp = v(0)
Set swmod = comp.GetModelDoc2
Propname = swmod.GetCustomInfoNames
Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")
For i = 0 To UBound(Propname)
evval = swmod.GetCustomInfoValue(config, Propname(i))
addstatus = swCustPropMgr.Add2(Propname(i), swCustomInfoText, evval)
evval = ""
Next
If Err <> 0 Then

End If

End Sub

Outcomes