Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I had an ilogic rule that triggered when I started a new part or assembly file.
It would take the part number property, and split it up, create a filepath from the information, and then save the file to that location.
After installing 2019, this seems to be broken. It seems to hang on the:
oDoc.SaveAs(oNewNamePurchased, False)
Has something changed in 2019 to break this code?
If ThisDoc.Path="" Then 'If document has not been saved before... If iProperties.Value("Project", "Part Number") <> "" Then 'part number property is blank then do not autosave If iProperties.Value("Project", "Description") = "" Then 'If the Description is empty... ' GiveDescription=MessageBox.Show("You have not given this part a Description (Component name). Would you like to do so now?", "Missing Description",MessageBoxButtons.YesNo,MessageBoxIcon.Exclamation) ' If GiveDescription=DialogResult.Yes Then 'If the user wants to provide a Description... iProperties.Value("Project", "Description") = InputBox("Please Enter Description:", "Part Description", "") ' End If End If 'define the active document oDoc = ThisDoc.Document Dim oType As String Select Case oDoc.DocumentType Case kPartDocumentObject: oType = ".ipt" Case kAssemblyDocumentObject: oType = ".iam" Case kDrawingDocumentObject: oType = ".idw" End Select 'create a file dialog box Dim oFileDlg As Inventor.FileDialog = Nothing InventorVb.Application.CreateFileDialog(oFileDlg) 'Set dialog filter 'oFileDlg.Filter = "Autodesk Inventor Part Files (*.ipt)|*.ipt" 'set the directory to open the dialog at oFileDlg.InitialDirectory = "C:\Vault-Local\Designs\" 'set the file name string to use in the input box as the value entered in Excel Spreadsheet oFileDlg.FileName = iProperties.Value("Project", "Part Number") oName = iProperties.Value("Project", "Part Number") 'grab first 2 characters of filename oFolder1 = Left(oName, + 2) 'If filename begins with V- then save to purchased folder If oFolder1 = "V-" Then oFolderPurchased = "V-XXXXXXX" Dim oPathPurchased As String oPathPurchased = "C:\Vault-Local\Designs\" & oFolderPurchased & "\" Dim oNewNamePurchased As String oNewNamePurchased = oPathPurchased & oName & oType 'MessageBox.Show(oNewNamePurchased, "Generated filepath") oDoc.SaveAs(oNewNamePurchased, False) End If 'If filename does not begin with V- then save to the correct production folder If oFolder1 <> "V-" Then 'Grab first 4 characters of filename and then drop first 2, keeping 3rd and 4th oFolder2a = Left(oName, + 4) oFolder2 = Right(oFolder2a, + 2) Dim oPath As String oPath = "C:\Vault-Local\Designs\" & oFolder1 & "\" & oFolder2 & "\" Dim oNewName As String oNewName = oPath & oName & oType 'MessageBox.Show(oNewName, "Generated filepath") oDoc.SaveAs(oNewName, False) End If 'work with an error created by the user backing out of the save 'oFileDlg.CancelError = True 'On Error Resume Next 'specify the file dialog as a save dialog (rather than a open dialog) '.ShowSave() 'catch an empty string in the imput If Err.Number <> 0 Then MessageBox.Show("No File Saved.", "iLogic: Dialog Canceled") 'ElseIf oFileDlg.FileName <> "" Then 'save the file 'oDoc.SaveAs(oPath, Filename, True) 'True = Save As Copy & False = Save As End If Else 'If document has been saved before... Return End If End If
Cory McConnell
Solved! Go to Solution.