Hey
do you have any code already? To go through your itemised list-
1. Open .idw (manually)
This is not part of the answer needed
2. Check the .ipt that's in that .idw
What are you checking against? How do you intend to check that the ipt is in the idw? Im assuming the ipt is closed because you want to open it in the background in item 3. This will require the FullFileName of the ipt and the DrawingDoc.allReferencedDocuments loop to compare the path to see if it exists in the idw so, the ipt needs to be available
3. Open .ipt in the background
Once item 2 is qualified (you have found the ipt in the idw) you can open it in the background by using the
Document.Open(FullFileName, False) where False is the visibility of the document.

4. Save .ipt as .stp (still in background) using the .idw name.
Location -> Same as where the .idw is saved.
Then you can get the the same location as the idw from the idw path and use the translator to save as stp

here is a function that will return the folder path of a file name. In this case, you would pass the FillFileName of the IDW to the function to get its folder path. Then you would need to add the name of the step file and its extension in order for the step to be saved
Function GetDirectory(path)
GetDirectory = (Left(path, InStrRev(path, "\")))
End Function
and to use it
Dim FolderPath As String: FolderPath = GetDirectory(IDWFullFileName)
5. Close .ipt in background.
close the document by closing the open instance. For example:
Dim PathOfIPT As String: PathOfIPT = "C:/Temp/Test.ipt"
Dim oDoc As PartDocument
Set oDoc = ThisApplication.documents.Open(PathOfIPT, False)
Dim StepName As String: StepName = PathOfIPT.Replace("ipt", "stp")
ExportToSTEP(StepName)
oDoc Close(False)
oDoc = Nothing
note: i added a parameter to the ExportToSTEP sub so that i could pass the filepath i wanted. In the sub you would need to change 2 things-
The header
Public Sub ExportToSTEP(ByVal PathName As String)
the filename at the bottom of the code
oData.FileName = PathName
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.