Twullf
Mechanical
- Jan 24, 2012
- 196
So I am trying to implement a solution posted in thread561-197154 but that was for a previous version of NX and I think the coding has changed.
I am receiving the same error as the original poster which reads:
"NXOpen.NXException: The second parameter passed in was invalid"
My code is as follows:
The solution center posts the following code, which I tried to base my code off of:
The solution for the error from the above linked post was as follows:
but with the solution I get an error stating that IsOccurrence is not a part of ufs.Assem. and even though I added the line to set obj_tag = ufs.Assem.IsOccurrence(selectedobject(index).Tag) I still get the error.
I appreciate any help.
I am receiving the same error as the original poster which reads:
"NXOpen.NXException: The second parameter passed in was invalid"
My code is as follows:
Code:
Public Function link_faces( ByRef SelectFaces() As Face )
Dim tagWorkPart As NXOpen.Tag = theSession.Parts.Work.Tag
Dim tempBody As Body = SelectFaces(0).GetBody()
Dim tempComp As Component = tempBody.OwningComponent
Dim compPart As Part = tempComp.Prototype
Dim linked_feature As NXOpen.Tag = NXOpen.Tag.Null
Dim object_in_part As NXOpen.Tag = theSession.Parts.Work.Views.WorkView.Tag
'Dim xform As NXOpen.Tag = NXOpen.Tag.Null
Dim returnFace(selectFaces.Length-1) As NXOpen.Tag
Dim i as Integer = 0
For Each aFace As Face In selectFaces
Dim xform As NXOpen.Tag = NXOpen.Tag.Null
Dim face_tag As NXOpen.Tag = selectFaces(i).Tag
face_tag = theUFSession.Assem.AskPrototypeOfOcc(selectFaces(i).Tag)
theUfSession.So.CreateXformAssyCtxt( object_in_part, face_tag, NXOpen.Tag.Null, xform)
'theUfSession.Wave.CreateLinkedface(aFace.Tag, xform, selectFaces(i).Tag, True, linked_feature)
theUFSession.Wave.CreateLinkedFace(face_tag,xform, displayPart.tag, True, returnFace(i))
theUfSession.Modl.Update()
i = i + 1
Next
End Function
The solution center posts the following code, which I tried to base my code off of:
Code:
Public Function link_bodies(ByRef comp As Assemblies.Component)
Dim workPart As NXOpen.Tag = s.Parts.Work.Tag
Dim compPart As Part = comp.Prototype
Dim linked_feature As NXOpen.Tag = NXOpen.Tag.Null
Dim object_in_part As NXOpen.Tag = s.Parts.Work.Views.WorkView.Tag
Dim xform As NXOpen.Tag = NXOpen.Tag.Null
For Each aBody As Body In compPart.Bodies
ufs.So.CreateXformAssyCtxt(object_in_part, comp.Tag, NXOpen.Tag.Null, xform)
ufs.Wave.CreateLinkedBody(aBody.Tag, xform, object_in_part, True, linked_feature)
ufs.Modl.Update()
Next
End Function
The solution for the error from the above linked post was as follows:
Code:
'............................................................
'.....Wavelink objects.......
Dim cur_part_tag As Part = nxs.Parts.Display
Dim wave_objs(selectedobject.Length - 1) As Tag
Dim index As Integer = 0
For index = 0 To selectedobject.Length - 1
Dim my_xform As Tag = Tag.Null
Dim obj_tag As Tag = selectedobject(index).Tag
' / 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.Wave.CreateLinkedBody(obj_tag, my_xform, cur_part_tag.Tag, False, wave_objs(index))
ufs.Modl.Update()
but with the solution I get an error stating that IsOccurrence is not a part of ufs.Assem. and even though I added the line to set obj_tag = ufs.Assem.IsOccurrence(selectedobject(index).Tag) I still get the error.
I appreciate any help.