.net ug 二次开发 nx1872 (第四天)

1.视图是否存在

 1 Option Strict Off
 2 Imports NXOpen
 3 
 4 Module Module1
 5     Sub Main()
 6 
 7         Dim theSession As Session = Session.GetSession()
 8         Dim workPart As Part = theSession.Parts.Work
 9         Dim tmpviewname As String = ""
10         Dim tmpExist As Boolean = False
11         Try
12             tmpviewname = workPart.ModelingViews.FindObject("tmp").Name '查询视图tmp的名称
13             tmpExist = True '存在就true
14         Catch ex As Exception
15             tmpviewname = "tmp"
16             tmpExist = False '不存在就false
17         End Try
18         MsgBox("viewname: " & tmpviewname & vbCrLf & "tmpExist: " & tmpExist)
19     End Sub
20 End Module

 

posted @ 2021-10-01 17:20  KingMAX(没事杀杀毒)  阅读(268)  评论(0)    收藏  举报