Sure,
Here is a similar iLogic Rule.
'This Rule is done By MechDS 28.07.2022
'For Help Please contact me Email: zezo15330@gmail.com
'Youtube
'https://www.youtube.com/MechInventor
'Grab cad
'https://grabcad.com/mech.inventor-1
Dim oDoc As Document = ThisApplication.ActiveEditDocument
Dim oDChack As Boolean = True
Dim oDSuffix As String = ".idw"
'Current file path
Dim oPath As String = System.IO.Path.GetDirectoryName(oDoc.FullDocumentName)
'Get current filename without extension
Dim CurrentFilename As String = System.IO.Path.GetFileNameWithoutExtension(oDoc.FullDocumentName)
'MsgBox (CurrentFilename)
'Get current path
Dim Path As String = oPath
'Check that the drawing for this part can be found
If Not System.IO.File.Exists(System.IO.Path.ChangeExtension(oDoc.FullDocumentName, oDSuffix)) Then
oDChack = Fasle
MessageBox.Show("Couldn't find the Drawing document!" & vbLf & vbLf & "Drawing won't be copied" , "Document Type")
End If
' Prompt user for job number
Dim NewFileName As String = InputBox("You are creating a new copy of this Document and its 2D drawing file" & vbLf & vbLf & _
"Please input a new name for the design" & vbLf & vbLf & _
"Note the current part will be closed and the new one opened...." , "Save As", "")
If NewFileName = "" Then ' Cancel was hit
Return
End If
oAnsewer = MsgBox("Do you want to save the file to the same Path", MsgBoxStyle.YesNo, "Path")
If oAnsewer = vbNo Then
'Create new FolderBrowserDialog
Dim Dialog = New FolderBrowserDialog()
'Start search path
Dialog.SelectedPath = oPath
Dialog.ShowNewFolderButton = True
Dialog.Description = "Please select a folder"
' Check Path
If DialogResult.OK = Dialog.ShowDialog() Then
Path = Dialog.SelectedPath
End If
End If
'MessageBox.Show(Path, "PAth")
' Perform Save As of Part
On Error Resume Next
Call oDoc.SaveAs(Path & "\" & NewFileName & ".ipt", False)
'Drawing check
If oDChack = False Then
Exit Sub
End If
Dim DrawingDoc As DrawingDocument = ThisApplication.Documents.Open(oPath & "\" & CurrentFilename & oDSuffix, False)
' Replace reference to part model
Dim oFD As FileDescriptor
oFD = DrawingDoc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor
Call oFD.ReplaceReference(Path & "\" &NewFileName & ".ipt")
DrawingDoc.Update()
' Perform 'Save As' on the drawing - change this to reflect your drawing type .dwg or .idw
DrawingDoc.SaveAs(Path & "\" & NewFileName & oDSuffix, False)
' Make the assembly model active again...
oDoc.Activate()
' End of iLogic code ---------------------------------------------------------------------------------------------