- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
i need some Help.
I try to Open Each .DWG File in a Folder(Directory)
Save Document as .DXF
Thanks for any Suggestion
Solved! Go to Solution.
Link copied
Hi,
i need some Help.
I try to Open Each .DWG File in a Folder(Directory)
Save Document as .DXF
Thanks for any Suggestion
Solved! Go to Solution.
Hi,
Why i get Error:
<CommandMethod("OpenDrawingDWG", CommandFlags.Session)>
Public Sub OpenDrawingDWG()
Dim strFileName As String = "C:\AutoCad_API\CAD\20221024\Folder_A\Test_ver2018_b.dwg"
Dim strFileNameSave As String = "C:\AutoCad_API\CAD\20221024\Folder_A\Test_ver2018_b.dxf"
Dim acDocMgr As DocumentCollection = Application.DocumentManager
DocumentCollectionExtension.Open(acDocMgr, strFileName, False)
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim strDWGName As String = acDoc.Name
MsgBox("strFileNameSave = " & strFileNameSave)
acDoc.Database.DxfOut(strFileNameSave, 16, DwgVersion.Current)
End Sub
Error:
Second Code:
<CommandMethod("OpenDrawingDWG", CommandFlags.Session)>
Public Sub OpenDrawingDWG()
Dim strFileName As String = "C:\AutoCad_API\CAD\20221024\Folder_A\Test_ver2018_b.dwg"
Dim strFileNameSave As String = "C:\AutoCad_API\CAD\20221024\Folder_A\Test_ver2018_b.dxf"
Dim acDocMgr As DocumentCollection = Application.DocumentManager
DocumentCollectionExtension.Open(acDocMgr, strFileName, False)
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
acDoc.Database.SaveAs(strFileNameSave, True, DwgVersion.AC1027, acDoc.Database.SecurityParameters)
End Sub
Save File as DXF, but the File is Empty
When i try to open the File, than i get Blackscreen and Text " Press Enter to go Forward" but the File is Empty
Thanks for Any Suggestion!
Hi,
You should use a 'side database' (i.e. open the dwg in memory) instead of opening the dwg in the editor.
Here's an exemple:
private static void SaveAsDxf(string dwgName)
{
using (var db = new Database(false, true))
{
db.ReadDwgFile(dwgName, FileOpenMode.OpenForReadAndAllShare, true, null);
string dxfName = System.IO.Path.ChangeExtension(dwgName, "dxf");
db.DxfOut(dxfName, 16, true);
}
}
Hi,
Thanks for Solution
Thanks for Help