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 for Save As in IGES Format

Status
Not open for further replies.

shan89

Automotive
Dec 14, 2012
19
Hi,

I need a journal to save as assembly files in IGES format in the working directory itself.
I tried to create one looking at some existing journals, but unable to complete my journal. I know nothing about computer languages, so I could be wrong at many or all points.

*************

Option Strict Off
Imports System
Imports System.IO
Imports NXOpen

Module NXJournal
Sub Main

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim fileName As String = IO.Path.GetFileName(workPart.FullPath)
Dim fileNameNoExt As String = IO.Path.GetFileNameWithoutExtension(workPart.FullPath)
Dim parentFolder As String = IO.Path.GetDirectoryName(workPart.FullPath)
Dim root As String = IO.Path.GetPathRoot(workPart.FullPath)


Dim thepath As String = "fileNameNoExt: "
Dim PartExt As String = ".igs"

Dim displayPart As Part = theSession.Parts.Display

Dim partSaveStatus1 As PartSaveStatus

Try
partSaveStatus1 = workPart.SaveAs(thePath+displayPart.Leaf+PartExt)
partSaveStatus1.Dispose()
Catch ex As Exception
End Try

End Sub
End Module

**************

However after running this journal, no error came but no file was created as well.

Thanks in advance,

Ishant
 
Replies continue below

Recommended for you

Hi ,
Try to change the line :
partSaveStatus1 = workPart.SaveAs(thePath+displayPart.Leaf+PartExt)

by this line :
partSaveStatus1 = workPart.SaveAs(IO.Path.GetDirectoryName(workPart.FullPath) & IO.Path.GetFileNameWithoutExtension(workPart.FullPath) & ".igs")
 
Thanks for the help, this journal is running now and creating the iges file on desktop. But I want the Iges to be created in the working directory itself(wherever the part files are placed).

Thanks for your support!
 
completed the journal with little change on following line:

partSaveStatus1 = workPart.SaveAs(IO.Path.GetDirectoryName(workPart.FullPath) & IO.Path.GetFileNameWithoutExtension(workPart.FullPath) & ".igs")

to:

partSaveStatus1 = workPart.SaveAs(IO.Path.GetDirectoryName(workPart.FullPath) & "/" & IO.Path.GetFileNameWithoutExtension(workPart.FullPath) & ".igs")


Thanks for the help,

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor