Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports NXOpen.Assemblies
Imports System.Windows.Forms
Imports System.IO
Imports System.Collections
Imports System.Collections.Generic
Imports System.Environment
Imports NXOpenUI
Module Module6
Sub Main()
Dim S As Session = Session.GetSession()
Dim workPart As Part = S.Parts.Work
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = S.ListingWindow
Dim layerColorID(256) As Integer
layerColorID(1) = 6
Dim myFaces As New List(Of Face)
If SelectFaces("select faces", myFaces) = Selection.Response.Cancel Then
Exit Sub
End If
Dim displayModification1 As DisplayModification
displayModification1 = S.DisplayManager.NewDisplayModification()
'displayModification1.NewColor = layerColorID(1)
'displayModification1.NewFont = DisplayableObject.ObjectFont.LongDashed
displayModification1.NewWidth = DisplayableObject.ObjectWidth.Thick
displayModification1.ApplyToAllFaces = False
displayModification1.ApplyToOwningParts = False
displayModification1.NewColor = 103
displayModification1.Apply(myFaces.ToArray)
displayModification1.Dispose()
End Sub
Function SelectFaces(ByVal prompt As String, _
ByRef theFaces As List(Of Face)) As Selection.Response
Dim theObjs() As NXObject
Dim theUI As UI = UI.GetUI
Dim typeArray() As Selection.SelectionType = _
{Selection.SelectionType.Faces}
Dim resp As Selection.Response = theUI.SelectionManager.SelectObjects( _
prompt, "Selection", _
Selection.SelectionScope.AnyInAssembly, _
False, typeArray, theObjs)
If resp = Selection.Response.ObjectSelected Or _
resp = Selection.Response.ObjectSelectedByName Or _
resp = Selection.Response.Ok Then
For Each temp As Face In theObjs
theFaces.Add(temp)
Next
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If
End Function
End Module