Cancel
Showing results for 
Search instead for 
Did you mean: 

Machine Library Information

Creator
Creator

Hello,

 

(I think) I know that NX extracts machine library information from the machine_template.dat file. I would like to know the method of obtaining all the machine library information of the currently selected machine (such as libref, description, etc.) programatically.

 

Thank you in advance.

2 REPLIES 2

Re: Machine Library Information

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Depending on your NX release there might be differences, but I use the following to get some information from the machine tool library.

        GetControllerInfo(theSession.Parts.Work.CAMSetup.GetMachineLibref(), bIsSinumerikControl, bIsParpasMachine)

    Private Sub GetControllerInfo(LibRef As String, ByRef IsSinumerikController As Boolean, ByRef IsParpasMachine As Boolean)
        Dim MachToolDB  As IntPtr = IntPtr.Zero
        Dim theRset     As IntPtr = IntPtr.Zero
        Dim iCount      As Integer = 0
        Dim iValueCount As Integer = 0
        Dim theValues   As String() = Nothing
        
        IsSinumerikController = False
        IsParpasMachine = False
        
        theUFSession.Cam.AskMachToolDbObject(MachToolDB)
        
        theUFSession.Lib.ExecuteQuery(MachToolDB, "MACHINE", "[DB(libref)] == [" & LibRef & "]", iCount, theRset)
        
        If iCount = 1 Then
            theUFSession.Lib.AskRecordInRset(theRset, 0, iValueCount, theValues)
            
            For Each theValue As String In theValues
                If theValue.Contains("Sinumerik") Then
                    IsSinumerikController = True
                    
                    theSession.LogFile.WriteLine("Machine '" & LibRef & "' has '" & theValue & "' controller ... ")
                End If
                
                If theValue.Contains("Parpas") Then
                    IsParpasMachine = True
                    
                    theSession.LogFile.WriteLine("Machine '" & LibRef & "' is a '" & theValue & "' ... ")
                End If
            Next
        End If
        
        theUFSession.Lib.DeleteRset(theRset)
    End Sub

Hope this helps.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.2, FBM, MRL 3.1.7 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 11.4
Development: C (ITK), .NET, Tcl/Tk Testing: NX12.0 | AWC 3.4 Preparing: NX12.0

Employees of the customers, together we are strong Smiley Wink
How to Get the Most from Your Signature in the Community
NX Customization - Best Practice Guide

Re: Machine Library Information

Creator
Creator
Your code was very helpful. Thank you!