NX Open显示符号(UF_DISP_display_temporary_point)

UF_DISP_display_temporary_point

使用方法:

 1 Dim x As Double = 0, y As Double = 0, z As Double = 0
 2 
 3        Dim theUfSession = UFSession.GetUFSession() 
 4        theUfSession.Disp.Refresh()
 5 
 6        Dim view_tag As NXOpen.Tag = NXOpen.Tag.Null 
 7        theUfSession.View.AskWorkView(view_tag)
 8 
 9        Dim which_views = NXOpen.UF.UFDisp.ViewType.UseWorkView
10 
11        Dim layer_number As Integer = 0 
12        theUfSession.Layer.AskWorkLayer(layer_number) 
13        Dim color As NXOpen.UF.UFObj.DispProps 
14        With color 
15            .layer = layer_number 
16            .color = 216 ' 114 
17            .blank_status = UFConstants.UF_OBJ_NOT_BLANKED 
18            .line_width = UFConstants.UF_OBJ_WIDTH_NORMAL 
19            .highlight_status = True 
20        End With
21 
22        For Each marker_type In [Enum].GetValues(GetType(NXOpen.UF.UFDisp.PolyMarker)) 
23            Try 
24                Dim makerpos() As Double = {x, y, z} 
25                theUfSession.Disp.DisplayTemporaryPoint(view_tag, which_views, makerpos, color, marker_type) 
26            Catch ex As Exception 
27            End Try 
28            Dim ref_point As UFDisp.TextRef = NXOpen.UF.UFDisp.TextRef.Middleleft 
29            Dim text as String = marker_type 
30            Dim text_coord() As Double = {x + 2, y, z} 
31            theUfSession.Disp.DisplayTemporaryText(view_tag, which_views, text, text_coord, ref_point, color, 3, 1) 
32            text = [Enum].GetName(marker_type.GetType, marker_type) 
33            text_coord = {x + 5, y, z} 
34            theUfSession.Disp.DisplayTemporaryText(view_tag, which_views, text, text_coord, ref_point, color, 3, 1) 
35            y -= 2 
36        Next

效果图、序号、名称如下所示:

imageimageimageimage

imageimage

原文地址:https://www.cnblogs.com/bizca/p/4598094.html