Save Assembly File to new file name (SaveAs) in NXOpen (Python)

Hello all,

I'm looking for a way to save my NX assembly file to a new name. I can currently save the modifications I make in my journal using:


theSession = NXOpen.Session.GetSession()
theSession.Parts.SaveAll()

I've tried using the following,


import NXOpen.UF
theUFSession = NXOpen.UF.UFSession.GetUFSession()

theUFSession.Part.SaveAs('newFileName')

but I received the following error: "NXOpen.NXException: No write access"

Does anyone have any insight on this? Thanks for any help in advance!

-Sam

I figured it out. For anyone having the save issue that I was having, the workPart must be used such as:


theSession = NXOpen.Session.GetSession()
workPart = theSession.Parts.Work

partSaveStatus1 = workPart.SaveAs('filePath'+'newFileName')
partSaveStatus1.Dispose()

Thanks All!

I would recommend using record Journal command inside of NX and making what you plan to automate using standard NX commands. Use as few actions as possible, when you record the journal.
Then analyze the code and look for what you need to alter (Journal identifiers, filenames) to make the code able to run in different situations.