Johnasti
Automotive
- Jan 14, 2013
- 12
Hello everyone,
I am just getting started with Journaling and am wondering if there is a file/list someplace of generic NX callouts someplace. I would like to start by creating a journal that will allow the user to select various objects (lines/arcs) and then I want to print out/use information related to those objects. Start point, end point, arc centers etc.
I started with this:
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim lw As ListingWindow = theSession.ListingWindow
Dim mySelectedObjects as NXObject()
lw.Open
If SelectObjects("Hey, select multiple somethings", _
mySelectedObjects) = Selection.Response.Ok Then
lw.WriteLine("You selected " & mySelectedObjects.Length & " object(s)")
lw.WriteLine("")
For Each mySelObj As NXObject in mySelectedObjects
lw.WriteLine("Object Tag: " & mySelObj.Tag)
lw.WriteLine("Object Type: " & mySelObj.GetType.ToString)
lw.WriteLine("")
Next
theSession.Information.DisplayObjectsDetails(mySelectedObjects)
End if
' The close method closes the text stream to the window,
' it does not close the window itself
' (use the .CloseWindow() method for that).
' Also, if you are using the listing window to write
' to a file, the close method will clean up and close the file.
lw.Close
End Sub
Function SelectObjects(prompt As String, _
ByRef selObj as NXObject()) As Selection.Response
Dim theUI As UI = UI.GetUI
Dim typeArray() As Selection.SelectionType = _
{Selection.SelectionType.All, _
Selection.SelectionType.Faces, _
Selection.SelectionType.Edges, _
Selection.SelectionType.Features}
Dim resp As Selection.Response = theUI.SelectionManager.SelectObjects( _
prompt, "Selection", _
Selection.SelectionScope.AnyInAssembly, _
False, typeArray, selobj)
If resp = Selection.Response.ObjectSelected Or _
resp = Selection.Response.ObjectSelectedByName Or _
resp = Selection.Response.OK Then
Return Selection.Response.Ok
Else
return Selection.Response.Cancel
End If
End Function
End Module
The problem here is that theSession.Information.DisplayObjectsDetails(mySelectedObjects) spits out everything for every object all at the same time and I want to be able to store/manipulate individual parts of that information. Am I thinking about this the wrong way or do I just need to learn what all of the callouts are?
I am just getting started with Journaling and am wondering if there is a file/list someplace of generic NX callouts someplace. I would like to start by creating a journal that will allow the user to select various objects (lines/arcs) and then I want to print out/use information related to those objects. Start point, end point, arc centers etc.
I started with this:
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim lw As ListingWindow = theSession.ListingWindow
Dim mySelectedObjects as NXObject()
lw.Open
If SelectObjects("Hey, select multiple somethings", _
mySelectedObjects) = Selection.Response.Ok Then
lw.WriteLine("You selected " & mySelectedObjects.Length & " object(s)")
lw.WriteLine("")
For Each mySelObj As NXObject in mySelectedObjects
lw.WriteLine("Object Tag: " & mySelObj.Tag)
lw.WriteLine("Object Type: " & mySelObj.GetType.ToString)
lw.WriteLine("")
Next
theSession.Information.DisplayObjectsDetails(mySelectedObjects)
End if
' The close method closes the text stream to the window,
' it does not close the window itself
' (use the .CloseWindow() method for that).
' Also, if you are using the listing window to write
' to a file, the close method will clean up and close the file.
lw.Close
End Sub
Function SelectObjects(prompt As String, _
ByRef selObj as NXObject()) As Selection.Response
Dim theUI As UI = UI.GetUI
Dim typeArray() As Selection.SelectionType = _
{Selection.SelectionType.All, _
Selection.SelectionType.Faces, _
Selection.SelectionType.Edges, _
Selection.SelectionType.Features}
Dim resp As Selection.Response = theUI.SelectionManager.SelectObjects( _
prompt, "Selection", _
Selection.SelectionScope.AnyInAssembly, _
False, typeArray, selobj)
If resp = Selection.Response.ObjectSelected Or _
resp = Selection.Response.ObjectSelectedByName Or _
resp = Selection.Response.OK Then
Return Selection.Response.Ok
Else
return Selection.Response.Cancel
End If
End Function
End Module
The problem here is that theSession.Information.DisplayObjectsDetails(mySelectedObjects) spits out everything for every object all at the same time and I want to be able to store/manipulate individual parts of that information. Am I thinking about this the wrong way or do I just need to learn what all of the callouts are?