Message 1 of 1
IDW to DWF Export Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm failing forward on this rule to create a DXF from an IDW or DWG.
The DXF fille will be created but when i open it with AutoCAD LT i get a prompt to hit "Enter" and nothing happens. Any assistance would be very helpful. Code I'm using,
Sub Main() FileName = ThisDoc.FileName(True) 'with extension FileExtension = Right(FileName, 3) If FileExtension = "idw" Then Save_As_DXF Else If FileExtension = "dwg" Then Save_As_DXF Else ErrorMessage End If End Sub Sub Save_As_DXF oPath = ThisDoc.Path oFileName = ThisDoc.FileName(False) oDXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") oDocument = ThisApplication.ActiveDocument oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism oOptions = ThisApplication.TransientObjects.CreateNameValueMap oDataMedium = ThisApplication.TransientObjects.CreateDataMedium WorkspacePath = ThisDoc.WorkspacePath() 'Gets the workspace path WorkspacePathLength = Len(WorkspacePath) 'Gets the length of the workspace path string PathOnly = ThisDoc.Path 'Gets just the path of the file DirectoryPath = Strings.Right(PathOnly, PathOnly.Length) 'Removes the workspace path from fullpath DXFPath = ThisDoc.Path 'Sets the directory that the pdf should be saved in DXFName = DXFPath & "\" & ThisDoc.FileName(False) & ".dxf" 'Saves the pdf in the desired location oDataMedium.FileName = DXFName oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintCurrentSheet If Not System.IO.Directory.Exists(DXFPath) Then 'checks to see if that directory exists, if not, it is created System.IO.Directory.CreateDirectory(DXFPath) End If oDXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) End Sub Sub ErrorMessage i = MessageBox.Show("This Is Not a drawing File. No DXF will be created.", "Create DXf", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1) End Sub