cowski,
Sorry for the delay. I ran your program and my template was in the list.
Below is a portion of the program, i can supply the rest if you need it to make sense of it.
The program errors out when I check to see if the file already exists before committing.
I get the "File already exists, Exiting" message, and I have double checked that the file does not exist.
Thanks,
Kevin
' -----------------------------------------------------------------------------------------------------------
' Menu: File->New...
' -----------------------------------------------------------------------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim fileNew1 As FileNew
fileNew1 = theSession.Parts.FileNew()
fileNew1.TemplateFileName = "Sim_Template.prt"
fileNew1.Application = FileNewApplication.Assemblies
fileNew1.Units = Part.Units.Millimeters
fileNew1.TemplateType = FileNewTemplateType.Item
fileNew1.NewFileName = FilePath+"\"+JobNumber+"_Sim_000.prt"
fileNew1.MasterFileName = ""
fileNew1.UseBlankTemplate = False
fileNew1.MakeDisplayedPart = True
Dim nXObject1 As NXObject
lw.Open
lw.WriteLine(fileNew1.NewFileName.ToString)
lw.WriteLine(fileNew1.TemplateFileName.ToString)
lw.Close
'---------------Checking to see if file exists before trying to commit--------------------------------------
Try
nXObject1 = fileNew1.Commit()
Catch ex As NXException
MessageBox.Show("File already exists, Exiting")
Exit Sub
End Try
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
fileNew1.Destroy()