×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Journal for X, Y, Z format
3

Journal for X, Y, Z format

RE: Journal for X, Y, Z format

Are you asking for the ability to create X,Y,Z expressions of a selected point?

If so, that capability was added in XN 9.0 as the new 'Measure Point' function. Note that the expressions created, either a single 'Point' expression or individual X, Y and Z expressions, are associated with the 'Measure Point' feature which will update if the model is modified and the referenced 'Point' is moved as a result.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.

RE: Journal for X, Y, Z format

You want the coordinates all on one line?

Other than that, I don't see the difference between your example output and what the information window gives you...

www.nxjournaling.com

RE: Journal for X, Y, Z format

(OP)
yes Cowski, all in one line would make it easier to copy and paste to another sheet.

John L.
NX Support
Win 7 64bit NX 7.5.4.4 TC 8.3.1.1

RE: Journal for X, Y, Z format

Attached is a GRIP program that will do what you want. You select the points (as many as you wish) and it will write the data, in the format that you're looking for, to a text file.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.

RE: Journal for X, Y, Z format

Below is a journal that will allow you to select points and write the information directly to the clipboard.

CODE

'April 3, 2014
'select points on screen, copy information to clipboard

Option Strict Off
Imports System
Imports System.Collections.Generic
Imports System.Windows.Forms
Imports NXOpen
Imports NXOpen.UF

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim theUfSession As UFSession = UFSession.GetUFSession

        If IsNothing(theSession.Parts.Work) Then
            'active part required
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work

        Dim pointValues As New List(Of String)
        Dim response1 As Integer = Nothing
        Dim mode1() As Integer = {0, 0}
        Dim pointDisplayMode As Integer = 0
        Dim objectpoint(2) As Double

        Do
            theUfSession.Ui.LockUgAccess(NXOpen.UF.UFConstants.UF_UI_FROM_CUSTOM)
            response1 = theUfSession.Ui.PointSubfunction("Select Point", mode1, pointDisplayMode, objectpoint)
            theUfSession.Ui.UnlockUgAccess(NXOpen.UF.UFConstants.UF_UI_FROM_CUSTOM)

            If response1 = 5 Then
                Dim myPtVal As String = "X = " & objectpoint(0).ToString & " Y = " & objectpoint(1).ToString & " Z = " & objectpoint(2).ToString
                If pointValues.Contains(myPtVal) Then
                    Exit Do
                Else
                    pointValues.Add(myPtVal)
                End If
            End If

        Loop Until response1 <> 5

        Dim myStringBuilder As New Text.StringBuilder
        For Each pt As String In pointValues
            myStringBuilder.Append(pt)
            myStringBuilder.AppendLine()
        Next

        Clipboard.SetText(myStringBuilder.ToString)

    End Sub


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

        '----Other unload options-------
        'Unloads the image immediately after execution within NX
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

        'Unloads the image explicitly, via an unload dialog
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
        '-------------------------------

    End Function

End Module 

www.nxjournaling.com

RE: Journal for X, Y, Z format

(OP)
Thanks John...although I was unable to compile the grs (64bit) - saying we don't have license, but I know we do.
Thanks Cowski, the journal is great.

John L.
NX Support
Win 7 64bit NX 7.5.4.4 TC 8.3.1.1

RE: Journal for X, Y, Z format

I included the executable of the GRIP program. There was no need to recompile it. GRIP is not like other languages in that once you have an executable, it should run on any system.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.

RE: Journal for X, Y, Z format

Thanks Cowski

Journal is very helpful. I've been looking something like this. Is it possible to get point WCS orientation and reduce number of decimal places to 2.

RE: Journal for X, Y, Z format

OK, for what it's worth, I've updated my GRIP program so that it now returns the X,Y,Z values set to 2 decimal places. Also, the method I used to get the coordinates of the points are returning the values in terms of the current WCS (GRIP almost always works in WCS space, which can be good or bad, but in this case, it's good). As before, after downloading the file, edit the extension from .zipper to .zip and then extract the files. I've included but the source and executable, and as before, there is NO need to recompile, it should run on any recent version of NX.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.

RE: Journal for X, Y, Z format

Quote (rafl)

Is it possible to get point WCS orientation and reduce number of decimal places to 2.

Yes it is possible and the changes are pretty easy, which means it is a great time to jump in and get your hands dirty!

To get the desired number of decimal places, you can use a format string in the .ToString method. It will look something like this: [variable].ToString("0.00"). Add the format strings as desired in the following line:

CODE

Dim myPtVal As String = "X = " & objectpoint(0).ToString & " Y = " & objectpoint(1).ToString & " Z = " & objectpoint(2).ToString 

In thread561-325985: Change Global Co-ordinates to Local Co-ordinates using NXOpen? you will find some code to convert absolute coordinates to local (and vice versa). The functions as written expect a Point3D object as input, which we don't use in the journal above. You will need to either create a Point3D object to pass into the function or change the function so it accepts the array of doubles that we do have (either will work).

Happy coding!
Post back with any specific questions.

www.nxjournaling.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources