Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

save-as journal

Status
Not open for further replies.

moog2

Mechanical
Jan 16, 2007
441
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]
 
Replies continue below

Recommended for you

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
 
That works like a charm, thanks very much for your help Joe [medal]
 
[bigcheeks]DOH........ 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
 
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
 
[shadeshappy]yep, that works just fine, thanks again for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor