Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Attribute of Type Number

Status
Not open for further replies.

PDW

Automotive
Oct 13, 2010
110
Dear all,

I have, based on thread Link, adapted the Journal and added some more Attributes to fill-in or automatic filled in.

Only with the TextBox11.Text = workPart.GetStringAttribute(myAttributeTitle(10)) i have an issue.
In my NX file the Attribute is not a String Attribute, but of the Type Number.
Does anybody knows a solution for this?


Using NX11, no Database


Code:
'Release "QUA_Set_PartFileAttributes.vb"

'Drive:\Customer\XXXX\Mould\Final\XXXX-YYY.prt
'Drive:\Customer\XXXX\Tool\XXXX-YYY-ZZZ.prt

'This journal updates, based on the OS File Name, several extracted Attributes
'FILE_PATH
'FILE_NAME
'Part_Spec
'PART_NAME
'MOULD_NR
'CUSTOMER_NAME

'***********************************************************************

Option Strict Off
Imports System
Imports NXOpen
Imports System.Windows.Forms

Module Module1

    Dim theSession As Session = Session.GetSession()
    Public workPart As Part = theSession.Parts.Work

    Sub Main()

	    workPart.SetAttribute("FILE_PATH", GetFilePath())

	    workPart.SetAttribute("FILE_NAME", GetFileName())

	    workPart.SetAttribute("Part_Spec", (GetFilePath() & GetFileName())&".prt")

	    workPart.SetAttribute("PART_NAME", GetFilePartName())

	    'workPart.SetAttribute("MOULD_NR", GetFileMould())

	    workPart.SetAttribute("CUSTOMER_NAME", GetFileCustomerName())
	
        Dim myDialog As New Dialog1
        myDialog.myPart = workPart.FullPath
        myDialog.ShowDialog()

    End Sub

    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

    End Function

	Function GetFileName()
	Dim strPath as String
	Dim strPart0 as String
	Dim pos0 as Integer
	
	'get the full file path
	strPath = workPart.fullpath
	'get the part file name
	pos0 = InStrRev(strPath, "\")
	strPart0 = Mid(strPath, pos0 + 1)
	
	strPath = Left(strPath, pos0)
	'strip off the ".prt" extension
	strPart0 = Left(strPart0, Len(strPart0) - 4)
	
	GetFileName = strPart0
End Function

'***********************************************************************

Function GetFilePath()
	Dim strPath as String
	Dim strPart0 as String
	Dim pos0 as Integer
	
	'get the full file path
	strPath = workPart.fullpath
	'get the part file name
	pos0 = InStrRev(strPath, "\")
	strPart0 = Mid(strPath, pos0 + 1)
	
	strPath = Left(strPath, pos0)
	'strip off the ".prt" extension
	strPart0 = Left(strPart0, Len(strPart0) - 4)
	
	GetFilePath = strPath
End Function

'***********************************************************************


Function GetFilePartName()
	Dim strPath as String
	Dim strPart0 as String
	Dim pos0 as Integer
	
	'get the full file path
	strPath = workPart.fullpath
	'get the part file name
	pos0 = InStrRev(strPath, "\")
	strPart0 = Mid(strPath, pos0 + 1)
	strPath = Right(strPath, pos0)
    'strip off the "XXXX "
	strPart0 = Right(strPart0, Len(strPart0) - 5)
	'strip off the ".prt" extension
	strPart0 = Left(strPart0, Len(strPart0) - 4)
	
	GetFilePartName = strPart0

End Function

	
'***********************************************************************

Function GetFileCustomerName()

	Dim strPath as String
	Dim strPart0 as String
	Dim strPart1 as String
	Dim strPart2 as String
	'Dim strPart3 as String
	'Dim strPart4 as String
	Dim pos0 as Integer	   
	Dim pos1 as Integer
    Dim pos2 as Integer
    'Dim pos3 as Integer
    'Dim pos4 as Integer

	'get the full file path
	strPath = workPart.fullpath

	pos0 = InStrRev(strPath, "\")
	strPart0 = Left(strPath, pos0 - 1)
    pos1 = InStrRev(strPart0, "\")
	strPart1 = Right(strPart0, Len(strPart0) - 3)
    pos2 = InStr(strPart1, "\")
	strPart2 = Left(strPart1, pos2 - 1)
    'pos3 = InStrRev(strPart2, "\")
	'strPart3 = Left(strPart2, pos3 - 1)
    'pos4 = InStrRev(strPart3, "\")
	'strPart4 = Left(strPart3, Len(strPart3) - 5)
	
	GetFileCustomerName = strPart2
	
End Function


'***********************************************************************


'Function GetFileMould()

	'Dim strPath as String
	'Dim strPart0 as String
	'Dim strPart1 as String
	'Dim strPart2 as String
	'Dim strPart3 as String
	'Dim pos0 as Integer
	'Dim pos1 as Integer
    'Dim pos2 as Integer
    'Dim pos3 as Integer

	'get the full file path
	'strPath = workPart.fullpath

	'pos0 = InStrRev(strPath, "\")
	'strPart0 = Left(strPath, pos0 - 1)
    'pos1 = InStrRev(strPart0, "\")
	'strPart1 = Right(strPart0, Len(strPart0) - 3)
    'pos2 = InStr(strPart1, "\")
	'strPart2 = Mid(strPart1, pos2 + 1)
    'pos3 = InStr(strPart2, "\")
	'strPart3 = Left(strPart2, pos3 - 1)

	'GetFileMould = strPart3

'End Function

'***********************************************************************

End Module


Public Class Dialog1
    Public myPart As String
    Private myAttributeTitle(23) As String

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.OK

        Try
            workPart.SetAttribute(myAttributeTitle(0), TextBox1.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(0) & " : " & ex.Message)
        End Try

        Try
            workPart.SetAttribute(myAttributeTitle(1), TextBox2.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(1) & " : " & ex.Message)
        End Try

        Try
            workPart.SetAttribute(myAttributeTitle(2), TextBox3.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(2) & " : " & ex.Message)
        End Try

        Try
            workPart.SetAttribute(myAttributeTitle(3), TextBox4.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(3) & " : " & ex.Message)
        End Try

        Try
            workPart.SetAttribute(myAttributeTitle(4), TextBox5.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(4) & " : " & ex.Message)
        End Try

        Try
            workPart.SetAttribute(myAttributeTitle(5), TextBox6.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(5) & " : " & ex.Message)
        End Try

        Try
            workPart.SetAttribute(myAttributeTitle(6), TextBox7.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(6) & " : " & ex.Message)
        End Try

        Try
            workPart.SetAttribute(myAttributeTitle(7), TextBox8.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(7) & " : " & ex.Message)
        End Try

        Try
            workPart.SetAttribute(myAttributeTitle(8), TextBox9.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(9) & " : " & ex.Message)
        End Try

        Try
            workPart.SetAttribute(myAttributeTitle(9), TextBox10.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(9) & " : " & ex.Message)
        End Try

        Try
            workPart.SetAttribute(myAttributeTitle(10), TextBox11.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(10) & " : " & ex.Message)
        End Try
		
		Try
            workPart.SetAttribute(myAttributeTitle(11), TextBox12.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(11) & " : " & ex.Message)
        End Try
		
		Try
            workPart.SetAttribute(myAttributeTitle(12), TextBox13.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(12) & " : " & ex.Message)
        End Try

		
		Try
            workPart.SetAttribute(myAttributeTitle(13), TextBox14.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(13) & " : " & ex.Message)
        End Try		
		
		Try
            workPart.SetAttribute(myAttributeTitle(14), TextBox15.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(14) & " : " & ex.Message)
        End Try
		
		Try
            workPart.SetAttribute(myAttributeTitle(15), TextBox16.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(15) & " : " & ex.Message)
        End Try		
		
		Try
            workPart.SetAttribute(myAttributeTitle(16), TextBox17.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(16) & " : " & ex.Message)
        End Try		
		
		Try
            workPart.SetAttribute(myAttributeTitle(17), TextBox18.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(17) & " : " & ex.Message)
        End Try		
		
		Try
            workPart.SetAttribute(myAttributeTitle(18), TextBox19.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(18) & " : " & ex.Message)
        End Try		
		
		Try
            workPart.SetAttribute(myAttributeTitle(19), TextBox20.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(19) & " : " & ex.Message)
        End Try		
		
		Try
            workPart.SetAttribute(myAttributeTitle(20), TextBox21.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(20) & " : " & ex.Message)
        End Try		
		
		Try
            workPart.SetAttribute(myAttributeTitle(21), TextBox22.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(21) & " : " & ex.Message)
        End Try		
		
		Try
            workPart.SetAttribute(myAttributeTitle(22), TextBox23.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(22) & " : " & ex.Message)
        End Try		
		
		Try
            workPart.SetAttribute(myAttributeTitle(23), TextBox24.Text)
        Catch ex As Exception
            MsgBox(myAttributeTitle(23) & " : " & ex.Message)
        End Try	
		
		Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub Dialog1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Me.Text = myPart
        myAttributeTitle(0) = "CUSTOMER_NAME"
		myAttributeTitle(1) = "PROJECT_NAME"
        myAttributeTitle(2) = "CUSTOMER_PART_NR"
		myAttributeTitle(3) = "ITEM_NR_CMS"
		myAttributeTitle(4) = "MOULD_NR"
        myAttributeTitle(5) = "DESCRIPTION.1"
		myAttributeTitle(6) = "DESCRIPTION.2"
        myAttributeTitle(7) = "MATERIAL.1"
		myAttributeTitle(8) = "MATERIAL.2"
        myAttributeTitle(9) = "SHRINKAGE"
		myAttributeTitle(10) = "SHOT_SIZE"		
		myAttributeTitle(11) = "TREATMENT"
		myAttributeTitle(12) = "QUANTITY"		
        myAttributeTitle(13) = "PART_NAME"
        myAttributeTitle(14) = "TOL_GROUP"        
		myAttributeTitle(15) = "DRAWN"
        myAttributeTitle(16) = "DATE_DRAWN"
		myAttributeTitle(17) = "CHECKED"
		myAttributeTitle(18) = "DATE_CHECKED"
		myAttributeTitle(19) = "APPROVED"
		myAttributeTitle(20) = "DATE_APPROVED"
		myAttributeTitle(21) = "RELEASE_STATUS"		
		myAttributeTitle(22) = "FILE_NAME"
		myAttributeTitle(23) = "FILE_PATH"


        Try
            TextBox1.Text = workPart.GetStringAttribute(myAttributeTitle(0))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox1.Text = ""
        End Try

        Label1.Text = myAttributeTitle(0)


        Try
            TextBox2.Text = workPart.GetStringAttribute(myAttributeTitle(1))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox2.Text = ""
        End Try

        Label2.Text = myAttributeTitle(1)


        Try
            TextBox3.Text = workPart.GetStringAttribute(myAttributeTitle(2))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox3.Text = ""
        End Try

        Label3.Text = myAttributeTitle(2)


        Try
            TextBox4.Text = workPart.GetStringAttribute(myAttributeTitle(3))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox4.Text = ""
        End Try

        Label4.Text = myAttributeTitle(3)


        Try
            TextBox5.Text = workPart.GetStringAttribute(myAttributeTitle(4))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox5.Text = ""
        End Try

        Label5.Text = myAttributeTitle(4)


        Try
            TextBox6.Text = workPart.GetStringAttribute(myAttributeTitle(5))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox6.Text = ""
        End Try

        Label6.Text = myAttributeTitle(5)


        Try
            TextBox7.Text = workPart.GetStringAttribute(myAttributeTitle(6))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox7.Text = ""
        End Try

        Label7.Text = myAttributeTitle(6)

        Try
            TextBox8.Text = workPart.GetStringAttribute(myAttributeTitle(7))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox8.Text = ""
        End Try

        Label8.Text = myAttributeTitle(7)


        Try
            TextBox9.Text = workPart.GetStringAttribute(myAttributeTitle(8))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox9.Text = ""
        End Try

        Label9.Text = myAttributeTitle(8)


        Try
            TextBox10.Text = workPart.GetStringAttribute(myAttributeTitle(9))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox10.Text = ""
        End Try

        Label10.Text = myAttributeTitle(9)


        Try
            TextBox11.Text = workPart.GetStringAttribute(myAttributeTitle(10))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox11.Text = ""
        End Try

        Label11.Text = myAttributeTitle(10)
		
		Try
            TextBox12.Text = workPart.GetStringAttribute(myAttributeTitle(11))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox12.Text = ""
        End Try

        Label12.Text = myAttributeTitle(11)
		
		Try
            TextBox13.Text = workPart.GetStringAttribute(myAttributeTitle(12))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox13.Text = ""
        End Try

        Label13.Text = myAttributeTitle(12)
		
		
		Try
            TextBox14.Text = workPart.GetStringAttribute(myAttributeTitle(13))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox14.Text = ""
        End Try

        Label14.Text = myAttributeTitle(13)
		
		Try
            TextBox15.Text = workPart.GetStringAttribute(myAttributeTitle(14))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox15.Text = ""
        End Try

        Label15.Text = myAttributeTitle(14)
	
		Try
            TextBox16.Text = workPart.GetStringAttribute(myAttributeTitle(15))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox16.Text = ""
        End Try

        Label16.Text = myAttributeTitle(15)
		
		Try
            TextBox17.Text = workPart.GetStringAttribute(myAttributeTitle(16))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox17.Text = ""
        End Try

        Label17.Text = myAttributeTitle(16)
		
		Try
            TextBox18.Text = workPart.GetStringAttribute(myAttributeTitle(17))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox18.Text = ""
        End Try

        Label18.Text = myAttributeTitle(17)

		Try
            TextBox19.Text = workPart.GetStringAttribute(myAttributeTitle(18))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox19.Text = ""
        End Try

        Label19.Text = myAttributeTitle(18)
		
		Try
            TextBox20.Text = workPart.GetStringAttribute(myAttributeTitle(19))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox20.Text = ""
        End Try

        Label20.Text = myAttributeTitle(19)

		Try
            TextBox21.Text = workPart.GetStringAttribute(myAttributeTitle(20))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox21.Text = ""
        End Try

        Label21.Text = myAttributeTitle(20)

		Try
            TextBox22.Text = workPart.GetStringAttribute(myAttributeTitle(21))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox22.Text = ""
        End Try

        Label22.Text = myAttributeTitle(21)
		
		Try
            TextBox23.Text = workPart.GetStringAttribute(myAttributeTitle(22))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox23.Text = ""
        End Try

        Label23.Text = myAttributeTitle(22)
		
		Try
            TextBox24.Text = workPart.GetStringAttribute(myAttributeTitle(23))
        Catch ex As ApplicationException
            'attribute does not exist
            TextBox24.Text = ""
        End Try

        Label24.Text = myAttributeTitle(23)		
	
    End Sub
End Class


<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Dialog1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel()
        Me.OK_Button = New System.Windows.Forms.Button()
        Me.Cancel_Button = New System.Windows.Forms.Button()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.TextBox2 = New System.Windows.Forms.TextBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.TextBox3 = New System.Windows.Forms.TextBox()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.TextBox4 = New System.Windows.Forms.TextBox()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.TextBox5 = New System.Windows.Forms.TextBox()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.TextBox6 = New System.Windows.Forms.TextBox()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.TextBox7 = New System.Windows.Forms.TextBox()
        Me.Label7 = New System.Windows.Forms.Label()
        Me.TextBox8 = New System.Windows.Forms.TextBox()
        Me.Label8 = New System.Windows.Forms.Label()
        Me.TextBox9 = New System.Windows.Forms.TextBox()
        Me.Label9 = New System.Windows.Forms.Label()
        Me.TextBox10 = New System.Windows.Forms.TextBox()
        Me.Label10 = New System.Windows.Forms.Label()
        Me.TextBox11 = New System.Windows.Forms.TextBox()
        Me.Label11 = New System.Windows.Forms.Label()
		Me.TextBox12 = New System.Windows.Forms.TextBox()
        Me.Label12 = New System.Windows.Forms.Label()
        Me.TextBox13 = New System.Windows.Forms.TextBox()
        Me.Label13 = New System.Windows.Forms.Label()
		Me.TextBox14 = New System.Windows.Forms.TextBox()
        Me.Label14 = New System.Windows.Forms.Label()
		Me.TextBox15 = New System.Windows.Forms.TextBox()
        Me.Label15 = New System.Windows.Forms.Label()
		Me.TextBox16 = New System.Windows.Forms.TextBox()
        Me.Label16 = New System.Windows.Forms.Label()
		Me.TextBox17 = New System.Windows.Forms.TextBox()
        Me.Label17 = New System.Windows.Forms.Label()
		Me.TextBox18 = New System.Windows.Forms.TextBox()
        Me.Label18 = New System.Windows.Forms.Label()
		Me.TextBox19 = New System.Windows.Forms.TextBox()
        Me.Label19 = New System.Windows.Forms.Label()
		Me.TextBox20 = New System.Windows.Forms.TextBox()
        Me.Label20 = New System.Windows.Forms.Label()		
		Me.TextBox21 = New System.Windows.Forms.TextBox()
        Me.Label21 = New System.Windows.Forms.Label()		
		Me.TextBox22 = New System.Windows.Forms.TextBox()
        Me.Label22 = New System.Windows.Forms.Label()		
		Me.TextBox23 = New System.Windows.Forms.TextBox()
        Me.Label23 = New System.Windows.Forms.Label()
		Me.TextBox24 = New System.Windows.Forms.TextBox()
        Me.Label24 = New System.Windows.Forms.Label()
		
		Me.TableLayoutPanel1.SuspendLayout()
        Me.SuspendLayout()
        '
        'TableLayoutPanel1
        '
        Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.TableLayoutPanel1.ColumnCount = 2
        Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
        Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
        Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0)
        Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0)
        Me.TableLayoutPanel1.Location = New System.Drawing.Point(277, 618) '(277, 332)
        Me.TableLayoutPanel1.Name = "TableLayoutPanel1"
        Me.TableLayoutPanel1.RowCount = 1
        Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
        Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 29)
        Me.TableLayoutPanel1.TabIndex = 0
        '
        'OK_Button
        '
        Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.OK_Button.Location = New System.Drawing.Point(3, 3)
        Me.OK_Button.Name = "OK_Button"
        Me.OK_Button.Size = New System.Drawing.Size(67, 23)
        Me.OK_Button.TabIndex = 0
        Me.OK_Button.Text = "OK"
        '
        'Cancel_Button
        '
        Me.Cancel_Button.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Cancel_Button.Location = New System.Drawing.Point(76, 3)
        Me.Cancel_Button.Name = "Cancel_Button"
        Me.Cancel_Button.Size = New System.Drawing.Size(67, 23)
        Me.Cancel_Button.TabIndex = 1
        Me.Cancel_Button.Text = "Cancel"
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(149, 23)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(234, 20)
        Me.TextBox1.TabIndex = 2
        ' 
		'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(9, 19)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(134, 26)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "Attribute:"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TextBox2
        '
        Me.TextBox2.Location = New System.Drawing.Point(149, 49)
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.Size = New System.Drawing.Size(234, 20)
        Me.TextBox2.TabIndex = 4
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(9, 45)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(134, 26)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "Attribute:"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TextBox3
        '
        Me.TextBox3.Location = New System.Drawing.Point(149, 75)
        Me.TextBox3.Name = "TextBox3"
        Me.TextBox3.Size = New System.Drawing.Size(234, 20)
        Me.TextBox3.TabIndex = 6
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(9, 71)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(134, 26)
        Me.Label3.TabIndex = 5
        Me.Label3.Text = "Attribute:"
        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TextBox4
        '
        Me.TextBox4.Location = New System.Drawing.Point(149, 101)
        Me.TextBox4.Name = "TextBox4"
        Me.TextBox4.Size = New System.Drawing.Size(234, 20)
        Me.TextBox4.TabIndex = 8
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(9, 97)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(134, 26)
        Me.Label4.TabIndex = 7
        Me.Label4.Text = "Attribute:"
        Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TextBox5
        '
        Me.TextBox5.Location = New System.Drawing.Point(149, 127)
        Me.TextBox5.Name = "TextBox5"
        Me.TextBox5.Size = New System.Drawing.Size(234, 20)
        Me.TextBox5.TabIndex = 10
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(9, 123)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(134, 26)
        Me.Label5.TabIndex = 9
        Me.Label5.Text = "Attribute:"
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
	'
        'TextBox6
        '
        Me.TextBox6.Location = New System.Drawing.Point(149, 153)
        Me.TextBox6.Name = "TextBox6"
        Me.TextBox6.Size = New System.Drawing.Size(234, 20)
        Me.TextBox6.TabIndex = 12
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(9, 149)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(134, 26)
        Me.Label6.TabIndex = 11
        Me.Label6.Text = "Attribute:"
        Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight
	'
        'TextBox7
        '
        Me.TextBox7.Location = New System.Drawing.Point(149, 179)
        Me.TextBox7.Name = "TextBox7"
        Me.TextBox7.Size = New System.Drawing.Size(234, 20)
        Me.TextBox7.TabIndex = 14
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(9, 175)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(134, 26)
        Me.Label7.TabIndex = 13
        Me.Label7.Text = "Attribute:"
        Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight
	'
        'TextBox8
        '
        Me.TextBox8.Location = New System.Drawing.Point(149, 205)
        Me.TextBox8.Name = "TextBox8"
        Me.TextBox8.Size = New System.Drawing.Size(234, 20)
        Me.TextBox8.TabIndex = 16
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(9, 201)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(134, 26)
        Me.Label8.TabIndex = 15
        Me.Label8.Text = "Attribute:"
        Me.Label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight
	'
        'TextBox9
        '
        Me.TextBox9.Location = New System.Drawing.Point(149, 231)
        Me.TextBox9.Name = "TextBox9"
        Me.TextBox9.Size = New System.Drawing.Size(234, 20)
        Me.TextBox9.TabIndex = 18
        '
        'Label9
        '
        Me.Label9.Location = New System.Drawing.Point(9, 227)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(134, 26)
        Me.Label9.TabIndex = 17
        Me.Label9.Text = "Attribute:"
        Me.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight
	'
        'TextBox10
        '
        Me.TextBox10.Location = New System.Drawing.Point(149, 257)
        Me.TextBox10.Name = "TextBox10"
        Me.TextBox10.Size = New System.Drawing.Size(234, 20)
        Me.TextBox10.TabIndex = 20
        '
        'Label10
        '
        Me.Label10.Location = New System.Drawing.Point(9, 253)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(134, 26)
        Me.Label10.TabIndex = 19
        Me.Label10.Text = "Attribute:"
        Me.Label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
        'TextBox11
        '
        Me.TextBox11.Location = New System.Drawing.Point(149, 283)
        Me.TextBox11.Name = "TextBox11"
        Me.TextBox11.Size = New System.Drawing.Size(234, 20)
        Me.TextBox11.TabIndex = 22
        '
        'Label11
        '
        Me.Label11.Location = New System.Drawing.Point(9, 279)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(134, 26)
        Me.Label11.TabIndex = 21
        Me.Label11.Text = "Attribute:"
        Me.Label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
        'TextBox12
        '
        Me.TextBox12.Location = New System.Drawing.Point(149, 309)
        Me.TextBox12.Name = "TextBox12"
        Me.TextBox12.Size = New System.Drawing.Size(234, 20)
        Me.TextBox12.TabIndex = 24
        '
        'Label12
        '
        Me.Label12.Location = New System.Drawing.Point(9, 305)
        Me.Label12.Name = "Label12"
        Me.Label12.Size = New System.Drawing.Size(134, 26)
        Me.Label12.TabIndex = 23
        Me.Label12.Text = "Attribute:"
        Me.Label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
		' Tot hier OK
		'
        'TextBox13
        '
        Me.TextBox13.Location = New System.Drawing.Point(149, 335)
        Me.TextBox13.Name = "TextBox13"
        Me.TextBox13.Size = New System.Drawing.Size(234, 20)
        Me.TextBox13.TabIndex = 26
        '
        'Label13
        '
        Me.Label13.Location = New System.Drawing.Point(9, 331)
        Me.Label13.Name = "Label13"
        Me.Label13.Size = New System.Drawing.Size(134, 26)
        Me.Label13.TabIndex = 25
        Me.Label13.Text = "Attribute:"
        Me.Label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
       'TextBox14
        '
        Me.TextBox14.Location = New System.Drawing.Point(149, 361)
        Me.TextBox14.Name = "TextBox14"
        Me.TextBox14.Size = New System.Drawing.Size(234, 20)
        Me.TextBox14.TabIndex = 28
        '
        'Label14
        '
        Me.Label14.Location = New System.Drawing.Point(9, 357)
        Me.Label14.Name = "Label14"
        Me.Label14.Size = New System.Drawing.Size(134, 26)
        Me.Label14.TabIndex = 27
        Me.Label14.Text = "Attribute:"
        Me.Label14.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'	
       'TextBox15
        '
        Me.TextBox15.Location = New System.Drawing.Point(149, 387)
        Me.TextBox15.Name = "TextBox13"
        Me.TextBox15.Size = New System.Drawing.Size(234, 20)
        Me.TextBox15.TabIndex = 28
        '
        'Label15
        '
        Me.Label15.Location = New System.Drawing.Point(9, 383)
        Me.Label15.Name = "Label15"
        Me.Label15.Size = New System.Drawing.Size(134, 26)
        Me.Label15.TabIndex = 27
        Me.Label15.Text = "Attribute:"
        Me.Label15.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
       'TextBox16
        '
        Me.TextBox16.Location = New System.Drawing.Point(149, 387)
        Me.TextBox16.Name = "TextBox16"
        Me.TextBox16.Size = New System.Drawing.Size(234, 20)
        Me.TextBox16.TabIndex = 30
        '
        'Label16
        '
        Me.Label16.Location = New System.Drawing.Point(9, 383)
        Me.Label16.Name = "Label16"
        Me.Label16.Size = New System.Drawing.Size(134, 26)
        Me.Label16.TabIndex = 29
        Me.Label16.Text = "Attribute:"
        Me.Label16.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
       'TextBox17
        '
        Me.TextBox17.Location = New System.Drawing.Point(149, 413)
        Me.TextBox17.Name = "TextBox17"
        Me.TextBox17.Size = New System.Drawing.Size(234, 20)
        Me.TextBox17.TabIndex = 32
        '
        'Label17
        '
        Me.Label17.Location = New System.Drawing.Point(9, 409)
        Me.Label17.Name = "Label17"
        Me.Label17.Size = New System.Drawing.Size(134, 26)
        Me.Label17.TabIndex = 31
        Me.Label17.Text = "Attribute:"
        Me.Label17.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
       'TextBox18
        '
        Me.TextBox18.Location = New System.Drawing.Point(149, 439)
        Me.TextBox18.Name = "TextBox18"
        Me.TextBox18.Size = New System.Drawing.Size(234, 20)
        Me.TextBox18.TabIndex = 34
        '
        'Label18
        '
        Me.Label18.Location = New System.Drawing.Point(9, 435)
        Me.Label18.Name = "Label18"
        Me.Label18.Size = New System.Drawing.Size(134, 26)
        Me.Label18.TabIndex = 33
        Me.Label18.Text = "Attribute:"
        Me.Label18.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
       'TextBox19
        '
        Me.TextBox19.Location = New System.Drawing.Point(149, 465)
        Me.TextBox19.Name = "TextBox19"
        Me.TextBox19.Size = New System.Drawing.Size(234, 20)
        Me.TextBox19.TabIndex = 36
        '
        'Label19
        '
        Me.Label19.Location = New System.Drawing.Point(9, 461)
        Me.Label19.Name = "Label19"
        Me.Label19.Size = New System.Drawing.Size(134, 26)
        Me.Label19.TabIndex = 35
        Me.Label19.Text = "Attribute:"
        Me.Label19.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
       'TextBox20
        '
        Me.TextBox20.Location = New System.Drawing.Point(149, 491)
        Me.TextBox20.Name = "TextBox20"
        Me.TextBox20.Size = New System.Drawing.Size(234, 20)
        Me.TextBox20.TabIndex = 38
        '
        'Label20
        '
        Me.Label20.Location = New System.Drawing.Point(9, 487)
        Me.Label20.Name = "Label20"
        Me.Label20.Size = New System.Drawing.Size(134, 26)
        Me.Label20.TabIndex = 37
        Me.Label20.Text = "Attribute:"
        Me.Label20.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
       'TextBox21
        '
        Me.TextBox21.Location = New System.Drawing.Point(149, 517)
        Me.TextBox21.Name = "TextBox21"
        Me.TextBox21.Size = New System.Drawing.Size(234, 20)
        Me.TextBox21.TabIndex = 40
        '
        'Label21
        '
        Me.Label21.Location = New System.Drawing.Point(9, 513)
        Me.Label21.Name = "Label21"
        Me.Label21.Size = New System.Drawing.Size(134, 26)
        Me.Label21.TabIndex = 39
        Me.Label21.Text = "Attribute:"
        Me.Label21.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
       'TextBox22
        '
        Me.TextBox22.Location = New System.Drawing.Point(149, 543)
        Me.TextBox22.Name = "TextBox22"
        Me.TextBox22.Size = New System.Drawing.Size(234, 20)
        Me.TextBox22.TabIndex = 42
        '
        'Label22
        '
        Me.Label22.Location = New System.Drawing.Point(9, 539)
        Me.Label22.Name = "Label22"
        Me.Label22.Size = New System.Drawing.Size(134, 26)
        Me.Label22.TabIndex = 41
        Me.Label22.Text = "Attribute:"
        Me.Label22.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
       'TextBox23
        '
        Me.TextBox23.Location = New System.Drawing.Point(149, 569)
        Me.TextBox23.Name = "TextBox23"
        Me.TextBox23.Size = New System.Drawing.Size(234, 20)
        Me.TextBox23.TabIndex = 44
        '
        'Label23
        '
        Me.Label23.Location = New System.Drawing.Point(9, 565)
        Me.Label23.Name = "Label23"
        Me.Label23.Size = New System.Drawing.Size(134, 26)
        Me.Label23.TabIndex = 43
        Me.Label23.Text = "Attribute:"
        Me.Label23.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
       'TextBox24
        '
        Me.TextBox24.Location = New System.Drawing.Point(149, 595)
        Me.TextBox24.Name = "TextBox24"
        Me.TextBox24.Size = New System.Drawing.Size(234, 20)
        Me.TextBox24.TabIndex = 46
        '
        'Label24
        '
        Me.Label24.Location = New System.Drawing.Point(9, 591)
        Me.Label24.Name = "Label24"
        Me.Label24.Size = New System.Drawing.Size(134, 26)
        Me.Label24.TabIndex = 45
        Me.Label24.Text = "Attribute:"
        Me.Label24.TextAlign = System.Drawing.ContentAlignment.MiddleRight
		'
	'
        'Dialog1
        '
        Me.AcceptButton = Me.OK_Button
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.CancelButton = Me.Cancel_Button
        Me.ClientSize = New System.Drawing.Size(500, 649)  '(500, 363)
		Me.Controls.Add(Me.TextBox24)
        Me.Controls.Add(Me.Label24)
		Me.Controls.Add(Me.TextBox23)
        Me.Controls.Add(Me.Label23)
		Me.Controls.Add(Me.TextBox22)
        Me.Controls.Add(Me.Label22)
		Me.Controls.Add(Me.TextBox21)
        Me.Controls.Add(Me.Label21)
		Me.Controls.Add(Me.TextBox20)
        Me.Controls.Add(Me.Label20)
		Me.Controls.Add(Me.TextBox19)
        Me.Controls.Add(Me.Label19)
		Me.Controls.Add(Me.TextBox18)
        Me.Controls.Add(Me.Label18)
		Me.Controls.Add(Me.TextBox17)
        Me.Controls.Add(Me.Label17)
		Me.Controls.Add(Me.TextBox16)
        Me.Controls.Add(Me.Label16)
		Me.Controls.Add(Me.TextBox15)
        Me.Controls.Add(Me.Label15)
		Me.Controls.Add(Me.TextBox14)
        Me.Controls.Add(Me.Label14)
		Me.Controls.Add(Me.TextBox13)
        Me.Controls.Add(Me.Label13)		
		Me.Controls.Add(Me.TextBox12)
        Me.Controls.Add(Me.Label12)
        Me.Controls.Add(Me.TextBox11)
        Me.Controls.Add(Me.Label11)
        Me.Controls.Add(Me.TextBox10)
        Me.Controls.Add(Me.Label10)
        Me.Controls.Add(Me.TextBox9)
        Me.Controls.Add(Me.Label9)
        Me.Controls.Add(Me.TextBox8)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.TextBox7)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.TextBox6)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.TextBox5)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.TextBox4)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.TextBox3)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.TableLayoutPanel1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "Dialog1"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "Dialog1"
        Me.TableLayoutPanel1.ResumeLayout(False)
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel
    Friend WithEvents OK_Button As System.Windows.Forms.Button
    Friend WithEvents Cancel_Button As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents TextBox8 As System.Windows.Forms.TextBox
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents TextBox9 As System.Windows.Forms.TextBox
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents TextBox10 As System.Windows.Forms.TextBox
    Friend WithEvents Label10 As System.Windows.Forms.Label
    Friend WithEvents TextBox11 As System.Windows.Forms.TextBox
    Friend WithEvents Label11 As System.Windows.Forms.Label
	Friend WithEvents TextBox12 As System.Windows.Forms.TextBox
    Friend WithEvents Label12 As System.Windows.Forms.Label
	Friend WithEvents Label13 As System.Windows.Forms.Label
    Friend WithEvents TextBox13 As System.Windows.Forms.TextBox
	Friend WithEvents Label14 As System.Windows.Forms.Label
    Friend WithEvents TextBox14 As System.Windows.Forms.TextBox
	Friend WithEvents Label15 As System.Windows.Forms.Label
    Friend WithEvents TextBox15 As System.Windows.Forms.TextBox
	Friend WithEvents Label16 As System.Windows.Forms.Label
    Friend WithEvents TextBox16 As System.Windows.Forms.TextBox
	Friend WithEvents Label17 As System.Windows.Forms.Label
    Friend WithEvents TextBox17 As System.Windows.Forms.TextBox
	Friend WithEvents Label18 As System.Windows.Forms.Label
    Friend WithEvents TextBox18 As System.Windows.Forms.TextBox
	Friend WithEvents Label19 As System.Windows.Forms.Label
    Friend WithEvents TextBox19 As System.Windows.Forms.TextBox
	Friend WithEvents Label20 As System.Windows.Forms.Label
    Friend WithEvents TextBox20 As System.Windows.Forms.TextBox
	Friend WithEvents Label21 As System.Windows.Forms.Label
    Friend WithEvents TextBox21 As System.Windows.Forms.TextBox
	Friend WithEvents Label22 As System.Windows.Forms.Label
    Friend WithEvents TextBox22 As System.Windows.Forms.TextBox
	Friend WithEvents Label23 As System.Windows.Forms.Label
    Friend WithEvents TextBox23 As System.Windows.Forms.TextBox
	Friend WithEvents Label24 As System.Windows.Forms.Label
    Friend WithEvents TextBox24 As System.Windows.Forms.TextBox	
