- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I hope someone can help me out. I have a need to open up all Inventor dwg files and save then as Inventor idw files. I then have to open the new idw file and save back to inventor dwg. The current dwg files contain a reference to an external image file that needs removing from the dwg file and the simplest way to achieve it it to export to idw as that will remove the reference. So far I have the code below which does the export but the resulting dwg is an Autocad dwg and not the Inventor dwg file needed. Any idea how to specify the Inventor dwg file type?
Dim oPath As String = "C:\Temp" '
Dim oIDW_Filename As String' IDW File name
' Get the files in the specified directory and subdirectories.
Dim oDrawingNumbers() As String = System.IO.Directory.GetFiles(oPath, "*.dwg", System.IO.SearchOption.AllDirectories)
'Dim oCurrentDrawings As String() 'array list of all dwg files found
For Each Drawing As String In oDrawingNumbers
If Drawing.Contains("OldVersion") = False Then 'Don't need dwg files in oldversion folders
ThisDoc.Launch(Drawing)
InventorVb.DocumentUpdate()
oIDW_Filename=Left(Drawing,Len(Drawing)-4)' Filename and path without extension
ThisDoc.Document.SaveAs(ThisDoc.ChangeExtension(".idw"), True)
ThisApplication.ActiveDocument.Close
ThisDoc.Launch(oIDW_Filename & "idw")
InventorVb.DocumentUpdate()
ThisDoc.Document.SaveAs(ThisDoc.ChangeExtension(".dwg"), True)
ThisApplication.ActiveDocument.Close
End If
Next
Many thanks
Mike
Solved! Go to Solution.