×
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

save-as journal

save-as journal

save-as journal

(OP)
Can someone help me to create a very simple journal.
I want to be able to save the displayed part (a drawing)
to a specific network folder (the same one every time)
I'll create a button so its a one touch operation.
At the moment i have to go, file-> save-as -> then browse to the folder, and then OK.
(only the drwg needs saving, not the parts below it)
I've tried creating this as a macro, or journal, but it stays tied to the part i create it in.
Help very much appreciated.glasses

RE: save-as journal

Moog2,

This works for a mapped network drive.

' hope this helps,

Joe

CODE

Option Strict On
Imports System
Imports NXOpen

Module NXJournal
Sub Main

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work

Dim thepath As String = "z:\"
Dim PartExt As String = ".prt"

Dim displayPart As Part = theSession.Parts.Display

Dim partSaveStatus1 As PartSaveStatus

partSaveStatus1 = workPart.SaveAs(thePath+displayPart.Leaf+PartExt)

partSaveStatus1.Dispose()

End Sub
End Module 

RE: save-as journal

(OP)
That works like a charm, thanks very much for your help Joe medal

RE: save-as journal

(OP)
bigcheeksDOH........ I spoke too soon, i tried it out at work and everything worked fine, however this has to work at an off-site location, and the destination folder, is on an external hard drive connected locally to a stand alone PC, can someone help adjust the journal to work on a local drive?, thanks

RE: save-as journal

Moog2,

This works (for me) to an external disk attached to the local computer (I:\) (edit as needed).

HTH, Joe

CODE

Option Strict On
Imports System
Imports NXOpen

Module NXJournal
Sub Main

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work

Dim thepath As String = "i:\"
Dim PartExt As String = ".prt"

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 

RE: save-as journal

(OP)
shadeshappyyep, that works just fine, thanks again for your 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