NXOpen.BlockStyler的一些用法

关于BLOCK UI的一些控件的用法,本人曾经使用的代码,拿出来共享:

Option Strict Off

Imports NXOpen
Imports NXOpen.BlockStyler
Imports System.Runtime.InteropServices

Namespace Bizca.NX.UIBlockStyler
    Public Module UIBlockStylerEx

         _
        
        Public Function GetPropertiesEx(ByVal block As NXOpen.BlockStyler.UIBlock) As UIBlockEx
            Return New UIBlockEx(block)
        End Function

        '#Region "ListBox"
        '         _
        '        Public Sub SetListItems(ByVal ListBox As NXOpen.BlockStyler.ListBox, ByVal stringArray() As String)
        '            ListBox.GetProperties.SetStrings("ListItems", stringArray)
        '        End Sub

        '         _
        '        Public Function GetListItems(ByVal ListBox As NXOpen.BlockStyler.ListBox) as String()
        '            Return ListBox.GetProperties.GetStrings("ListItems")
        '        End Function


        '#End Region


    End Module


    'Public Class ListBoxEx
    '    Inherits NXOpen.BlockStyler.ListBox

    '    Private ower As NXOpen.BlockStyler.ListBox
    '    Public Sub New(ByVal block As NXOpen.BlockStyler.ListBox)
    '        Me.ower = block

    '    End Sub

    '    Property DDDD As String


    '    Public Shared Sub DSS()
    '        With New ListBoxEx(Nothing)
    '            .DDDD = "FFF"
    '        End With
    '        Dim AAAA = Function(X As NXOpen.Tag)
    '                       Return NXOpen.Utilities.NXObjectManager.Get(X)
    '                   End Function
    '        Dim WWW = AAAA(NXOpen.Tag.Null)



    '    End Sub

    'End Class


    Public Class UIBlockEx
        Private ower As NXOpen.BlockStyler.UIBlock

        Public Sub New(ByVal block As NXOpen.BlockStyler.UIBlock)
            Me.ower = block
        End Sub

#Region "General Properties"
        ''' 
        ''' 【通用】设置UIBlock的是否不禁止
        ''' 
        ''' [CSG] TRUE-Block 不禁止,FALSE-Block 禁止
        ''' [CSG] TRUE-Block 不禁止,FALSE-Block 禁止
        ''' [CSG] TRUE-Block 不禁止,FALSE-Block 禁止 
        Public Property Enable As Boolean
            Get
                Return Me.ower.GetProperties.GetLogical("Enable")
            End Get
            Set(ByVal value As Boolean)
                Me.ower.GetProperties.SetLogical("Enable", value)
            End Set
        End Property

        ''' 
        ''' 【通用】设置UIBlock的是否展开(Block必须拥有自己的组)
        ''' 
        ''' [SG] TRUE- 展开,FALSE- 折叠
        ''' [SG] TRUE- 展开,FALSE- 折叠
        ''' Block必须拥有自己的组(设计时才可以指定)
        Public Property Expanded As Boolean
            Get
                Return Me.ower.GetProperties.GetLogical("Expanded")
            End Get
            Set(ByVal value As Boolean)
                Me.ower.GetProperties.SetLogical("Expanded", value)
            End Set
        End Property

        ''' 
        ''' 【通用】标签
        ''' 
        ''' 
        ''' 
        ''' [CSG] Any String Value 
        Public Property Label As String
            Get
                Return Me.ower.GetProperties.GetString("Label")
            End Get
            Set(ByVal value As String)
                Me.ower.GetProperties.SetString("Label", value)
            End Set
        End Property

        ''' 
        ''' 【通用】设置UIBlock的Show可见属性
        ''' 
        ''' [CSG] TRUE-Block 可见,FALSE-Block 不可见
        ''' [CSG] TRUE-Block 可见,FALSE-Block 不可见
        ''' Sets the visibility of the block
        Public Property Show As Boolean
            Get
                Return Me.ower.GetProperties.GetLogical("Show")
            End Get
            Set(ByVal value As Boolean)
                Me.ower.GetProperties.SetLogical("Show", value)
            End Set
        End Property
