Jornal: Load(read) all materials from material library
Jornal: Load(read) all materials from material library
(OP)
Hey!
I write a journal to add attributes and material to every component in assembly.
In this journal I have combobox with material.
My idea is add all materials from material library to this Combobox.
I can't find way to read material from library.
Maybe somebody know what I must doing.
Best regards
Michał Nowak
NX9 & Tc10
I write a journal to add attributes and material to every component in assembly.
In this journal I have combobox with material.
My idea is add all materials from material library to this Combobox.
I can't find way to read material from library.
Maybe somebody know what I must doing.
Best regards
Michał Nowak
NX9 & Tc10





RE: Jornal: Load(read) all materials from material library
RE: Jornal: Load(read) all materials from material library
I still thought - what I must doing for do it with NX.
If anyone ever going to need this I wrote this code:
CODE --> vb
Imports System.Xml Imports System.IO Dim material_File as String Dim IS_Material_File as Boolean = False If(File.Exists(UGIIROOTDIR & "physicalmateriallibrary.xml")) Then material_File = UGIIROOTDIR & "physicalmateriallibrary.xml" IS_Material_File = True Else Msgbox ("I have no blade pojecie gdzie jest baza materiałów") End if If Is_Material_File = true then Dim xmldoc As New XmlDocument() Dim xmlnode As XmlNodeList Dim i As Integer Dim str As String Dim fs As New FileStream(material_File, FileMode.Open, FileAccess.Read) xmldoc.Load(fs) xmlnode = xmldoc.SelectNodes("//Material/BulkDetails") lw.Writeline(xmlnode.Count) For i = 0 To xmlnode.Count - 1 str = xmlnode(i).ChildNodes.Item(0).InnerText.Trim() myDialog.ComboBox1.Items.Add(str) Next End IfBest regards
Michał Nowak