×
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

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

(OP)
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 12.0.1.7 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.

CODE

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")

        lw.Open()

        Dim viewMatrix As Matrix3x3
        viewMatrix = theSession.Parts.Work.Views.WorkView.Matrix
        lw.WriteLine(viewMatrix.ToString)

        Dim viewPt As Point3d = theSession.Parts.Work.Views.WorkView.AbsoluteOrigin
        lw.WriteLine(viewPt.ToString)

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

        lw.Close()

    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 

www.nxjournaling.com

RE: using a vb journal to set wcs to view

(OP)
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 12.0.1.7 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


Resources

White Paper - Implementing a Multi-Domain System
IoT systems are multi-domain designs that often require AMS, Digital, RF, photonics and MEMS elements within the system. Tanner EDA provides an integrated, top-down design flow for IoT design that supports all these design domains. Learn more about key solutions that the Tanner design flow offers for successful IoT system design and verification. 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