Option Strict Off Imports System Imports NXOpen Imports NXOpen.BlockStyler '------------------------------------------------------------------------------ 'Represents Block Styler application class '------------------------------------------------------------------------------ Public Class Flaeche 'class members Private Shared theSession As Session Private Shared theUI As UI Public Shared theFlaeche As Flaeche Private theDialogName As String Private theDialog As NXOpen.BlockStyler.BlockDialog Private group0 As NXOpen.BlockStyler.UIBlock' Block type: Group Private face_select0 As NXOpen.BlockStyler.UIBlock' Block type: Face Collector '------------------------------------------------------------------------------ 'Bit Option for Property: EntityType '------------------------------------------------------------------------------ Public Shared ReadOnly EntityType_AllowFaces = 16 Public Shared ReadOnly EntityType_AllowDatums = 32 '------------------------------------------------------------------------------ 'Bit Option for Property: FaceRules '------------------------------------------------------------------------------ Public Shared ReadOnly FaceRules_SingleFace = 1 Public Shared ReadOnly FaceRules_RegionFaces = 2 Public Shared ReadOnly FaceRules_TangentFaces = 4 Public Shared ReadOnly FaceRules_TangentRegionFaces = 8 Public Shared ReadOnly FaceRules_BodyFaces = 16 Public Shared ReadOnly FaceRules_FeatureFaces = 32 Public Shared ReadOnly FaceRules_AdjacentFaces = 64 Public Shared ReadOnly FaceRules_ConnectedBlendFaces = 128 Public Shared ReadOnly FaceRules_AllBlendFaces = 256 Public Shared ReadOnly FaceRules_RibFaces = 512 Public Shared ReadOnly FaceRules_SlotFaces = 1024 Public Shared ReadOnly FaceRules_BossandPocketfaces = 2048 Public Shared ReadOnly FaceRules_MergedRibFaces = 4096 Public Shared ReadOnly FaceRules_AnyFaces = 8192 #Region "Block Styler Dialog Designer generator code" '------------------------------------------------------------------------------ 'Constructor for NX Styler class '------------------------------------------------------------------------------ Public Sub New() Try theSession = Session.GetSession() theUI = UI.GetUI() theDialogName = "Flaeche.dlx" theDialog = theUI.CreateDialog(theDialogName) theDialog.AddApplyHandler(AddressOf apply_cb) theDialog.AddOkHandler(AddressOf ok_cb) theDialog.AddUpdateHandler(AddressOf update_cb) theDialog.AddInitializeHandler(AddressOf initialize_cb) theDialog.AddDialogShownHandler(AddressOf dialogShown_cb) Catch ex As Exception '---- Enter your exception handling code here ----- Throw ex End Try End Sub #End Region '------------------------------- DIALOG LAUNCHING --------------------------------- ' ' Before invoking this application one needs to open any part/empty part in NX ' because of the behavior of the blocks. ' ' Make sure the dlx file is in one of the following locations: ' 1.) From where NX session is launched ' 2.) $UGII_USER_DIR/application ' 3.) For released applications, using UGII_CUSTOM_DIRECTORY_FILE is highly ' recommended. This variable is set to a full directory path to a file ' containing a list of root directories for all custom applications. ' e.g., UGII_CUSTOM_DIRECTORY_FILE=$UGII_ROOT_DIR\menus\custom_dirs.dat ' ' You can create the dialog using one of the following way: ' ' 1. Journal Replay ' ' 1) Replay this file through Tool->Journal->Play Menu. ' ' 2. USER EXIT ' ' 1) Create the Shared Library -- Refer "Block Styler programmer's guide" ' 2) Invoke the Shared Library through File->Execute->NX Open menu. ' '------------------------------------------------------------------------------ Public Shared Sub Main() Try theFlaeche = New Flaeche() ' The following method shows the dialog immediately theFlaeche.Show() Catch ex As Exception '---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) Finally theFlaeche.Dispose() End Try End Sub '------------------------------------------------------------------------------ ' This method specifies how a shared image is unloaded from memory ' within NX. This method gives you the capability to unload an ' internal NX Open application or user exit from NX. Specify any ' one of the three constants as a return value to determine the type ' of unload to perform: ' ' ' Immediately : unload the library as soon as the automation program has completed ' Explicitly : unload the library from the "Unload Shared Image" dialog ' AtTermination : unload the library when the NX session terminates ' ' ' NOTE: A program which associates NX Open applications with the menubar ' MUST NOT use this option since it will UNLOAD your NX Open application image ' from the menubar. '------------------------------------------------------------------------------ Public Shared Function GetUnloadOption(ByVal arg As String) As Integer 'Return CType(Session.LibraryUnloadOption.Explicitly, Integer) Return CType(Session.LibraryUnloadOption.Immediately, Integer) ' Return CType(Session.LibraryUnloadOption.AtTermination, Integer) End Function '------------------------------------------------------------------------------ ' Following method cleanup any housekeeping chores that may be needed. ' This method is automatically called by NX. '------------------------------------------------------------------------------ Public Shared Function UnloadLibrary(ByVal arg As String) As Integer Try Return 0 Catch ex As Exception '---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try End Function '------------------------------------------------------------------------------ 'This method shows the dialog on the screen '------------------------------------------------------------------------------ Public Sub Show() Try theDialog.Show Catch ex As Exception '---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try End Sub '------------------------------------------------------------------------------ 'Method Name: Dispose '------------------------------------------------------------------------------ Public Sub Dispose() If theDialog IsNot Nothing Then theDialog.Dispose() theDialog = Nothing End If End Sub '------------------------------------------------------------------------------ '---------------------Block Styler Callback Functions-------------------------- '------------------------------------------------------------------------------ '------------------------------------------------------------------------------ 'Callback Name: initialize_cb '------------------------------------------------------------------------------ Public Sub initialize_cb() Try group0 = theDialog.TopBlock.FindBlock("group0") face_select0 = theDialog.TopBlock.FindBlock("face_select0") Catch ex As Exception '---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try End Sub '------------------------------------------------------------------------------ 'Callback Name: dialogShown_cb 'This callback is executed just before the dialog launch. Thus any value set 'here will take precedence and dialog will be launched showing that value. '------------------------------------------------------------------------------ Public Sub dialogShown_cb() Try '---- Enter your callback code here ----- Catch ex As Exception '---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try End Sub '------------------------------------------------------------------------------ 'Callback Name: apply_cb '------------------------------------------------------------------------------ Public Function apply_cb() As Integer Try '---- Enter your callback code here ----- Catch ex As Exception '---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try apply_cb = 0 End Function '------------------------------------------------------------------------------ 'Callback Name: update_cb '------------------------------------------------------------------------------ Public Function update_cb(ByVal block As NXOpen.BlockStyler.UIBlock) As Integer Try If block Is face_select0 Then '---- Enter your code here ----- End If Catch ex As Exception '---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try update_cb = 0 End Function '------------------------------------------------------------------------------ 'Callback Name: ok_cb '------------------------------------------------------------------------------ Public Function ok_cb() As Integer Try '---- Enter your callback code here ----- apply_cb() Catch ex As Exception '---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try ok_cb = 0 End Function End Class