Imports System Imports NXOpen Imports NXOpen.UF Imports NXOpen.Selection Module set_object_color Dim sess As Session = Session.GetSession() Dim ufs As UFSession = UFSession.GetUFSession Dim lw As ListingWindow = sess.ListingWindow Dim sm As Selection = UI.GetUI.SelectionManager Sub Main() Dim col_num As Integer ufs.Disp.AskClosestColorInDisplayedPart(UFDisp.ColorName.BlueName, col_num) Dim selected As NXObject = sel_obj_single_typfilt() If selected IsNot Nothing Then CType(selected, DisplayableObject).Color = col_num CType(selected, DisplayableObject).RedisplayObject() End If End Sub Private Function sel_obj_single_typfilt() As NXObject Dim mess As String = "Select a Face" Dim title As String = "Selection of a single face" Dim scope As SelectionScope = SelectionScope.AnyInAssembly Dim keep_hl As Boolean = False Dim type_arr() As SelectionType = {SelectionType.Faces} Dim obj As NXObject = Nothing Dim cursor As Point3d Dim sel_resp As Response sel_resp = sm.SelectObject(mess, title, scope, keep_hl, type_arr, obj, cursor) If sel_resp < 4 Then Return Nothing Return obj End Function End Module