Showing results for 
Search instead for 
Did you mean: 

ST6 - Masterparts - Writing custom properties (


Hi everyone,


I have the following problem:


I can not write custom properties to a masterpart. If I open a standard part, then it has a reference to the masterpart. I want to access the custom properties of the master part and edit them using


This is the code I have so far:


 Dim bMasterPart As Boolean = False

            If Not oDoc Is Nothing Then

                If oDoc.Type = DocumentTypeConstants.igPartDocument Then

                    Dim oPart As SolidEdgePart.PartDocument = oDoc

                    Dim oPartfamilyMembers As SolidEdgePart.FamilyMembers = oPart.FamilyMembers
                    If oPartfamilyMembers.Count > 0 Then
                        bMasterPart = True


                            Dim oCustom As SolidEdgeFramework.Properties
                            oCustom = oPart.Properties("Custom")

                            Dim oProperty As SolidEdgeFramework.Property
                            Dim bFoundProperty As Boolean = False

                            For i As Integer = 1 To oCustom.Count
                                oProperty = oCustom.Item(i)
                                If oProperty.Name = sName Then

                                    oProperty.Value = sValue

                                    bFoundProperty = True
                                End If
                            If bFoundProperty = False Then
                                oCustom.Add(sName, sValue)
                            End If


                            If Not (oCustom Is Nothing) Then
                                oCustom = Nothing
                            End If

                        Catch ex As Exception
                            MsgBox("ex: " & ex.Message.ToString)
                        End Try

                    End If

                End If

            End If

In the debugger the properties are set correctly, but if open the Masterpart and look at the edited custom property, it still has the previous value... ?


What I tried so far is:

  • Saving the masterpart after setting the custom properties -> results in an error (no write access)
  • SeekWriteAccess -> returns true but still no write access during save.



Opening each masterpart is not an option because this takes to long in large assemblies.


What else can I try? I hope someone can help me. Am I missing something? Smiley Frustrated





Re: ST6 - Masterparts - Writing custom properties (

Valued Contributor
Valued Contributor

I came into the same problem for just standard parts that are not part of a family members. I would assume the solution for that would work for FOP as well. You have to check for the custom property and if it exists then you have to delete the property and than add the property back in. 


Below is the code for how to do this approach for files that are open and for ones that are closed


 Dim objPropertySets As SolidEdgeFileProperties.PropertySets = Nothing
 Dim objProperties As SolidEdgeFileProperties.Properties = Nothing
 Dim objProperty As SolidEdgeFileProperties.Property = Nothing

'objPropertySets.Open(openfile, False) 'For files that are closed
'objDocument = objApplication.ActiveDocument 'For Files that are open
'objPropertySets = objDocument.Properties 'For Files that are open

objProperties = objPropertySets.Item("Custom")
    If Not (objProperties.Item("Dash_Number") Is Nothing) Then
                    objProperty = objProperties.Item("Dash_Number")
                    ' Delete last custom property
                    objProperty = objProperties.Add("Dash_Number", StringValue)
    End If
Catch ex As Exception
    objProperty = objProperties.Add("Dash_Number", StringValue)
End Try