Hi @DavidTunnard. I thought I should also warn you that this is a very basic set-up, and should work OK when actively working with this document, however, the interface being used ("iProperties.Value()") within those two rules will always act upon whichever document is currently 'active' at that time (the 'active' document). So, if this part is being referenced within an assembly or drawing, then then when you attempt to save the assembly or drawing, it may want to indirectly also save this part document, it may trigger these two rules to run. In that situation, that assembly or drawing is currently visibly open and is the 'active' document, so the code will be trying to work with the iProperties of that assembly or drawing, instead of the part. (Here is a link to one of my contribution posts where I go into document references in greater detail.)
If you need to avoid that situation, you may need to layout out these two iLogic rules a little differently, and make sure they are 'local' rules (saved within the document), instead of external rules. In this scenario, you could set these two rules up like this:
Rule 1
Dim oDoc As Document = ThisDoc.Document 'points to 'local' document
Dim oPN As String = oDoc.PropertySets.Item(3).Item("Part Number").Value
Dim oCProps As PropertySet = oDoc.PropertySets.Item(4)
Try
'try to find the custom iProperty (if it already exists), then set its value
oCProps.Item("Saved Part Number").Value = oPN
Catch
'it didn't find that custom iProperty, so create it, then sets its value
oCProps.Add(oPN, "Saved Part Number")
End Try
Rule 2
Dim oDoc As Document = ThisDoc.Document 'points to 'local' document
Dim oPNProp As Inventor.Property = oDoc.PropertySets.Item(3).Item("Part Number")
Dim oCProps As PropertySet = oDoc.PropertySets.Item(4)
Dim oCProp As Inventor.Property
Try
'Try to set the Part Number value from the custom iProperty
oPNProp.Value = oCProps.Item("Saved Part Number").Value
Catch
'it didn't find that custom iProperty,
'so just exit the rule without doing anything
'may be first time the file is saved
Exit Sub
End Try
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)