由于描述不够详细,我假设ug是指UG NX软件,明细表是指UG NX中的BOM表格。

在VB.NET中,可以使用UG NX的API来读取BOM表格的内容。以下是一个简单的代码示例,用于打开一个BOM表格,并读取其中的行和列:

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports NXOpen

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim theUI As UI = UI.GetUI()
        Dim thePart As Part = theSession.Parts.Work

        '打开BOM表格视图
        Dim bomTable As BomTable = thePart.BomTableManager.GetBomTable("BOM1")
        Dim bomView As BomView = bomTable.CreateBomView()

        '读取表格内容
        Dim rows As Integer = bomView.RowCount
        Dim cols As Integer = bomView.ColumnCount

        For i As Integer = 0 To rows - 1
            For j As Integer = 0 To cols - 1
                Dim cell As BomCell = bomView.GetCell(i, j)
                Console.Write(cell.DisplayText)
            Next
            Console.WriteLine()
        Next

        '关闭BOM表格视图
        bomView.Delete()

    End Sub

End Module

需要注意的是,上述代码仅仅是读取了BOM表格的内容,如果要进行更复杂的操作,还需要使用UG NX API中提供的其他接口和方法。同时,也需要对UG NX软件有一定的了解

ug 利用vbnet二次开发读取明细表内容

原文地址: https://www.cveoy.top/t/topic/hiv4 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录