niedzviedz
Mechanical
- Apr 1, 2012
- 307
Hello,
I wanna process all parts in assembly to report all links and then search for parent. Now I have journal which was created to report all broken links. Below is some code:
I receive an error:
Line 75:
Line 218:
With best regards
Michael
I wanna process all parts in assembly to report all links and then search for parent. Now I have journal which was created to report all broken links. Below is some code:
Code:
Sub reportComponentChildren1( ByVal comp As Component, ByVal indent As Integer)
Dim workPart As Part = theSession.Parts.Work
Dim dispPart As Part = theSession.Parts.Display
For Each child As Component In comp.GetChildren()
Dim MyPart As Part = child.Prototype.OwningPart
Try
if child.IsSuppressed = true then
Continue for
end if
Catch e11 As Exception
theSession.ListingWindow.WriteLine("Failed: " & e11.ToString)
end try
If LoadComponent(child) Then
Dim sourceTag As Tag
Dim Parentname as string
Dim linkBroken As Boolean = True
For Each theFeature as Features.Feature In MyPart.Features
If theFeature.FeatureType.Contains("LINKED") Then
theUfSession.Wave.IsLinkBroken(theFeature.Tag, linkBroken)
If linkBroken Then
theUfSession.Wave.AskbrokenLinkSourcepart(theFeature.Tag, Parentname, sourceTag)
end if
else
theUfSession.Wave.AskLinkSource(theFeature.Tag, true, sourceTag)
If sourceTag = Tag.Null Then
lw.WriteLine("could not fully load parent file...")
Else
End if
End if
Next
End if
Next
End sub
I receive an error:
Code:
Failed: NXOpen.NXException: The first parameter passed in was invalid.
w NXOpen.UF.UFWave.AskLinkSource(Tag linked_feature, Boolean allow_load, Tag& source_entity)
w NXJournal.reportComponentChildren1(Component comp, Int32 indent) in C:\Users\...\AppData\Local\Temp\NXJournals41836\journal0.vb:linee 218
w NXJournal.Main() in C:\Users\...\AppData\Local\Temp\NXJournals41836\journal0.vb:line 75
Line 75:
ReportComponentChildren1(c.RootComponent, 0)
Line 218:
theUfSession.Wave.AskLinkSource(theFeature.Tag, true, sourceTag)
With best regards
Michael