Object Names and structure context

Hello everyone!
Recently I have made a journal which - amongst other things - defines an object name to a point, especially a routing control point (RCP).
Manually I achieve this by right-clicking on an RCP, selecting "properties", choosing the "General" tab and entering a "Name".
Programmatically, I do it like this:
selectedRCPs(0).SetName(TextStr)

Either way I am running into a difficulty, because in my use case there is typically an assembly structure involved that looks like this:

+ Collecting ASM
: + ASM 1 (containing an RCP to be named)
: + ASM 2 (containing another RCP to be named identically)
: + ASM n (and so forth...)

What I intend to achieve is having the "Collecting ASM" as Displayed part and also Work part, then naming the several RCP objects.

But, of course, this happens in the context of "Collecting ASM" and hence the names are available in this context only. If I look at the same RCP in "it's own" ASM, it is not named.
I was prepared to see this when it comes to attributes, but I didn't expect it for object names. Now I became a bit smarter ;-)

So I am now looking for a way to propagate such an object name into the "origin context" of that specific object.
Have I succeeded in explaining this?

Does anyone have a clue or even a code example on how this can be achieved?

Thanks a lot,

UdoMM

I'd suggest reading up on occurrence vs. prototype objects, the SNAP manual has a good chapter on this.

In short: the points that you see in the assembly are occurrence points, the defining object in the component part file is the prototype point. You can easily get the prototype object from the occurrence object.

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()

Dim theUI As UI = UI.GetUI()
Dim lw As ListingWindow = theSession.ListingWindow

Sub Main()

Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "NXJ")

lw.Open()

Dim myPt As Point = Nothing
If SelectPointObject("select point", myPt) = Selection.Response.Cancel Then
Exit Sub
End If

lw.WriteLine("point is occurrence: " & myPt.IsOccurrence.ToString)
If myPt.IsOccurrence Then
myPt.Prototype.SetName("my point")
Else
myPt.SetName("my point")
End If

lw.Close()

End Sub

Function SelectPointObject(ByVal prompt As String, ByRef selPoint As Point) As Selection.Response

Dim selObj As TaggedObject
Dim theUI As UI = UI.GetUI
Dim title As String = "Select a Point"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
Dim cursor As Point3d
Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
Dim selectionMask_array(0) As Selection.MaskTriple

With selectionMask_array(0)
.Type = UFConstants.UF_point_type
.Subtype = UFConstants.UF_all_subtype
End With

Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt,
title, scope, selAction,
includeFeatures, keepHighlighted, selectionMask_array,
selObj, cursor)
If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
selPoint = selObj
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If

End Function

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

End Function

End Module

Great - it's working!
Thank you very much!

/UdoMM