End Class

 
 https://files.engineering.com/getfile.aspx?folder=e75a93bc-be60-4775-b219-96e4b412b962&file=MCAM_Plastic_StartPart.prt
Replies continue below

Recommended for you

If you don't know the attribute type apriori, you can use the .GetUserAttribute method and query the type from the returned information; if you do know the type, you can use .GetIntegerUserAttribute or .GetRealUserAttribute. If you only need the value as a string value to display in your dialog, you can use the .GetUserAttributeAsString method to convert the value to a string type.

Note that the code in your link was written for NX 7.5 and the .GetAttribute and .SetAttribute methods have since been marked as obsolete. New methods have been added to get/set attributes; it is recommended that you use the new methods.

www.nxjournaling.com
 
Hello Cowski,

In the first post, I have added my Template File.
I do know the Attribute Type, it is of Type Number.
It is the only one, i have a this Type, all others are String, so no issues with those.

Can you help me to solve the Attribute issue for myAttributeTitle(10)

Any help, much appreciated!

Pascal

 
In that case, use the .GetRealUserAttribute method. Pass in the attribute title and index (use -1 for the index if you are not dealing with an array attribute); the method will return the value of the attribute. Something like below (code not tested):

Code:
Dim myValue as Double = myPart.GetRealUserAttribute("theAttributeTitle", -1)


www.nxjournaling.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor