Johnasti
Automotive
- Jan 14, 2013
- 12
Hello again,
I am hoping one of you could help me out with something I feel like should be fairly easy. I am trying to write a journal that asks the user to select a point on a drawing, then take the information from that point and create a note using that information. The format should look something like:
X= ##.##
Y= ##.##
Z= ##.##
I have started a basic journal that allows me to pick things and display the information to the information window but I am stuck at that point. I know I need to create variables for the X, Y, & Z values but am not sure how to assign the information to each one (or what the proper calls are to get that information without trying to parse the information window). I think I have something set incorrectly with the filter too, because it is not allowing me to pick the original 3d points on the drawing, only 2d intersection points. Another problem here is that the information listed in the information window is not to the global 0,0,0 origin while in drafting but it works correctly from the modeling side. Then in the very end, I would like to have the note automatically add a leader to the selected point if that isn't too difficult. Any help or comments is appreciated!
I am hoping one of you could help me out with something I feel like should be fairly easy. I am trying to write a journal that asks the user to select a point on a drawing, then take the information from that point and create a note using that information. The format should look something like:
X= ##.##
Y= ##.##
Z= ##.##
I have started a basic journal that allows me to pick things and display the information to the information window but I am stuck at that point. I know I need to create variables for the X, Y, & Z values but am not sure how to assign the information to each one (or what the proper calls are to get that information without trying to parse the information window). I think I have something set incorrectly with the filter too, because it is not allowing me to pick the original 3d points on the drawing, only 2d intersection points. Another problem here is that the information listed in the information window is not to the global 0,0,0 origin while in drafting but it works correctly from the modeling side. Then in the very end, I would like to have the note automatically add a leader to the selected point if that isn't too difficult. Any help or comments is appreciated!
Code:
' NX 7.5.3.3
' Journal created by jrh on Tue Aug 13 09:22:30 2013 Eastern Daylight Time
'
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 lw As ListingWindow = theSession.ListingWindow
Dim displayPart As Part = theSession.Parts.Display
Dim mySelectedObject as NXObject()
Dim myPoints() As Point
' ----------------------------------------------
' Menu: Information->Object...
' ----------------------------------------------
lw.open
If SelectObject("Select a point", _
mySelectedObject) = Selection.Response.Ok Then
theSession.Information.DisplayObjectsDetails(mySelectedObject)
End If
lw.close
End Sub
Function SelectObject(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.Curves}
Dim resp As Selection.Response = theUI.SelectionManager.SelectObjects( _
prompt, "Selection", _
Selection.SelectionScope.AnyInAssembly, _
True, 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