#End Region



#Region "Selection"
        ''' 
        ''' 【选择对象】自动推进
        ''' 
        ''' 
        ''' 
        ''' 自动推进到下一个UIBlock
        Public Property AutomaticProgression As Boolean
            Get
                Return Me.ower.GetProperties.GetLogical("AutomaticProgression")
            End Get
            Set(ByVal value As Boolean)
                Me.ower.GetProperties.SetLogical("AutomaticProgression", value)
            End Set
        End Property

        ''' 
        ''' 【选择对象】提示字符串
        ''' 
        ''' 
        ''' 
        ''' 状态栏提示字符串
        Public Property Cue As String
            Get
                Return Me.ower.GetProperties.GetString("Cue")
            End Get
            Set(ByVal value As String)
                Me.ower.GetProperties.SetString("Cue", value)
            End Set
        End Property

        ''' 
        ''' 【选择对象】标签字符串
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property LabelString As String
            Get
                Return Me.ower.GetProperties.GetString("LabelString")
            End Get
            Set(ByVal value As String)
                Me.ower.GetProperties.SetString("LabelString", value)
            End Set
        End Property

        ''' 
        ''' 【选择对象】点覆盖
        ''' 
        ''' 
        ''' 
        ''' 是否启用捕捉点
        Public Property PointOverlay As Boolean
            Get
                Return Me.ower.GetProperties.GetLogical("PointOverlay")
            End Get
            Set(ByVal value As Boolean)
                Me.ower.GetProperties.setLogical("PointOverlay",value)
            End Set
        End Property

        ''' 
        ''' 【选择对象】设置选择过滤器
        ''' 
        ''' 
        ''' 
        ''' 
        Public Sub SetSelectionFilter(ByVal maskAction As NXOpen.Selection.SelectionAction, ByVal maskTriples() As NXOpen.Selection.MaskTriple)
            Me.ower.GetProperties.SetSelectionFilter("SelectionFilter", maskAction, maskTriples)
        End Sub

        ''' 
        ''' 【选择对象】选择的对象
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property SelectedObjects As NXOpen.TaggedObject()
            Get
                Return Me.ower.GetProperties.GetTaggedObjectVector("SelectedObjects")
            End Get
            Set(ByVal value As NXOpen.TaggedObject())
                If value IsNot Nothing Then
                    Me.ower.GetProperties.SetTaggedObjectVector("SelectedObjects", value)
                End If
            End Set
        End Property

        ''' 
        ''' 【选择对象】最后取消选择的对象
        ''' 
        ''' 
        ''' 
        ''' 
        Public ReadOnly Property LastDeselectedObjects As NXOpen.TaggedObject()
            Get
                Return Me.ower.GetProperties.GetTaggedObjectVector("LastDeselectedObjects")
            End Get
        End Property

        ''' 
        ''' 【选择对象】最后选择的对象
        ''' 
        ''' 
        ''' 
        ''' 
        Public ReadOnly Property LastSelectedObjects As NXOpen.TaggedObject()
            Get
                Return Me.ower.GetProperties.GetTaggedObjectVector("LastSelectedObjects")
            End Get
        End Property

        ''' 
        ''' 【选择对象】步骤的状态
        ''' 
        ''' 只有当初始化的时候才可以设置该属性
        ''' 
        ''' CIG Required[必须] Optional[可选] Satisfied[满意]
        Public Property StepStatus As StepStatusEnum
            Get
                Return Me.ower.GetProperties.GetEnum("StepStatus")
            End Get
            Set(ByVal value As StepStatusEnum)
                Me.ower.GetProperties.SetEnum("StepStatus", value)
            End Set
        End Property

        ''' 
        ''' 步骤的状态
        ''' 
        ''' 
        Public Enum StepStatusEnum
            ''' 
            ''' 必要的
            ''' 
            ''' 
            [Required] = 0
            ''' 
            ''' 可选的
            ''' 
            ''' 
            [Optional] = 1
            ''' 
            ''' 满意的
            ''' 
            ''' 
            [Satisfied] = 2
        End Enum

        ''' 
        ''' 【选择对象】拾取点
        ''' 
        ''' 
        ''' 
        ''' 选择对象时在屏幕上触击的点
        Public ReadOnly Property PickPoint As NXOpen.Point3d
            Get
                Return Me.ower.GetProperties.GetPoint("PickPoint")
            End Get
        End Property

        ''' 
        ''' 【指定光标位置】显示临时点
        ''' 
        ''' 
        ''' 
        ''' Specify Cursor Location
        Public Property DisplayTemporaryPoint As Boolean
            Get
                Return Me.ower.GetProperties.GetLogical("DisplayTemporaryPoint")
            End Get
            Set(ByVal value As Boolean)
                Me.ower.GetProperties.SetLogical("DisplayTemporaryPoint", value)
            End Set
        End Property

        ''' 
        ''' 【指定光标位置】光标位置
        ''' 
        ''' 
        ''' 
        ''' Specify Cursor Location
        Public Property CursorLocation As NXOpen.Point3d
            Get
                Return Me.ower.GetProperties.GetPoint("CursorLocation")
            End Get
            Set(ByVal value As NXOpen.Point3d)
                Me.ower.GetProperties.SetPoint("CursorLocation", value)
            End Set
        End Property

        ''' 
        ''' 【Specify Point】【Specify Vector】点
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property Point As NXOpen.Point3d
            Get
                Return Me.ower.GetProperties.GetPoint("Point")
            End Get
            Set(ByVal value As NXOpen.Point3d)
                Me.ower.GetProperties.SetPoint("Point", value)
            End Set
        End Property

        ''' 
        ''' 【Specify Vector】矢量
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property Vector As Vector3d
            Get
                Return Me.ower.GetProperties.GetVector("Vector")
            End Get
            Set(ByVal value As Vector3d)
                Me.ower.GetProperties.SetVector("Vector", value)
            End Set
        End Property



