Forums:
Hi, I have problem with NX 11 Journal.
Journal worked perfectly in NX 10
When I run the Journal in NX 11 I get the following message:
"System.InvalidCastExceptio: Das Objekt Des Typs "NXOpen.BasePart[]" kann nicht in Typ "NXOpen.PArt[]" umgewendelt werden."
Journal reads atribude of the Parts, and lists them in the Info window.
Does anyone have a suggestion what to change in the code?
----------------------------------------
" & a1 ) 'end if Next lw.Open lw.WriteLine("=====================================================================================") lw.WriteLine("Assembly parts found:" & assyParts.Count.ToString()) For inx As Integer = 0 To assyParts.Count - 1 Dim aPart As NXOpen.Part = assyParts(inx) 'lw.WriteLine(inx.ToString() & ". Original: " & aPart.FullPath()) Dim newPath As String = _ aPart.FullPath.Insert(aPart.FullPath.LastIndexOf("\"), _ "\NewDirectory") 'lw.WriteLine(" Saving As: " & newPath) Dim pathOnly As String = Microsoft.VisualBasic.Left(newPath, _ newPath.LastIndexOf("\")) 'If My.Computer.FileSystem.DirectoryExists(pathOnly) = False Then ' My.Computer.FileSystem.CreateDirectory(pathOnly) 'End If Dim words As String() = assyParts(inx).FullPath.Split("\") Dim words01 As String() = words(words.Length-1).Split(".") Dim assemblyNom as String =aPart.GetStringAttribute("NOMENCLATURE") Dim saveStatus As PartSaveStatus = Nothing ' saveStatus = aPart.SaveAs("D:\Pregled_NX\assemblyy" & inx.ToString) lw.Open lw.WriteLine(words(words.Length-1) & " ==> " & assemblyNom ) ' lw.WriteLine("partoviStari(" & inx & ")=(*" & words01(0) & "*)" ) ' lw.WriteLine("partoviNovi(" & inx & ")=(*" & assemblyNom & "*)") If words(words.Length-1).Contains("M") Then slovoM=slovoM+1 End if If words(words.Length-1).Contains("S") Then slovoS=slovoS+1 End if If words(words.Length-1).Contains("B") Then slovoB=slovoB+1 End if If words(words.Length-1).Contains("X") Then slovoX=slovoX+1 End if If words(words.Length-1).Contains("K") Then slovoK=slovoK+1 End if If words(words.Length-1).Contains("E") Then slovoE=slovoE+1 End if Next lw.Open lw.WriteLine("======================================================") lw.WriteLine("M= " & slovoM.ToString) lw.WriteLine("S= " & slovoS.ToString) lw.WriteLine("B= " & slovoB.ToString) lw.WriteLine("X= " & slovoX.ToString) lw.WriteLine("K= " & slovoK.ToString) lw.WriteLine("E= " & slovoE.ToString) lw.WriteLine("Dodati +1 za citav product) End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer Return Session.LibraryUnloadOption.Immediately End Function End Module> Picture of error: <a href="http://imgur.com/a/7WLvy
">http://imgur.com/a/7WLvy[/geshifilter-code]