×
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

Journal for Save As in IGES Format

Journal for Save As in IGES Format

Journal for Save As in IGES Format

(OP)
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

RE: Journal for Save As in IGES Format

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")

RE: Journal for Save As in IGES Format

(OP)
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!

RE: Journal for Save As in IGES Format

(OP)
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,

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