Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Imports NXOpen.UI Imports NXOpen.Utilities Module NXJournal Sub Main Dim theSession As Session = Session.GetSession() Dim ufs As UFSession = UFSession.GetUFSession() Dim workPart As Part = theSession.Parts.Work Dim workView As NXOpen.Tag = NXOpen.Tag.Null Dim displayPart As Part = theSession.Parts.Display If theSession.Parts.Work Is Nothing Then Windows.Forms.MessageBox.Show("Kein Teil geladen! - No Part Loaded!") Exit Sub End If 'modulabfrage Dim module_id As Integer = 0 ufs.UF.AskApplicationModule(module_id) 'modulabfrage If module_id = UFConstants.UF_APP_DRAFTING Then Windows.Forms.MessageBox.Show("Bitte ins Modeling wechseln / Please change to modeling") Exit Sub End If theSession.SetUndoMark( Session.MarkVisibility.Visible, "Einfaerben/Color") ' Definition für Farbe ect Dim Farbe = 97 '(Hellblau) Dim Teilschat = True '(Teilweise Schattiert an bei True) Dim Flname = "Kuehlbohrung" '(Name für Bohrung) Dim Flattrn = "MW_HOLE_TYPE" '(Name Flächenattribut) Dim Flattrw = "Kuehlbohrung" '(Wert für Flächenattribut) Dim displayModification1 As DisplayModification displayModification1 = theSession.DisplayManager.NewDisplayModification() displayModification1.ApplyToAllFaces = False displayModification1.NewColor = Farbe displayModification1.PartiallyShaded = Teilschat ' Select Faces Dim objects1() As NXObject SelectFaces(objects1) ' Copy NXObject array to DisplayableObject array Dim objects2(objects1.Length-1) As DisplayableObject Dim ii as Integer = 0 For Each obj as NXObject in objects1 objects2(ii) = objects1(ii) ii = ii+1 Next displayModification1.Apply(objects2) 'Objektattribute auf Flaechen... 'For Each obj as NXObject in objects1 ' obj.SetAttribute(Flattrn, Flattrw) ' 'obj.SetName(Flname) 'Next displayModification1.Dispose() ' Teilschattierte Ansicht 'ufs.View.AskWorkView(workView) 'Dim renderingStyle As UFView.RenderingStyle 'Dim edo As UFView.EdgeDisplayOptions 'ufs.View.AskSurfaceDisplayOptions(workView, renderingStyle, edo) 'ufs.View.SetSurfaceDisplayOptions(workView, _ 'UFView.RenderingStyle.PartiallyShadedStyle, edo) End Sub ' ---------------------------------------------- ' sub to select faces ' ---------------------------------------------- Sub SelectFaces(ByRef selectedObjects As NXObject()) Dim ui As UI = NXOpen.UI.GetUI Dim message As String = "Select Faces" Dim title As String = "Selection" Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart Dim keepHighlighted As Boolean = False Dim includeFeatures As Boolean = False Dim response As Selection.Response Dim selectionAction As Selection.SelectionAction = _ Selection.SelectionAction.ClearAndEnableSpecific Dim selectionMask_array(1) As Selection.MaskTriple With selectionMask_array(0) .Type = UFConstants.UF_solid_type .Subtype = 0 .SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_ANY_FACE End With response = ui.SelectionManager.SelectObjects(message, title, scope, _ selectionAction, includeFeatures, _ keepHighlighted, selectionMask_array, _ selectedObjects) If response = Selection.Response.Cancel Or response = _ Selection.Response.Back Then Return End If End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer Return Session.LibraryUnloadOption.Immediately End Function End Module