Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

journal stopped working between 2212 and 2306

Status
Not open for further replies.

multicaduser

Industrial
Jan 29, 2013
261
Tested this again today, this journal runs without issues in 2212 but errors out in 2306. It depends on a specific directory structure and errors out and any project, so it doesn't look like a file system issue.

Thanks in advance for any help.

ErrorCapture_t3sexy.jpg


Code:
'NX 12
'journal creates burn assembly from displayed part

Imports System
Imports System.Collections.Generic

Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI


Module NXJournal
    Sub Main ()

    Dim theSession As Session = Session.GetSession()
    Dim theUfSession As UFSession = UFSession.GetUFSession()
    Dim ufs As UFSession = UFSession.GetUFSession()
    Dim workPart As Part = theSession.Parts.Work
    Dim displayPart As Part = theSession.Parts.Display
    Dim CurrentPath As String = IO.Path.GetDirectoryName(workPart.FullPath)
    Dim CurrentFile As String = IO.Path.GetFileNameWithoutExtension(workPart.FullPath)
    Dim lw As ListingWindow = theSession.ListingWindow
    Dim fileNew1 As NXOpen.FileNew = Nothing
    fileNew1 = theSession.Parts.FileNew()
    Dim theUI As UI = UI.GetUI

    lw.Open()

'check file location for correctness
    Dim PathPosition As Integer = Instr(1,CurrentPath,"CAD")
    PathPosition = Instr(1,CurrentPath,"CAD")
    Dim restName As String = CurrentFile.Substring(0,CurrentFile.Length)
    Dim BasePath As String = CurrentPath.Substring(0,PathPosition-1)
    lw.writeline(restname)
    lw.Writeline(BasePath)
	'    lw.WriteLine(PathPosition)
    If (PathPosition = 0) Then
        lw.WriteLine("Source file is not in Mold CAD directory")
        lw.WriteLine("Exiting")
        theUFSession.UI.UpdateListingWindow()
        Exit Sub
    End If

'suffix for burn assembly file
    Dim suffixString As String = "_burn"

'build new file/path strings
    Dim BurnFile = RestName & suffixString & ".prt"
    lw.WriteLine(Burnfile)
    Dim BurnPath As String = BasePath & "CAM\Electrode\" & BurnFile
	lw.WriteLine(BurnPath)

'create new file and make it displayed part
    fileNew1.Units = NXOpen.Part.Units.Inches
    fileNew1.TemplateFileName = "model-plain-1-inch-template.prt"
    fileNew1.TemplatePresentationName = "Model"
    fileNew1.NewFileName = BurnPath
    fileNew1.MakeDisplayedPart = True
    fileNew1.DisplayPartOption = NXOpen.DisplayPartOption.AllowAdditional
    fileNew1.Commit()
    workPart = theSession.Parts.Work
    displayPart = theSession.Parts.Display

    fileNew1.Destroy()    

    End Sub

End Module

NX 2212 Windows 10
 
Replies continue below

Recommended for you

Sounds like it cannot find the file: "model-plain-1-inch-template.prt".
I'd suggest searching your 2212 install/custom dirs for this template file and then make sure it is in a similar location for 2306. Also, check the NX log file after getting this error, it might tell you where it expects to find the template file.

www.nxjournaling.com
 
@cowski, you were absolutely right about not being able to find the "model-plain-1-inch-template.prt". This file was in the startup directory, but it was the "ugs_model_templates.pax" file in the startup directory that was the issue. Still not sure what about the "pax" file was the problem because it looks the same, but overwriting it with the one from the 2212 startup directory corrected the issue.

Not sure what the correct way to customize NX is, just keep updating from all the way back to NX5 batch startup file using it to set all the environment variables.

Thanks for your help.

NX 2212 Windows 10
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor