×
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

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!


Resources

White Paper - Effects of AIA Quick Guide to UL 489 or UL 1077
The function of a circuit breaker is to provide overload (thermal) and short-circuit (magnetic) protection to a circuit and its downstream components. A circuit breaker functions like an airbag in a car, protecting circuit components and people by tripping the circuit to interrupt the current flow if it detects a fault condition in the control system. Download Now
White Paper - Guide to Integrate Large-Format Additive
As with any new technology, getting into large-format 3D printing begins with investigation. The first question may be a simple one: what does “large-format” mean? For 3D printers, “large” is a relative term. Many extrusion-based (FFF) 3D printers are referred to as desktop machines, because they fit on table space. Some of these have very respectable build volumes – but when it comes to “large-format,” the machines will need their own dedicated floor space. Large-format 3D printers have significant build volumes and are most often found in professional settings, like manufacturing facilities and R&D centers. 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