07-16-2020
05:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
07-16-2020
05:04 AM
I found a similar post: https://forums.autodesk.com/t5/inventor-customization/ilogic-save-as-rule/td-p/6421308
I want mostly the same as this, but I also want to be able to set save location (preferably in the same box as Forms).
I've therefore added two custom properties.
Custom Property: File Name
Custom Property: Save Location
I've added these two to Forms, so its easy to fill out, but how can I adjust this code to read those values?
Dim oDoc As Inventor.Document = ThisApplication.ActiveDocument
Dim FName As String = oDoc.FullFileName
Dim FNP As Integer = InStrRev(FName, "\", -1)
Dim oPath As String = Left(FName, FNP)
Dim oNewName As String = InputBox("Enter New File Name", "Save as", "Name")
' If the user closes the input box, then stop the function
If oNewName = vbNullString Then Exit Sub
Dim oType As String
Select Case oDoc.DocumentType
Case kPartDocumentObject: oType = ".ipt"
Case kAssemblyDocumentObject: oType = ".iam"
Case kDrawingDocumentObject: oType = ".idw"
End Select
oDoc.SaveAs(oPath & oNewName & oType, True)