' Written by Konrad Option Explicit On Option Strict On Imports System Imports System.Windows.Forms Imports System.Environment Imports NXOpen Imports NXOpen.Annotations Imports Microsoft.VisualBasic Module NXJournal Dim nxopenSession As NXOpen.UF.UFSession End module ' Steuerform fuer Vorwaerts / Rueckwaerts Public Class UserSymbolForm Inherits System.Windows.Forms.Form '''''''''''' ' PUBLIC METHODS '''''''''''' Public Shared Sub Main Dim theSession As Session = Session.GetSession() Dim theUI As UI = UI.GetUI() Application.Run(New UserSymbolForm(theSession, theUI )) End Sub Public Sub New(ByVal session As Session, ByVal ui As UI) MyBase.New() m_session = session m_ui = ui 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub ' Returns the data for note creation selected on the form. ' All parameters are output parameters. ' ' This function should only be called after this form has been ' shown to the user and only if the user did not cancel out of ' the form. 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) 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 'Inserted by the Windows Form Designer Friend WithEvents m_ForewardButton As System.Windows.Forms.Button Friend WithEvents m_cancelButton As System.Windows.Forms.Button Friend WithEvents m_BackButton As System.Windows.Forms.Button Friend WithEvents m_Label1 As System.Windows.Forms.Label Private Sub InitializeComponent() Me.m_ForewardButton = New System.Windows.Forms.Button Me.m_cancelButton = New System.Windows.Forms.Button Me.m_BackButton = New System.Windows.Forms.Button Me.m_Label1 = New System.Windows.Forms.Label 'm_ForewardButton 'Me.m_ForewardButton.DialogResult = DialogResult.OK Me.m_ForewardButton.Location = New System.Drawing.Point(86, 37) Me.m_ForewardButton.Name = "m_ForewardButton" Me.m_ForewardButton.TabIndex = 1 Me.m_ForewardButton.Text = "Weiter" AddHandler Me.m_ForewardButton.Click, AddressOf Me.m_ForewardButtonClick ' 'm_cancelButton ' 'Me.m_cancelButton.DialogResult = DialogResult.Cancel Me.m_cancelButton.Location = New System.Drawing.Point(176, 37) Me.m_cancelButton.Name = "m_cancelButton" Me.m_cancelButton.TabIndex = 2 Me.m_cancelButton.Text = "Abbruch" AddHandler Me.m_cancelButton.Click, AddressOf Me.m_cancelButtonClick 'm_BackButton ' 'Me.m_BackButton.DialogResult = DialogResult.No Me.m_BackButton.Location = New System.Drawing.Point(8, 37) Me.m_BackButton.Name = "m_BackButton" Me.m_BackButton.TabIndex = 3 Me.m_BackButton.Text = "Zurueck" AddHandler Me.m_BackButton.Click, AddressOf Me.m_BackButtonClick 'Label1 ' Me.m_Label1.AutoSize = True Me.m_Label1.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.m_Label1.Location = New System.Drawing.Point(20, 12) Me.m_Label1.Name = "Label1" Me.m_Label1.Size = New System.Drawing.Size(123, 19) Me.m_Label1.TabIndex = 0 Me.m_Label1.Text = "Testoberflaeche " + "Stellung " 'UserSymbolForm Me.CancelButton = Me.m_cancelButton Me.ClientSize = New System.Drawing.Size(320, 65) Me.Controls.Add(Me.m_cancelButton) Me.Controls.Add(Me.m_ForewardButton) Me.Controls.Add(Me.m_BackButton) Me.Controls.add(Me.m_Label1) Me.Text = "Umformstudie durchlaufen" Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual i = 1 End Sub Private m_session As Session Private m_ui As UI Dim i as integer Dim nErrs1 As Integer Sub m_BackButtonClick(ByVal sender As Object, ByVal e As EventArgs) Dim workPart As Part = m_session.Parts.Work Dim expression1 As Expression = CType(workPart.Expressions.FindObject("Stellung"), Expression) Dim unit1 As Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit) i = i - 1 if i < 1 then i = 1 end if Me.m_Label1.Text = "Testoberflaeche " + "Stellung " + CStr(i) workPart.Expressions.EditWithUnits(expression1, unit1, CStr(i)) nErrs1 = m_Session.UpdateManager.DoUpdate(0) End Sub Sub m_cancelButtonClick(ByVal sender As Object, ByVal e As EventArgs) Me.close End Sub Sub m_ForewardButtonClick(ByVal sender As Object, ByVal e As EventArgs) Dim workPart As Part = m_session.Parts.Work Dim expression1 As Expression = CType(workPart.Expressions.FindObject("Stellung"), Expression) Dim unit1 As Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit) i = i + 1 if i > 10 then i = 10 end if Me.m_Label1.Text = "Testoberflaeche " + "Stellung " + CStr(i) workPart.Expressions.EditWithUnits(expression1, unit1, CStr(i)) nErrs1 = m_Session.UpdateManager.DoUpdate(0) End Sub End Class