#End Region

        
        Public Property LogicalValue As Boolean
            Get
                Return Me.ower.GetProperties.GetLogical("Value")
            End Get
            Set(ByVal value As Boolean)
                Me.ower.GetProperties.SetLogical("Value", value)
            End Set
        End Property

#Region "Enum Block"
        ''' 
        ''' 【Enumeration】枚举值
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property EnumValue As Integer
            Get
                Return Me.ower.GetProperties.GetEnum("Value")
            End Get
            Set(ByVal value As Integer)
                Me.ower.GetProperties.SetEnum("Value", value)
            End Set
        End Property

        ''' 
        ''' 【Enumeration】枚举字符串
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property EnumAsString As String
            Get
                Return Me.ower.GetProperties.GetEnumAsString("Value")
            End Get
            Set(ByVal value As String)
                Me.ower.GetProperties.SetEnumAsString("Value", value)
            End Set
        End Property

        ''' 
        ''' 【Enumeration】枚举字符串数组成员
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property EnumMembers As String()
            Get
                Return Me.ower.GetProperties.GetEnumMembers("Value")
            End Get
            Set(ByVal value As String())
                Me.ower.GetProperties.SetEnumMembers("Value", value)
            End Set
        End Property

#End Region

#Region "Expression"
        ''' 
        ''' 【表达式】【线性尺寸】【角度尺寸】【半径尺寸】【轨迹上的尺寸(沿曲线的位置)】表达式
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property Formula As String
            Get
                Return Me.ower.GetProperties.GetString("Formula")
            End Get
            Set(ByVal value As String)
                Me.ower.GetProperties.SetString("Formula", value)
            End Set
        End Property

        ''' 
        ''' 【线性尺寸】【半径尺寸】手柄方向
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property HandleOrientation As NXOpen.Vector3d
            Get
                Return Me.ower.GetProperties.GetVector("HandleOrientation")
            End Get
            Set(ByVal value As NXOpen.Vector3d)
                Me.ower.GetProperties.SetVector("HandleOrientation", value)
            End Set
        End Property

        ''' 
        ''' 【角度尺寸】手柄X轴方向
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property HandleXAxis As NXOpen.Vector3d
            Get
                Return Me.ower.GetProperties.GetVector("HandleXAxis")
            End Get
            Set(ByVal value As NXOpen.Vector3d)
                Me.ower.GetProperties.SetVector("HandleXAxis", value)
            End Set
        End Property

        ''' 
        ''' 【角度尺寸】手柄Z轴方向
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property HandleZAxis As NXOpen.Vector3d
            Get
                Return Me.ower.GetProperties.GetVector("HandleZAxis")
            End Get
            Set(ByVal value As NXOpen.Vector3d)
                Me.ower.GetProperties.SetVector("HandleZAxis", value)
            End Set
        End Property

        ''' 
        ''' 【线性尺寸】【角度尺寸】【半径尺寸】手柄原点
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property HandleOrigin As NXOpen.Point3d
            Get
                Return Me.ower.GetProperties.GetPoint("HandleOrigin")
            End Get
            Set(ByVal value As NXOpen.Point3d)
                Me.ower.GetProperties.SetPoint("HandleOrigin", value)
            End Set
        End Property

        ''' 
        ''' 【线性尺寸】【角度尺寸】【半径尺寸】【轨迹上的尺寸(沿曲线的位置)】显示焦点手柄
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property ShowFocusHandle As Boolean
            Get
                Return Me.ower.GetProperties.GetLogical("ShowFocusHandle")
            End Get
            Set(ByVal value As Boolean)
                Me.ower.GetProperties.SetLogical("ShowFocusHandle", value)
            End Set
        End Property

        ''' 
        ''' 【线性尺寸】【角度尺寸】【半径尺寸】显示手柄
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property ShowHandle As Boolean
            Get
                Return Me.ower.GetProperties.GetLogical("ShowHandle")
            End Get
            Set(ByVal value As Boolean)
                Me.ower.GetProperties.SetLogical("ShowHandle", value)
            End Set
        End Property

