Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JAE on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Jornal: Load(read) all materials from material library

Status
Not open for further replies.

MANox

Mechanical
Joined
Apr 2, 2007
Messages
130
Location
PL
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
 
Learn to read .xml files via VB - the material library is an .xml file!
 
Thanks daluigi, it works.
I still thought - what I must doing for do it with NX.

If anyone ever going to need this I wrote this code:
Code:
  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 If





Best regards
Michał Nowak
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top