iCAx开思工具箱

标题: VB.NET FOR UG 二次开发之 查询参数 [打印本页]

作者: 昆山人    时间: 2006-11-8 15:01
标题: VB.NET FOR UG 二次开发之 查询参数
高手帮我看看下面一段代码,我的目的是 选中一个BLOCK 然后把它的参数放在数组size中,并通过msgbox显示出来,可是一直有问题,说什么 请查看LOG FILE,可是又看不懂.

Option Strict Off

Imports System

Imports NXOpen
Imports NXOpen.UI
Imports NXOpen.Utilities
Imports NXOpen.UF

Module select_a_component_demo

    Dim s As Session = Session.GetSession()
    Dim ufs As UFSession = UFSession.GetUFSession()

    Sub Main()
        Dim component As NXOpen.Tag

      

        Dim message As String
        Dim title As String = "Select a COMPONENT"
        Dim scope As Integer = UFConstants.UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY
        Dim response As Integer
        Dim obj As NXOpen.Tag
        Dim view As NXOpen.Tag
        Dim cursor(2) As Double
        Dim mask_cmpnt As UFUi.SelInitFnT = AddressOf mask_for_components

        ufs.Ui.LockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)

        Try
            ufs.Ui.SelectWithSingleDialog(message, title, scope, mask_cmpnt, _
                         Nothing, response, component, cursor, view)

        Finally
            ufs.Ui.UnlockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)
        End Try
        ufs.Disp.SetHighlight(component, 0)
        '============================================
        Dim size() As String
        Dim n As Integer

  

        ufs.Modl.AskBlockParms(component, 0, size)

       For n = 0 To size.Length
            MsgBox(size(n))

        Next
        '============================================

      

    End Sub
    '=================================
    Function mask_for_components(ByVal select_ As IntPtr, _
                       ByVal userdata As IntPtr) As Integer

        Dim num_triples As Integer = 1
        Dim mask_triples(0) As UFUi.Mask
        mask_triples(0).object_type = UFConstants.UF_solid_type
        mask_triples(0).object_subtype = UFConstants.UF_solid_body_subtype
        mask_triples(0).solid_type = UFConstants.UF_UI_SEL_FEATURE_BODY

        ufs.Ui.SetSelMask(select_, _
                           UFUi.SelMaskAction.SelMaskClearAndEnableSpecific, _
                           num_triples, mask_triples)
        Return UFConstants.UF_UI_SEL_SUCCESS

    End Function
    '=================================


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY

    End Function

End Module
作者: 昆山人    时间: 2006-11-9 08:06
前辈们帮帮忙啊
作者: 昆山人    时间: 2006-11-9 09:41
执行到ufs.Modl.AskBlockParms(component, 0, size) 的时候就出错,怎么回事啊??
作者: 昆山人    时间: 2006-11-9 16:12
怎么没有人回答啊???帮帮忙撒




欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3