#End Region
        ''' 
        ''' 【String】字符串值
        ''' 
        ''' 
        ''' 
        ''' 
        Public Property StringValue As String
            Get
                Return Me.ower.GetProperties.GetString("Value")
            End Get
            Set(ByVal value As String)
                Me.ower.GetProperties.SetString("Value", value)
            End Set
        End Property

        Public Property StringArrayValue As String()
            Get
                Return Me.ower.GetProperties.GetStrings("Value")
            End Get
            Set(ByVal value As String())
                Me.ower.GetProperties.SetStrings("Value", value)
            End Set
        End Property

        Public Property IntegerValue As Integer
            Get
                Return Me.ower.GetProperties.GetInteger("Value")
            End Get
            Set(ByVal value As Integer)
                Me.ower.GetProperties.SetInteger("Value", value)
            End Set
        End Property

        Public Property DoubleValue As Double
            Get
                Return Me.ower.GetProperties.GetDouble("Value")
            End Get
            Set(ByVal value As Double)
                Me.ower.GetProperties.SetDouble("Value", value)
            End Set
        End Property

#Region "Selection with Browse"

        ''' 
        ''' 指定选择文件或文件夹的路径 
        ''' 
        ''' 
        ''' 
        ''' 任何代表有效的文件路径或文件夹路径的字符串。
        Public Property Path As String
            Get
                Return Me.ower.GetProperties.GetString("Path")
            End Get
            Set(ByVal value As String)
                Me.ower.GetProperties.SetString("Path", value)
            End Set
        End Property

        ''' 
        ''' 指定筛选器的格式为"*.txt,*.xml"。如果未设置此属性,嵌以.prt作为默认的过滤器。
        ''' 
        ''' 
        ''' 
        ''' 字符串值的格式为"*.txt,*.xml"。如果空白,则以.prt作为默认的过滤器。
        Public Property Filter As String
            Get
                Return Me.ower.GetProperties.GetString("Filter")
            End Get
            Set(ByVal value As String)
                Me.ower.GetProperties.SetString("Filter", value)
            End Set
        End Property

#End Region

    End Class
End Namespace

转载于:https://www.cnblogs.com/bizca/p/4964329.html

你可能感兴趣的:(NXOpen.BlockStyler的一些用法)