Do you say that you can no longer retrieve the object from persistent reference? Please show sample code.
Thank you for the reply.
I am not having issues retrieving the persistent reference. the issue I'm having is with saved the model to a new file. in some configurations all the persistent references incremented. it seems to be with derived configurations. and it happens right after a saveas.
this code works fine, its the results that are questionable.
Dim Size As Integer = Modeldocs.Modeldoc.Extension.GetPersistReferenceCount3(Feature) 'Modeldocs.SelectionManager.GetSelectedObject6(1, 0))
Dim persist As Object = Modeldocs.Modeldoc.Extension.GetPersistReference3(Feature) 'Modeldocs.SelectionManager.GetSelectedObject6(1, 0))
For i As Integer = 0 To Size - 1
persistString += CStr(CInt(persist(i))) & ","
persistString = Mid(persistString, 1, Len(persistString) - 1)
and it keeps incrementing after each save as.
If you look at remarks section of IModelDocExtension::GetPersistReference3 you will find the following statement:
The internal representations of the return value array may change, possibly from rebuild to rebuild, or more likely, from one release of SolidWorks to the next, but their usage in finding the correct entity will be consistent across rebuilds and SolidWorks releases.
Do not compare arrays directly as they will be different even for the same object. Use ModelDocExtension::IsSamePersistentID to compare whether the ids are from the same object.
Thank you again for the reply.
I am reading the persistent id from one part, and retrieving the object from another part GetObjectByPersistReference3. I have linked test files that show different persist reference for display dimensions that came from the same part.
any more advice would be appreciated.
39428-A-Rim-test.zip 205.5 KB