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


using a vb journal to set wcs to view

using a vb journal to set wcs to view

using a vb journal to set wcs to view

Still moving grip programs to journals, and I'm stuck on two problems. One, how to set the wcs to current view, and second, getting the current view scale. Storing and resetting the current wcs is a piece of cake but to set the wcs to current view is eluding me. Recording a journal creates a static array and is no help in how to do it automatically.

The view scale is being used to scale a note to a readable size for the geometry, and the wcs orientation is to place it normal to the screen. The geometry referenced may be as small as a thimble or as large as a truck tire, and all this is being done in a component not an assembly.

A poke in the right direction for these two questions would be appreciated.

NX Windows 10

RE: using a vb journal to set wcs to view

Below is some old code I have that returns the view matrix and scale. The view matrix can be assigned to the WCS for orientation. If the note that you are adding is temporary information for the user, you can use a "temporary text" object. IIRC, these will maintain the size and orientation on screen as the user zooms & rotates the view; but they will disappear when the view is refreshed.


Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

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

    Dim theUI As UI = UI.GetUI()
    Dim lw As ListingWindow = theSession.ListingWindow

    Sub Main()

        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "NXJ")


        Dim viewMatrix As Matrix3x3
        viewMatrix = theSession.Parts.Work.Views.WorkView.Matrix

        Dim viewPt As Point3d = theSession.Parts.Work.Views.WorkView.AbsoluteOrigin

        lw.WriteLine("view scale: " & theSession.Parts.Work.Views.WorkView.Scale.ToString)


    End Sub

    Public Function GetUnloadOption(ByVal dummy As String) As Integer

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

        '----Other unload options-------
        'Unloads the image when the NX session terminates
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

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

    End Function

End Module 


RE: using a vb journal to set wcs to view

Thank you cowski, that was awesome, one simple line and it's done.

pmiNoteBuilder1.Style.LetteringStyle.GeneralTextSize = (.125/theSession.Parts.Work.Views.WorkView.Scale)

NX Windows 10

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! Already a Member? Login


Research Report - What’s the State of Nonlinear Simulation?
Simulation is an increasingly valuable tool across the product design workflow, but not all simulations are equal. We set out to determine how engineers and product designers make use of specialized analyses, how they incorporate nonlinear simulation into their work and how they rate the available software. Download Now
White Paper – Data Security and Know-How Protection
Our data is constantly exposed to the danger of being intercepted or stolen as it wends its way over global data networks. Data security measures and measures for protecting intellectual property should not, however, first be implemented when data is exchanged – companies must lay the foundation for these measures within their own organization. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close