Save Part As from Drawing

Save Part As from Drawing

Anonymous
Not applicable
224 Views
0 Replies
Message 1 of 1

Save Part As from Drawing

Anonymous
Not applicable

Hi all,

 

I have an iLogic rule here that that opens the model contained in a drawing, performs Save As on it and saves it in a predefined Revisions folder, and then closes it.  


Everything is working correctly except that the drawing updates to referencing the newly created file.  I want to continue using the original part file, just saving a copy of the file into a sub folder.  I'm sure this is something simple that I'm missing but I'm at a loss.  Any help would be greatly appreciated.

'Define path that drawing is in.
oDrawingPath = ThisDoc.Path
'Define path that previous drawing revisions are in.
oDrawingRevPath = (ThisDoc.Path & "\" & "Old Revisions\")

'Define various data about the model contained in the drawing.
oModelFullFileName = ThisDrawing.ModelDocument.FullFileName
oModelName = IO.Path.GetFileName(omodelFullFileName)
oModelPath = IO.Path.GetDirectoryName(omodelFullFileName)
oModelNamec = IO.Path.GetFileNameWithoutExtension(oModelFullFileName)

'Opens part.  Change True to False to make part open in background.
openDoc = ThisApplication.Documents.Open(oModelFullFileName, True)

'Get revision number of part.
oModelRevNum = iProperties.Value("Project", "Revision Number")

'Save part as a new file in the revision folder with the revision number in the name.
openDoc.SaveAs(oDrawingRevPath & oModelNamec & " Rev " & oModelRevNum & ".ipt", False)
'Close the part.
openDoc.Close

InventorVb.DocumentUpdate()

*EDIT: Nevermind, I should have done about ten more minutes of investigation.  All I had to do was change this line:

openDoc.SaveAs(oDrawingRevPath & oModelNamec & " Rev " & oModelRevNum & ".ipt", False)

To this:

openDoc.SaveAs(oDrawingRevPath & oModelNamec & " Rev " & oModelRevNum & ".ipt", True)

 

 

0 Likes
225 Views
0 Replies
Replies (0)