×
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

NX open program running on viewer?

NX open program running on viewer?

NX open program running on viewer?

(OP)
I have wrote a program that sets the assembly load options to specific folders for a particular set of jobs and then opens the selected assembly with these options. The program works great on my box but it was meant to run on the viewer. All of the functions I am using are available in gateway and the program does run about half way letting the user select the assembly they want to open but then errors out when the actual NX functions are called upon in the program. I am using the "OpenFileDialog" function from windows which is the only part that runs.

Is what I am trying to do even possible on a viewer? I assumed it was because it would let me run a signed .dll and I can carry out all of these functions out manually in gateway, any thoughts?

CODE --> vb.net

Option Strict Off
Option Infer On
Imports NXOpen, System, System.IO, System.Windows.Forms

Public Class OpenMssc

    Public Shared Sub Main()

        Dim fd As OpenFileDialog = New OpenFileDialog()
        Dim strFileName As String

        fd.Title = "Open MSSC Assembly"
        fd.InitialDirectory = "T:\Die_Dept\"
        fd.Filter = "Part files (*.prt*)|*.prt*"
        fd.FilterIndex = 1
        fd.RestoreDirectory = True

        If fd.ShowDialog() = DialogResult.OK Then
            strFileName = fd.FileName
        End If

        Dim fileNumberExt As String
        fileNumberExt = strFileName.Substring(12, 4)

        Dim theSession As Session = Session.GetSession()
        theSession.Parts.LoadOptions.LoadLatest = False
        theSession.Parts.LoadOptions.ComponentLoadMethod = LoadOptions.LoadMethod.SearchDirectories

        Dim searchDirectories1(1) As String
'file locations to search
        searchDirectories1(0) = "T:\Die_Dept\" & fileNumberExt & "\" & fileNumberExt & "_dd\"
        searchDirectories1(1) = "T:\Die_Dept\4333_Kanban\4333_dd\"
        Dim searchSubDirs1(1) As Boolean
        searchSubDirs1(0) = False
        searchSubDirs1(1) = False
        theSession.Parts.LoadOptions.SetSearchDirectories(searchDirectories1, searchSubDirs1)
        theSession.Parts.LoadOptions.ComponentsToLoad = LoadOptions.LoadComponents.All
        theSession.Parts.LoadOptions.UsePartialLoading = True
        theSession.Parts.LoadOptions.UseLightweightRepresentations = False

        Dim basePart1 As BasePart
        Dim partLoadStatus1 As PartLoadStatus
        basePart1 = theSession.Parts.OpenBaseDisplay(strFileName, partLoadStatus1)

        Dim workPart As Part = theSession.Parts.Work
        Dim displayPart As Part = theSession.Parts.Display
        partLoadStatus1.Dispose()
'revert load settings back to default option
        theSession.Parts.LoadOptions.ComponentLoadMethod = LoadOptions.LoadMethod.FromDirectory

    End Sub

End Class 

RE: NX open program running on viewer?

Where does your code die? When you call GetSession, I would guess.

RE: NX open program running on viewer?

(OP)
Yes, as soon as "getsession" is called it errors out and stops working. This is the log file at that point

*/
NX License Error: License server system does not support this feature. [ -18 ]
at NXOpen.Utilities.BaseSession.InitLicense
at NXOpen.Session.GetSession()
at open_mssc.OpenMssc.Main()
*/

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