wave link geometry

can anybody plz help me in this journal of wavelink.
i am getting an error as NXOPen.NXException:The Second parameter passed in was invalid.



Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.uf
Imports NXOpen.utilities
Imports NXOpen.Assemblies
Imports System.Windows.Forms
Imports System.IO
Imports System.Collections
Imports System.Drawing

Module NXJournal

Dim nxs As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()

Sub Main()

'....................Select Objects..........................

Dim my_ui As UI = ui.GetUI

Dim message As String = " Select Surfaces To Section"
Dim title As String = "Selection"

Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
Dim keepHighlighted As Boolean = False
Dim includeFeatures As Boolean = False
Dim response As Selection.Response

Dim selectionAction As Selection.SelectionAction = _
Selection.SelectionAction.ClearAndEnableSpecific

Dim selectionMask_array(1) As Selection.MaskTriple

With selectionMask_array(0)
.Type = UFConstants.UF_solid_type
.Subtype = 0
.SolidBodySubtype = 0
End With

Dim selectedobject() As NXObject

response = my_ui.SelectionManager.SelectObjects(message, title, scope, _
selectionAction, includeFeatures, _
keepHighlighted, selectionMask_array, _
selectedObject)

If response = Selection.Response.Cancel Or response = Selection.Response.Back Then
'goto clean_up

' / Exit execution /
Exit Sub
End If

'............................................................

'.....Wavelink objects.......

Dim cur_part_tag As Part = nxs.Parts.work

Dim wave_objs(selectedobject.Length - 1) As Tag

Dim index As Integer = 0

For index = 0 To selectedobject.Length - 1

Dim xform As NXOpen.Tag = NXOpen.Tag.Null
Dim obj_tag As tag = selectedobject(index).tag
Dim tempBody As Body = Selectedobject(index)
Dim tempComp As Component = tempBody.OwningComponent
' / If you working in assembly context /
If (ufs.Assem.IsOccurrence(selectedobject(index).Tag)) Then
obj_tag = ufs.Assem.AskPrototypeOfOcc(selectedobject(index).Tag)
End If
ufs.So.CreateXformAssyCtxt( obj_tag, tempComp.Tag, NXOpen.Tag.Null, xform)
ufs.Wave.CreateLinkedBody(obj_tag, xform, cur_part_tag.Tag, false, wave_objs(index))

ufs.Modl.Update()

Next

end sub

End Module



i am able to do the wave link with respect to assembly position while the assembly is active. whereas when i activate a part and run this journal i am getting this error. can anybody plz help me out

What exactly do you mean by "activate a part and run the journal"?

I ask because wavelinking doesn't work outside of the context of an assembly. If you have a part open (the display and work part) that is not an assembly, I would assume this journal would error out or at the very least not give the desired result.

"activate a part" means to make a part as a work part from the assembly and run the journal so that i get a linked body inside that part and at its assembly position.

See the reply to your other thread:
http://nxjournaling.com/comment/1003#comment-1003