• 微信公众号:美女很有趣。 工作之余,放松一下,关注即送10G+美女照片!

.net语言 开发UG NX二次开发 NX12 (第七天)

开发技术 开发技术 4小时前 2次浏览

1.一键去参

 1 Imports NXOpen
 2 Imports NXOpen.UF
 3 Imports NXOpen.UF.UFConstants
 4 Imports NXOpen.Utilities
 5 Imports NXOpen.UF.UFModl
 6 Module NXRemoveParam
 7     Sub Main(ByVal args() As String)
 8         Try
 9             bodyList()
10         Catch
11             msgbox("去参失败")
12         End Try
13     End Sub
14     Function bodyList()
15         Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
16         Dim workPart As NXOpen.Part = theSession.Parts.Work
17         Dim ufs As UFSession = UFSession.GetUFSession()
18         Dim bodyTag As Tag
19         Dim listTag As Tag() = {}
20         ufs.Modl.CreateList(listTag)
21         ufs.Obj.CycleObjsInPart(workPart.Tag(), UF_solid_type, bodyTag)
22         While bodyTag <> Tag.Null
23             Dim type1 As Integer = 0
24             Dim subtype1 As Integer = 0
25             ufs.Obj.AskTypeAndSubtype(bodyTag, type1, subtype1)
26             If type1 = UF_solid_type And subtype1 = UF_solid_body_subtype Then
27                 Dim tmpname As Features() = {}
28                 Dim feat_count As Integer = 0
29                 ufs.Modl.AskBodyFeatures(bodyTag, feat_count, tmpname)
30                 If tmpname(0).feat_type <> "BREP" Or feat_count > 1 Then
31                     ufs.Modl.PutListItem(listTag, bodyTag)
32                 End If
33             End If
34             ufs.Obj.CycleObjsInPart(workPart.Tag(), UF_solid_type, bodyTag)
35         End While
36         ufs.Modl.DeleteBodyParms(listTag)
37         Return True
38     End Function
39 End Module

 


程序员灯塔
转载请注明原文链接:.net语言 开发UG NX二次开发 NX12 (第七天)
喜欢 (0)