下面是代码
Imports NXOpen
Imports NXOpen.UF
Imports System.Text
Module Module1
' Explicit Activation
' This entry point is used to activate the application explicitly
Sub Main()
Dim f As New Form1
f.ShowDialog()
' TODO: Add your application code here
End Sub
Sub SXM()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
'Dim theUI As UI = NXOpen.UI.GetUI()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim SS As String
Dim categoy As Tag
Dim i As Integer
Dim cat As UFLayer.CategoryInfo
With cat
.name = ss
.descr = ss
For i = 1 To 255
.layer_mask(i) = False
Next
End With
theUfSession.Layer.CreateCategory(cat, categoy)
End Sub
作者: yl.fu 时间: 2010-3-21 19:12
e4w6ej9aHt2v7作者: zhangcanwei 时间: 2010-3-23 07:17
估计是CategoryInfo类需要进行对象引用,需要声明为实例对象才行作者: UG008 时间: 2010-3-23 19:22
对话“f”I窗体你要先创建好
mports NXOpen
Imports NXOpen.UF
Imports System.Text
Module Module1
' Explicit Activation
' This entry point is used to activate the application explicitly
Dim theSession As Session = Session.GetSession()
'Dim theUI As UI = NXOpen.UI.GetUI()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Sub Main()
Dim f As New Form1
f.ShowDialog()
' TODO: Add your application code here
End Sub
Sub SXM()
Dim SS As String
Dim categoy As Tag
Dim i As Integer
Dim cat As UFLayer.CategoryInfo
With cat
.name = ss
.descr = ss
For i = 1 To 255
.layer_mask(i) = False
Next
End With
theUfSession.Layer.CreateCategory(cat, categoy)
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Module
由常州众城模具设计公司提供资料QQ::119453418作者: ugman 时间: 2010-4-17 19:16
学习了。YYYYY