1、简介
获得部件导航器中所有特征的名称及类型,并打印在信息窗口。代码支持操作记录直接运行(NX9.0测试)。
2、代码
Option Strict Off
Imports System
Imports NXOpen
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
For Each partFeature As Features.Feature In workPart.Features
lw.WriteLine("feature name: " & partFeature.GetFeatureName)
lw.WriteLine("feature type: " & partFeature.GetType.ToString)
lw.WriteLine("")
Next
lw.Close()
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module