Option Strict Off
Imports System
Imports System.IO
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Utilities
Module GetNCObjectParam
Dim Ses As Session = Session.GetSession()
Dim UFSes As UFSession = UFSession.GetUFSession()
Dim UISes As UI = UI.GetUI()
Dim RemUtil As RemoteUtilities = NXOpen.RemoteUtilities.GetRemoteUtilities()
Dim TempPath As String = Environment.GetEnvironmentVariable("TMP")
Dim UGRelease As String = Nothing
Dim UGFullRelease As String = Nothing
Sub Main
Ses.LogFile.WriteLine("Executing ... " & Ses.ExecutingJournal)
UGRelease = RemUtil.GetEnvironmentVariable("UGII_VERSION")
UGFullRelease = RemUtil.GetEnvironmentVariable("UGII_FULL_VERSION")
Dim NodeCount, iCount, ParamCount, iParam, iValue As Integer
Dim tNodes() As Tag = Nothing
Dim bIsGroup As Boolean
Dim sGroupName As String = Nothing
Dim ParamIndices() As Integer = Nothing
Dim ParamAttrib As New UFParam.IndexAttribute
Dim sValue As String = Nothing
Dim bValue As Boolean
Dim tValue As New Tag
Dim dValue As Double
Dim dValue2(1) As Double
Dim dValue3(2) As Double
Dim sInhereted As String = Nothing
UFSes.Cam.IsSessionInitialized(bIsGroup)
If bIsGroup = False Then
MsgBox("Please change to Manufacturing first!", MsgBoxStyle.Information, "No CAM Session")
Exit Sub
End If
Try
UFSes.UiOnt.AskSelectedNodes(NodeCount, tNodes)
Catch ex As Exception
Ses.LogFile.WriteLine(ex.Message)
End Try
If NodeCount > 0 Then
Ses.ListingWindow.Open()
Ses.ListingWindow.WriteLine("")
For iCount = 0 To NodeCount - 1
UFSes.Ncgroup.IsGroup(tNodes(iCount),bIsGroup)
UFSes.Obj.AskName(tNodes(iCount),sGroupName)
Ses.ListingWindow.WriteLine(sGroupName)
UFSes.Param.AskRequiredParams(tNodes(iCount), ParamCount, ParamIndices)
Array.Sort(ParamIndices)
For iParam = 0 To ParamCount - 1
Try
UFSes.Param.AskParamAttributes(ParamIndices(iParam), ParamAttrib)
UFSes.Param.IsInherited(tNodes(iCount), ParamIndices(iParam), bValue)
If bValue Then
sInhereted = " ... (Inhereted)"
Else
sInhereted = Nothing
End If
Ses.ListingWindow.WriteLine(" " & format(ParamAttrib.key, "00000") & " ... " & ParamAttrib.name & sInhereted)
Select Case ParamAttrib.type
Case UFParam.Type.TypeInt
UFSes.Param.AskIntValue(tNodes(iCount), ParamIndices(iParam), iValue)
Ses.ListingWindow.WriteLine(" IntValue .... " & iValue.ToString)
Case UFParam.Type.TypeDouble
UFSes.Param.AskDoubleValue(tNodes(iCount), ParamIndices(iParam), dValue)
Ses.ListingWindow.WriteLine(" DblValue .... " & dValue.ToString)
Case UFParam.Type.TypeDoubleLength
UFSes.Param.AskDoubleValue(tNodes(iCount), ParamIndices(iParam), dValue)
Ses.ListingWindow.WriteLine(" DblLength .... " & dValue.ToString)
Case UFParam.Type.Type2d
UFSes.Param.Ask2dValue(tNodes(iCount), ParamIndices(iParam), dValue2)
Ses.ListingWindow.WriteLine(" 2DblValue ... " & dValue2(0).ToString & " ... " & dValue2(1).ToString)
Case UFParam.Type.Type2dLength
UFSes.Param.Ask2dValue(tNodes(iCount), ParamIndices(iParam), dValue2)
Ses.ListingWindow.WriteLine(" 2DblLength ... " & dValue2(0).ToString & " ... " & dValue2(1).ToString)
Case UFParam.Type.Type3d
UFSes.Param.Ask3dValue(tNodes(iCount), ParamIndices(iParam), dValue3)
Ses.ListingWindow.WriteLine(" 3DblValue ... " & dValue3(0).ToString & " ... " & dValue3(1).ToString & " ... " & dValue3(2).ToString)
Case UFParam.Type.Type3dLength
UFSes.Param.Ask3dValue(tNodes(iCount), ParamIndices(iParam), dValue3)
Ses.ListingWindow.WriteLine(" 3DblLength ... " & dValue3(0).ToString & " ... " & dValue3(1).ToString & " ... " & dValue3(2).ToString)
Case UFParam.Type.TypeString
UFSes.Param.AskStrValue(tNodes(iCount), ParamIndices(iParam), sValue)
Ses.ListingWindow.WriteLine(" StrValue .... " & sValue)
Case UFParam.Type.TypeLogical
UFSes.Param.AskLogicalValue(tNodes(iCount), ParamIndices(iParam), bValue)
Ses.ListingWindow.WriteLine(" BoolValue ... " & bValue.ToString)
Case UFParam.Type.TypeTag
UFSes.Param.AskTagValue(tNodes(iCount), ParamIndices(iParam), tValue)
If tValue = Tag.Null Then
sValue = "Tag.Null"
Else
Try
UFSes.Obj.AskName(tValue,sValue)
Catch E As Exception
sValue = "Tag Number " & tValue.ToString
End Try
End If
Ses.ListingWindow.WriteLine(" TagName ..... " & sValue)
Case UFParam.Type.TypeByte
Ses.ListingWindow.WriteLine(" Byte")
Case UFParam.Type.TypeChar
Ses.ListingWindow.WriteLine(" Char")
Case UFParam.Type.TypeDate
Ses.ListingWindow.WriteLine(" Date")
Case UFParam.Type.TypeFloat
Ses.ListingWindow.WriteLine(" Float")
Case UFParam.Type.TypeObject
Ses.ListingWindow.WriteLine(" Object")
Case UFParam.Type.TypePointer
Ses.ListingWindow.WriteLine(" Pointer")
Case UFParam.Type.TypeShort
Ses.ListingWindow.WriteLine(" Short")
Case UFParam.Type.TypeVlaInt
Ses.ListingWindow.WriteLine(" Int Array")
Case UFParam.Type.TypeVlaLength
Ses.ListingWindow.WriteLine(" Length Array")
Case UFParam.Type.TypeVlaReal
Ses.ListingWindow.WriteLine(" Real Array")
Case UFParam.Type.TypeVlaString
Ses.ListingWindow.WriteLine(" String Array")
Case UFParam.Type.TypeVlaTag
Ses.ListingWindow.WriteLine(" Tag Array")
End Select
'Display the saved layout, if there is one
If ParamIndices(iParam) = 3105 and sValue <> "" Then
Dim CurLayouts() As Layout = Ses.Parts.Work.Layouts.ToArray
For iCounter As Integer = 0 To CurLayouts.Length - 1
If CurLayouts(iCounter).Name = sValue Then
Dim CurViews() As View = CurLayouts(iCounter).GetViews
Dim CurScale As Double = CurViews(0).Scale
CurLayouts(iCounter).Open
CurViews(0).SetScale(CurScale)
MsgBox(sValue, MsgBoxStyle.Information,"Displaying Layout")
End If
Next
End If
'Display the instances, if there are one
If ParamIndices(iParam) = 7251 Or ParamIndices(iParam) = 7000 Then
Dim iTagCount As Integer = 0
Dim tTagArray As Tag() = Nothing
Dim sTagName As String = Nothing
UFSes.Param.AskTagVla(tNodes(iCount), ParamIndices(iParam), iTagCount, tTagArray)
Ses.ListingWindow.WriteLine(" " & iTagCount.ToString)
For i As Integer = 0 To iTagCount - 1
UFSes.Obj.AskName(tTagArray(i), sTagName)
Ses.ListingWindow.WriteLine(" " & sTagName)
Next i
End If
Catch E As Exception
Ses.ListingWindow.WriteLine(" Error ....... " & ParamAttrib.type.ToString & " ... " & E.Message)
End Try
Next
Next
Else
MsgBox("Please select CAM Object(s) first!", MsgBoxStyle.Information, "No Object selected")
End If
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module
Imports System
Imports System.IO
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Utilities
Module GetNCObjectParam
Dim Ses As Session = Session.GetSession()
Dim UFSes As UFSession = UFSession.GetUFSession()
Dim UISes As UI = UI.GetUI()
Dim RemUtil As RemoteUtilities = NXOpen.RemoteUtilities.GetRemoteUtilities()
Dim TempPath As String = Environment.GetEnvironmentVariable("TMP")
Dim UGRelease As String = Nothing
Dim UGFullRelease As String = Nothing
Sub Main
Ses.LogFile.WriteLine("Executing ... " & Ses.ExecutingJournal)
UGRelease = RemUtil.GetEnvironmentVariable("UGII_VERSION")
UGFullRelease = RemUtil.GetEnvironmentVariable("UGII_FULL_VERSION")
Dim NodeCount, iCount, ParamCount, iParam, iValue As Integer
Dim tNodes() As Tag = Nothing
Dim bIsGroup As Boolean
Dim sGroupName As String = Nothing
Dim ParamIndices() As Integer = Nothing
Dim ParamAttrib As New UFParam.IndexAttribute
Dim sValue As String = Nothing
Dim bValue As Boolean
Dim tValue As New Tag
Dim dValue As Double
Dim dValue2(1) As Double
Dim dValue3(2) As Double
Dim sInhereted As String = Nothing
UFSes.Cam.IsSessionInitialized(bIsGroup)
If bIsGroup = False Then
MsgBox("Please change to Manufacturing first!", MsgBoxStyle.Information, "No CAM Session")
Exit Sub
End If
Try
UFSes.UiOnt.AskSelectedNodes(NodeCount, tNodes)
Catch ex As Exception
Ses.LogFile.WriteLine(ex.Message)
End Try
If NodeCount > 0 Then
Ses.ListingWindow.Open()
Ses.ListingWindow.WriteLine("")
For iCount = 0 To NodeCount - 1
UFSes.Ncgroup.IsGroup(tNodes(iCount),bIsGroup)
UFSes.Obj.AskName(tNodes(iCount),sGroupName)
Ses.ListingWindow.WriteLine(sGroupName)
UFSes.Param.AskRequiredParams(tNodes(iCount), ParamCount, ParamIndices)
Array.Sort(ParamIndices)
For iParam = 0 To ParamCount - 1
Try
UFSes.Param.AskParamAttributes(ParamIndices(iParam), ParamAttrib)
UFSes.Param.IsInherited(tNodes(iCount), ParamIndices(iParam), bValue)
If bValue Then
sInhereted = " ... (Inhereted)"
Else
sInhereted = Nothing
End If
Ses.ListingWindow.WriteLine(" " & format(ParamAttrib.key, "00000") & " ... " & ParamAttrib.name & sInhereted)
Select Case ParamAttrib.type
Case UFParam.Type.TypeInt
UFSes.Param.AskIntValue(tNodes(iCount), ParamIndices(iParam), iValue)
Ses.ListingWindow.WriteLine(" IntValue .... " & iValue.ToString)
Case UFParam.Type.TypeDouble
UFSes.Param.AskDoubleValue(tNodes(iCount), ParamIndices(iParam), dValue)
Ses.ListingWindow.WriteLine(" DblValue .... " & dValue.ToString)
Case UFParam.Type.TypeDoubleLength
UFSes.Param.AskDoubleValue(tNodes(iCount), ParamIndices(iParam), dValue)
Ses.ListingWindow.WriteLine(" DblLength .... " & dValue.ToString)
Case UFParam.Type.Type2d
UFSes.Param.Ask2dValue(tNodes(iCount), ParamIndices(iParam), dValue2)
Ses.ListingWindow.WriteLine(" 2DblValue ... " & dValue2(0).ToString & " ... " & dValue2(1).ToString)
Case UFParam.Type.Type2dLength
UFSes.Param.Ask2dValue(tNodes(iCount), ParamIndices(iParam), dValue2)
Ses.ListingWindow.WriteLine(" 2DblLength ... " & dValue2(0).ToString & " ... " & dValue2(1).ToString)
Case UFParam.Type.Type3d
UFSes.Param.Ask3dValue(tNodes(iCount), ParamIndices(iParam), dValue3)
Ses.ListingWindow.WriteLine(" 3DblValue ... " & dValue3(0).ToString & " ... " & dValue3(1).ToString & " ... " & dValue3(2).ToString)
Case UFParam.Type.Type3dLength
UFSes.Param.Ask3dValue(tNodes(iCount), ParamIndices(iParam), dValue3)
Ses.ListingWindow.WriteLine(" 3DblLength ... " & dValue3(0).ToString & " ... " & dValue3(1).ToString & " ... " & dValue3(2).ToString)
Case UFParam.Type.TypeString
UFSes.Param.AskStrValue(tNodes(iCount), ParamIndices(iParam), sValue)
Ses.ListingWindow.WriteLine(" StrValue .... " & sValue)
Case UFParam.Type.TypeLogical
UFSes.Param.AskLogicalValue(tNodes(iCount), ParamIndices(iParam), bValue)
Ses.ListingWindow.WriteLine(" BoolValue ... " & bValue.ToString)
Case UFParam.Type.TypeTag
UFSes.Param.AskTagValue(tNodes(iCount), ParamIndices(iParam), tValue)
If tValue = Tag.Null Then
sValue = "Tag.Null"
Else
Try
UFSes.Obj.AskName(tValue,sValue)
Catch E As Exception
sValue = "Tag Number " & tValue.ToString
End Try
End If
Ses.ListingWindow.WriteLine(" TagName ..... " & sValue)
Case UFParam.Type.TypeByte
Ses.ListingWindow.WriteLine(" Byte")
Case UFParam.Type.TypeChar
Ses.ListingWindow.WriteLine(" Char")
Case UFParam.Type.TypeDate
Ses.ListingWindow.WriteLine(" Date")
Case UFParam.Type.TypeFloat
Ses.ListingWindow.WriteLine(" Float")
Case UFParam.Type.TypeObject
Ses.ListingWindow.WriteLine(" Object")
Case UFParam.Type.TypePointer
Ses.ListingWindow.WriteLine(" Pointer")
Case UFParam.Type.TypeShort
Ses.ListingWindow.WriteLine(" Short")
Case UFParam.Type.TypeVlaInt
Ses.ListingWindow.WriteLine(" Int Array")
Case UFParam.Type.TypeVlaLength
Ses.ListingWindow.WriteLine(" Length Array")
Case UFParam.Type.TypeVlaReal
Ses.ListingWindow.WriteLine(" Real Array")
Case UFParam.Type.TypeVlaString
Ses.ListingWindow.WriteLine(" String Array")
Case UFParam.Type.TypeVlaTag
Ses.ListingWindow.WriteLine(" Tag Array")
End Select
'Display the saved layout, if there is one
If ParamIndices(iParam) = 3105 and sValue <> "" Then
Dim CurLayouts() As Layout = Ses.Parts.Work.Layouts.ToArray
For iCounter As Integer = 0 To CurLayouts.Length - 1
If CurLayouts(iCounter).Name = sValue Then
Dim CurViews() As View = CurLayouts(iCounter).GetViews
Dim CurScale As Double = CurViews(0).Scale
CurLayouts(iCounter).Open
CurViews(0).SetScale(CurScale)
MsgBox(sValue, MsgBoxStyle.Information,"Displaying Layout")
End If
Next
End If
'Display the instances, if there are one
If ParamIndices(iParam) = 7251 Or ParamIndices(iParam) = 7000 Then
Dim iTagCount As Integer = 0
Dim tTagArray As Tag() = Nothing
Dim sTagName As String = Nothing
UFSes.Param.AskTagVla(tNodes(iCount), ParamIndices(iParam), iTagCount, tTagArray)
Ses.ListingWindow.WriteLine(" " & iTagCount.ToString)
For i As Integer = 0 To iTagCount - 1
UFSes.Obj.AskName(tTagArray(i), sTagName)
Ses.ListingWindow.WriteLine(" " & sTagName)
Next i
End If
Catch E As Exception
Ses.ListingWindow.WriteLine(" Error ....... " & ParamAttrib.type.ToString & " ... " & E.Message)
End Try
Next
Next
Else
MsgBox("Please select CAM Object(s) first!", MsgBoxStyle.Information, "No Object selected")
End If
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module