designnewz
Automotive
- Jan 11, 2014
- 52
I have enclosed a vb program I have developed using the Block Styler. Also I have attached the .DLX FILE. My problem is where do I put the code to place the txt on the drawing sheet at a certain size and its font. This program allows the user to activate and pick a number or a series of numbers to place them on the drawing sheet. Any Help in helping me finish this program would be benifical. I can pick the text and place it but the program does not know how big and what the text should look like. I do believe both files attached need to be in the same folder for the .vb to work.
'==============================================================================
' WARNING!! This file is overwritten by the Block UI Styler while generating
' the automation code. Any modifications to this file will be lost after
' generating the code again.
'
' Filename:
'
' This file was generated by the NX Block UI Styler
' Created by:
' Version: NX 9
' Date: 04-24-2018 (Format: mm-dd-yyyy)
' Time: 08:35 (Format: hh-mm)
'
'==============================================================================
'==============================================================================
' Purpose: This file contains template code that will help you create a
' working block-based dialog. You have to "fill in the blanks". Specifically,
' you have to write code within each of the "callback" functions whose stubs
' are shown below. As the user interacts with your dialog, NX will call these
' functions, and your code will be executed. For further information,
' please refer to Chapter 11 of the SNAP Getting Started Guide.
'==============================================================================
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.BlockStyler
'------------------------------------------------------------------------------
'Represents a custom dialog generated by the NX Block UI Styler
'------------------------------------------------------------------------------
Public Class BlockStyler350EX
Inherits Snap.UI.BlockDialog
Public Shared theBlockStyler350EX As BlockStyler350EX
Private Shared theSession As Session
Private Shared theUI As UI
Private theDlxFileName As String
Private theDialog As NXOpen.BlockStyler.BlockDialog
Private group0 As NXOpen.BlockStyler.Group' Block type: Group
Private list_box0 As NXOpen.BlockStyler.ListBox' Block type: List Box
Private list_box01 As NXOpen.BlockStyler.ListBox' Block type: List Box
Private cursorLocation0 As NXOpen.BlockStyler.SpecifyLocation' Block type: Specify Cursor Location
'------------------------------------------------------------------------------
'Constructor to which dlx file with complete path name is passed
'------------------------------------------------------------------------------
Public Sub New(theDlxFileName As String)
Try
Me.NXOpenBlockDialog = New Snap.UI.BlockDialog(theDlxFileName).NXOpenBlockDialog
Me.NXOpenBlockDialog.AddApplyHandler(AddressOf ApplyCallback)
Me.NXOpenBlockDialog.AddOkHandler(AddressOf OkCallback)
Me.NXOpenBlockDialog.AddUpdateHandler(AddressOf UpdateCallback)
Me.NXOpenBlockDialog.AddInitializeHandler(AddressOf InitializeCallback)
Me.NXOpenBlockDialog.AddDialogShownHandler(AddressOf DialogShownCallback)
Catch ex As Exception
Throw ex
End Try
End Sub
'------------------------------------------------------------------------------
Public Shared Sub Main()
Try
' Specify the filename (pathname) of the dlx file
Dim theDlxFileName As String = "C:\Users\sspring\Desktop\PROGRAMS2\350EX.dlx"
theBlockStyler350EX = New BlockStyler350EX(theDlxFileName)
theBlockStyler350EX.Show()
Catch ex As Exception
'---- Enter your exception handling code here -----
Finally
theBlockStyler350EX.Dispose()
theBlockStyler350EX = Nothing
'End If
End Try
End Sub
'------------------------------------------------------------------------------
' This function specifies when/how this application is to be unloaded from memory)
'------------------------------------------------------------------------------
Public Shared Function GetUnloadOption() As Integer
'Return CType(NXOpen.Session.LibraryUnloadOption.Explicitly, Integer) ' By using File-->Utilities-->Unload
Return CType(NXOpen.Session.LibraryUnloadOption.Immediately, Integer) ' Immediately after executing
' Return CType(NXOpen.Session.LibraryUnloadOption.AtTermination, Integer) ' When NX is terminated
End Function
'------------------------------------------------------------------------------
' This function will cleanup any housekeeping chores that may be needed)
'------------------------------------------------------------------------------
Public Shared Sub UnloadLibrary()
End Sub
'------------------------------------------------------------------------------
'InitializeCallback -- called during the dialog construction and just before the values are loaded from dialog memory
'------------------------------------------------------------------------------
Public Sub InitializeCallback()
End Sub
'------------------------------------------------------------------------------
'DialogShownCallback -- called just before the dialog is displayed
'------------------------------------------------------------------------------
Public Sub DialogShownCallback()
'---- Enter your callback code here -----
End Sub
'------------------------------------------------------------------------------
'ApplyCallback -- called when the user clicks the Apply button
'------------------------------------------------------------------------------
Public Function ApplyCallback() As Integer
ApplyCallback = 0
'---- Enter your callback code here -----
End Function
'------------------------------------------------------------------------------
'UpdateCallback -- called whenever the user changes anything in the dialog
'------------------------------------------------------------------------------
Public Function UpdateCallback(ByVal block As NXOpen.BlockStyler.UIBlock) As Integer
UpdateCallback = 0
End Function
'------------------------------------------------------------------------------
'OkCallback -- called when the user clicks the OK button
'------------------------------------------------------------------------------
Public Function OkCallback() As Integer
OkCallback = 0
OkCallback = ApplyCallback()
End Function
'------------------------------------------------------------------------------
'Function Name: GetBlockProperties
'Returns the propertylist of the specified BlockID
'------------------------------------------------------------------------------
Public Function GetBlockProperties(ByVal blockID As String) As PropertyList
GetBlockProperties = Nothing
Try
GetBlockProperties = theDialog.GetBlockProperties(blockID)
Catch ex As Exception
'---- Enter your exception handling code here -----
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
End Try
End Function
End Class
'==============================================================================
' WARNING!! This file is overwritten by the Block UI Styler while generating
' the automation code. Any modifications to this file will be lost after
' generating the code again.
'
' Filename:
'
' This file was generated by the NX Block UI Styler
' Created by:
' Version: NX 9
' Date: 04-24-2018 (Format: mm-dd-yyyy)
' Time: 08:35 (Format: hh-mm)
'
'==============================================================================
'==============================================================================
' Purpose: This file contains template code that will help you create a
' working block-based dialog. You have to "fill in the blanks". Specifically,
' you have to write code within each of the "callback" functions whose stubs
' are shown below. As the user interacts with your dialog, NX will call these
' functions, and your code will be executed. For further information,
' please refer to Chapter 11 of the SNAP Getting Started Guide.
'==============================================================================
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.BlockStyler
'------------------------------------------------------------------------------
'Represents a custom dialog generated by the NX Block UI Styler
'------------------------------------------------------------------------------
Public Class BlockStyler350EX
Inherits Snap.UI.BlockDialog
Public Shared theBlockStyler350EX As BlockStyler350EX
Private Shared theSession As Session
Private Shared theUI As UI
Private theDlxFileName As String
Private theDialog As NXOpen.BlockStyler.BlockDialog
Private group0 As NXOpen.BlockStyler.Group' Block type: Group
Private list_box0 As NXOpen.BlockStyler.ListBox' Block type: List Box
Private list_box01 As NXOpen.BlockStyler.ListBox' Block type: List Box
Private cursorLocation0 As NXOpen.BlockStyler.SpecifyLocation' Block type: Specify Cursor Location
'------------------------------------------------------------------------------
'Constructor to which dlx file with complete path name is passed
'------------------------------------------------------------------------------
Public Sub New(theDlxFileName As String)
Try
Me.NXOpenBlockDialog = New Snap.UI.BlockDialog(theDlxFileName).NXOpenBlockDialog
Me.NXOpenBlockDialog.AddApplyHandler(AddressOf ApplyCallback)
Me.NXOpenBlockDialog.AddOkHandler(AddressOf OkCallback)
Me.NXOpenBlockDialog.AddUpdateHandler(AddressOf UpdateCallback)
Me.NXOpenBlockDialog.AddInitializeHandler(AddressOf InitializeCallback)
Me.NXOpenBlockDialog.AddDialogShownHandler(AddressOf DialogShownCallback)
Catch ex As Exception
Throw ex
End Try
End Sub
'------------------------------------------------------------------------------
Public Shared Sub Main()
Try
' Specify the filename (pathname) of the dlx file
Dim theDlxFileName As String = "C:\Users\sspring\Desktop\PROGRAMS2\350EX.dlx"
theBlockStyler350EX = New BlockStyler350EX(theDlxFileName)
theBlockStyler350EX.Show()
Catch ex As Exception
'---- Enter your exception handling code here -----
Finally
theBlockStyler350EX.Dispose()
theBlockStyler350EX = Nothing
'End If
End Try
End Sub
'------------------------------------------------------------------------------
' This function specifies when/how this application is to be unloaded from memory)
'------------------------------------------------------------------------------
Public Shared Function GetUnloadOption() As Integer
'Return CType(NXOpen.Session.LibraryUnloadOption.Explicitly, Integer) ' By using File-->Utilities-->Unload
Return CType(NXOpen.Session.LibraryUnloadOption.Immediately, Integer) ' Immediately after executing
' Return CType(NXOpen.Session.LibraryUnloadOption.AtTermination, Integer) ' When NX is terminated
End Function
'------------------------------------------------------------------------------
' This function will cleanup any housekeeping chores that may be needed)
'------------------------------------------------------------------------------
Public Shared Sub UnloadLibrary()
End Sub
'------------------------------------------------------------------------------
'InitializeCallback -- called during the dialog construction and just before the values are loaded from dialog memory
'------------------------------------------------------------------------------
Public Sub InitializeCallback()
End Sub
'------------------------------------------------------------------------------
'DialogShownCallback -- called just before the dialog is displayed
'------------------------------------------------------------------------------
Public Sub DialogShownCallback()
'---- Enter your callback code here -----
End Sub
'------------------------------------------------------------------------------
'ApplyCallback -- called when the user clicks the Apply button
'------------------------------------------------------------------------------
Public Function ApplyCallback() As Integer
ApplyCallback = 0
'---- Enter your callback code here -----
End Function
'------------------------------------------------------------------------------
'UpdateCallback -- called whenever the user changes anything in the dialog
'------------------------------------------------------------------------------
Public Function UpdateCallback(ByVal block As NXOpen.BlockStyler.UIBlock) As Integer
UpdateCallback = 0
End Function
'------------------------------------------------------------------------------
'OkCallback -- called when the user clicks the OK button
'------------------------------------------------------------------------------
Public Function OkCallback() As Integer
OkCallback = 0
OkCallback = ApplyCallback()
End Function
'------------------------------------------------------------------------------
'Function Name: GetBlockProperties
'Returns the propertylist of the specified BlockID
'------------------------------------------------------------------------------
Public Function GetBlockProperties(ByVal blockID As String) As PropertyList
GetBlockProperties = Nothing
Try
GetBlockProperties = theDialog.GetBlockProperties(blockID)
Catch ex As Exception
'---- Enter your exception handling code here -----
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
End Try
End Function
End Class