NX Journal vs NX Open - .vb vs compiled - Access Displayed Part
NX Journal vs NX Open - .vb vs compiled - Access Displayed Part
(OP)
I have an NX Journal which I wanted to include in an NX Open application I am working on. The journal starts with:
When I add the declarations from Main into my NXOpen file which is then compiled and run, it doesn't like the line:
Is it possible the displayed part isn't accessible this way from a compiled (.dll) NXOpen file?
Thanks,
Jeff
CODE
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpenUI
Imports NXOpen.UF
Imports NXOpen.Annotations
Imports NXOpen.Utilities
Module NXJournal
Sub Main()
Dim thesession As Session = Session.GetSession
Dim ufsession As UFSession = UFSession.GetUFSession()
Dim dp As Part = thesession.Parts.Display
Dim nc As NoteCollection = dp.Notes When I add the declarations from Main into my NXOpen file which is then compiled and run, it doesn't like the line:
CODE
Dim dp As Part = thesession.Parts.Display
Is it possible the displayed part isn't accessible this way from a compiled (.dll) NXOpen file?
Thanks,
Jeff





RE: NX Journal vs NX Open - .vb vs compiled - Access Displayed Part
No.
Are you sure that you have an open part when the code is run? If there is a CAE or FEM part open, you will get a type mismatch error. If there is no part open, dp will probably just be a null reference.
www.nxjournaling.com
RE: NX Journal vs NX Open - .vb vs compiled - Access Displayed Part
CODE
What would make NX think I don't have a part open when I do?
Jeff
RE: NX Journal vs NX Open - .vb vs compiled - Access Displayed Part
Are you using remoting? or running in batch mode?
www.nxjournaling.com
RE: NX Journal vs NX Open - .vb vs compiled - Access Displayed Part
CODE
Public Class NXTextSelect 'Description: Select Case notes And labels Public Shared Sub Main() Dim thesession As Session = Session.GetSession Dim ufsession As UFSession = UFSession.GetUFSession() Dim dp As Part = thesession.Parts.Display Dim nc As NoteCollection = dp.Notes 'MsgBox("Selecting all text") Try For Each sda As Annotations.SimpleDraftingAid In nc Try Dim nxText() As String Dim line As String Dim undoText As String = "Update Note" Dim undoMark As Session.UndoMarkId Dim i As Integer = 0 'Get the text from the note or label in NX nxText = sda.GetText For Each line In nxText MsgBox(line) i += 1 Next 'Set the text for the note or label in NX sda.SetText(nxText) 'Update so the text changes are applied to the system undoMark = thesession.SetUndoMark(Session.MarkVisibility.Visible, undoText) thesession.UpdateManager.DoUpdate(undoMark) Catch ex As Exception MsgBox(ex.Message & " Couldn't execute") End Try Next Catch e As Exception MsgBox(e.Message & " Couldn't execute") System.Diagnostics.Trace.WriteLine("Problem with traversing selected objects array") System.Diagnostics.Trace.WriteLine(e.ToString) End Try End Sub 'Unloads the image immediately after execution within NX Public Shared Function GetUnloadOption(ByVal dummy As String) As Integer GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately End Function End ClassJeff
RE: NX Journal vs NX Open - .vb vs compiled - Access Displayed Part
www.nxjournaling.com
RE: NX Journal vs NX Open - .vb vs compiled - Access Displayed Part
CODE
Jeff
RE: NX Journal vs NX Open - .vb vs compiled - Access Displayed Part
Did you use the NX author "signing" tool to sign your resulting dll file?
www.nxjournaling.com
RE: NX Journal vs NX Open - .vb vs compiled - Access Displayed Part
Jeff