nxexplorer
Mechanical
- Jun 23, 2010
- 84
I have made a journal for detecting whether the specific attribute already has its value or not.
When it run, there were still got the errors. Need help with the existing codes, below.
My focus is on getting the value of quantity of Integer data type.
******************************************************************************************
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim theUI As UI = UI.GetUI()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim type As Int32 = UFConstants.UF_ATTR_any
Dim workpart As Part = theSession.Parts.Work
Dim title7 As String = "Item_QTY" 'The existing attribute's name in the part
Dim text_title7 As String = "Quantity" 'The text will be shown in The listing Window
Dim value7 As Integer
Dim thePartAttr7 As NXOpen.Tag = NXOpen.Tag.Null
ufs.Attr.AskPartAttribute(thePartAttr7)
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
If thePartAttr7 <> Tag.Null Then
ufs.Attr.FindAttribute(thePartAttr7, type, title7, realtype)
If realtype <> 0 Then
If realtype = UFConstants.UF_ATTR_integer Then
value7 = workpart.GetIntegerAttribute(title7)
lw.WriteLine( text_title7 + " :" + value7)
End If
Else
lw.WriteLine( text_title7 + " : Nilai Attribute belum ada ******************************************* Tolong dilengkapi!")
End If
End If
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module
***************************************************************************************************
Any help is very appreciated, Thank you.
Regards,
Maryadi-Jakarta
When it run, there were still got the errors. Need help with the existing codes, below.
My focus is on getting the value of quantity of Integer data type.
******************************************************************************************
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim theUI As UI = UI.GetUI()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim type As Int32 = UFConstants.UF_ATTR_any
Dim workpart As Part = theSession.Parts.Work
Dim title7 As String = "Item_QTY" 'The existing attribute's name in the part
Dim text_title7 As String = "Quantity" 'The text will be shown in The listing Window
Dim value7 As Integer
Dim thePartAttr7 As NXOpen.Tag = NXOpen.Tag.Null
ufs.Attr.AskPartAttribute(thePartAttr7)
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
If thePartAttr7 <> Tag.Null Then
ufs.Attr.FindAttribute(thePartAttr7, type, title7, realtype)
If realtype <> 0 Then
If realtype = UFConstants.UF_ATTR_integer Then
value7 = workpart.GetIntegerAttribute(title7)
lw.WriteLine( text_title7 + " :" + value7)
End If
Else
lw.WriteLine( text_title7 + " : Nilai Attribute belum ada ******************************************* Tolong dilengkapi!")
End If
End If
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module
***************************************************************************************************
Any help is very appreciated, Thank you.
Regards,
Maryadi-Jakarta