<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic AcDbDatabase::dxfout in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4328549#M13460</link>
    <description>&lt;P&gt;Here is the situatlion:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The default file format in the AutoCAD Options Dialog is set to AutoCAD 2010 DXF.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I open a DXf file, make a modification to it and save it using the QSave command, AutoCAD will make a backup copy of the dxf file and save the new version.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do the same thing&amp;nbsp;but use my own ARX command to save the file using the AcDbDatabase::dxfOut function, the function returns an "eFileAccessErr" status code and AutoCAD fails to create the backup file or save the DXF&amp;nbsp;file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I set the default format to a&amp;nbsp;drawing&amp;nbsp;format, load a drawing&amp;nbsp;and use the AcDbDatabase::saveAs function in my command to save the file, AutoCAD will make a backup copy and save the DWG file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to use the AcDbDatabase::dxfOut function to make a backup copy of the loaded DXF file and save a new copy like the saveAs function does for drawing files?&lt;BR /&gt;&lt;BR /&gt;If so, what do I need to do to my code to make it work.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jul 2013 21:21:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-07-12T21:21:01Z</dc:date>
    <item>
      <title>AcDbDatabase::dxfout</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4328549#M13460</link>
      <description>&lt;P&gt;Here is the situatlion:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The default file format in the AutoCAD Options Dialog is set to AutoCAD 2010 DXF.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I open a DXf file, make a modification to it and save it using the QSave command, AutoCAD will make a backup copy of the dxf file and save the new version.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do the same thing&amp;nbsp;but use my own ARX command to save the file using the AcDbDatabase::dxfOut function, the function returns an "eFileAccessErr" status code and AutoCAD fails to create the backup file or save the DXF&amp;nbsp;file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I set the default format to a&amp;nbsp;drawing&amp;nbsp;format, load a drawing&amp;nbsp;and use the AcDbDatabase::saveAs function in my command to save the file, AutoCAD will make a backup copy and save the DWG file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to use the AcDbDatabase::dxfOut function to make a backup copy of the loaded DXF file and save a new copy like the saveAs function does for drawing files?&lt;BR /&gt;&lt;BR /&gt;If so, what do I need to do to my code to make it work.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2013 21:21:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4328549#M13460</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-12T21:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: AcDbDatabase::dxfout</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4330751#M13461</link>
      <description>&lt;P&gt;have you tried using acdbDxfOutAs2000, acdbDxfOutAs2004, etc etc&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2013 19:31:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4330751#M13461</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2013-07-15T19:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: AcDbDatabase::dxfout</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4330774#M13462</link>
      <description>Yes. I have already tried those functions with the same results. If the file is already there and opened in AutoCAD, the functions will not make a backup copy of the DXF file and replace it with the new version.&lt;BR /&gt;&lt;BR /&gt;Richard L. Baker II&lt;BR /&gt;Svc Info Developer III&lt;BR /&gt;ES Apps Development US&lt;BR /&gt;richard.baker-ii@hp.com&lt;BR /&gt;T +1 512 319 3637&lt;BR /&gt;HP Enterprise Services&lt;BR /&gt;[cid:image003.png@01CE816A.419E1A40]&lt;BR /&gt;&lt;BR /&gt;Please print thoughtfully</description>
      <pubDate>Mon, 15 Jul 2013 19:49:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4330774#M13462</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-15T19:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: AcDbDatabase::dxfout</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4330908#M13463</link>
      <description>&lt;P&gt;Can you post the code you are using to call AcDbDatabase::dxfOut() please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another option is to use the COM API, e.g. AcadApplication::AcadDocument.ActiveDocument.SaveAs()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2013 21:27:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4330908#M13463</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2013-07-15T21:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: AcDbDatabase::dxfout</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4330918#M13464</link>
      <description>Here is the code I am trying to use. The DWG formats work just fine. AutoCAD will make a backup copy and save the new file. It doesn't work for the DXF formats.&lt;BR /&gt;&lt;BR /&gt;Acad::ErrorStatus es;&lt;BR /&gt;&lt;BR /&gt;CString csDwgFullName = GetDwgFilename();&lt;BR /&gt;grDocData.bSaveDwg = true;&lt;BR /&gt;&lt;BR /&gt;AcApDocument *pDoc = acDocManager-&amp;gt;curDocument();&lt;BR /&gt;AcDbDatabase *pDb = pDoc-&amp;gt;database();&lt;BR /&gt;&lt;BR /&gt;AcApDocument::SaveFormat saveFormat = pDoc-&amp;gt;formatForSave();&lt;BR /&gt;&lt;BR /&gt;bool bDwgFormat(true);&lt;BR /&gt;AcDb::AcDbDwgVersion dwgVersion = AcDb::kDHL_CURRENT;&lt;BR /&gt;&lt;BR /&gt;switch (saveFormat)&lt;BR /&gt;{&lt;BR /&gt;case AcApDocument::k2010_dxf:&lt;BR /&gt;bDwgFormat = false;&lt;BR /&gt;dwgVersion = AcDb::kDHL_CURRENT;&lt;BR /&gt;break;&lt;BR /&gt;&lt;BR /&gt;case AcApDocument::k2007_dxf:&lt;BR /&gt;bDwgFormat = false;&lt;BR /&gt;case AcApDocument::k2007_dwg:&lt;BR /&gt;dwgVersion = AcDb::kDHL_1021;&lt;BR /&gt;break;&lt;BR /&gt;&lt;BR /&gt;case AcApDocument::k2004_dxf:&lt;BR /&gt;bDwgFormat = false;&lt;BR /&gt;case AcApDocument::k2004_dwg:&lt;BR /&gt;dwgVersion = AcDb::kDHL_1800;&lt;BR /&gt;break;&lt;BR /&gt;&lt;BR /&gt;case AcApDocument::k2000_dxf:&lt;BR /&gt;bDwgFormat = false;&lt;BR /&gt;case AcApDocument::k2000_dwg:&lt;BR /&gt;dwgVersion = AcDb::kDHL_1015;&lt;BR /&gt;break;&lt;BR /&gt;&lt;BR /&gt;case AcApDocument::kR14_dwg:&lt;BR /&gt;dwgVersion = AcDb::kDHL_1014;&lt;BR /&gt;break;&lt;BR /&gt;&lt;BR /&gt;case AcApDocument::kR12_dxf:&lt;BR /&gt;bDwgFormat = false;&lt;BR /&gt;dwgVersion = AcDb::kDHL_1009;&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;if (bDwgFormat)&lt;BR /&gt;{&lt;BR /&gt;es = pDb-&amp;gt;saveAs(csDwgFullName, true, dwgVersion);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;csDwgFullName.Replace(_T(".dwg"), _T(".dxf"));&lt;BR /&gt;csDwgFullName.Replace(_T(".DWG"), _T(".DXF"));&lt;BR /&gt;&lt;BR /&gt;es = pDb-&amp;gt;dxfOut(csDwgFullName, 16, dwgVersion);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Richard L. Baker II&lt;BR /&gt;Svc Info Developer III&lt;BR /&gt;ES Apps Development US&lt;BR /&gt;richard.baker-ii@hp.com&lt;BR /&gt;T +1 512 319 3637&lt;BR /&gt;HP Enterprise Services&lt;BR /&gt;[cid:image003.png@01CE8179.EF662DC0]&lt;BR /&gt;&lt;BR /&gt;Please print thoughtfully</description>
      <pubDate>Mon, 15 Jul 2013 21:42:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4330918#M13464</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-15T21:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: AcDbDatabase::dxfout</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4342817#M13465</link>
      <description>&lt;P&gt;Hi Richard,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to try out the COM API as my colleague Fenton Webb had already suggested and it worked.&lt;/P&gt;
&lt;P&gt;As the "SaveAs" method in COM API cannot save dxf files, I used the "SendCommand".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried it this way :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Start AutoCAD 2014&lt;/P&gt;
&lt;P&gt;2. Open a 2013 DXF file&lt;/P&gt;
&lt;P&gt;3. Make some changes&lt;/P&gt;
&lt;P&gt;4. Run the command to save the dxf file to the same path&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It saved the dxf to the original file and created a .bak for it.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is the sample code :&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;#include &amp;lt;acadi.h&amp;gt;

#pragma warning( disable : 4278 )
// Makes change to the tlb name based on the AutoCAD version. 
// For ex : acax18enu.tlb for AutoCAD 2010/2011 and 2012
//          acad19enu.tlb for AutoCAD 2013  
#import "acax19ENU.tlb" no_implementation raw_interfaces_only named_guids
#pragma warning( default : 4278 )

static void AdskMyTestTTG(void)
{
	Acad::ErrorStatus es;
	AcApDocument *pDoc = acDocManager-&amp;gt;mdiActiveDocument();
	AcDbDatabase *pDb = pDoc-&amp;gt;database();

	const TCHAR* dwgFileName;
    pDb-&amp;gt;getFilename(dwgFileName);

	AcApDocument::SaveFormat sf = pDoc-&amp;gt;formatForSave();

	CString csDxfFullName(dwgFileName); 
	csDxfFullName.Replace(_T(".dwg"), _T(".dxf"));
	csDxfFullName.Replace(_T(".DWG"), _T(".DXF"));

	CWinApp *pApp = acedGetAcadWinApp(); 
	HRESULT hRes; 
	LPDISPATCH pDisp=NULL; 

	if (!pApp) 
		return; 

	pDisp=pApp-&amp;gt;GetIDispatch(TRUE); 
	if (!pDisp) 
		return; 

	CComPtr&amp;lt;AutoCAD::IAcadApplication&amp;gt; pComApp; 
	hRes=pDisp-&amp;gt;QueryInterface(IID_IAcadApplication, (void**)&amp;amp;pComApp); 
	if (FAILED(hRes)) 
		return; 

	CComPtr&amp;lt;AutoCAD::IAcadDocument&amp;gt; pComDoc; 
	hRes=pComApp-&amp;gt;get_ActiveDocument(&amp;amp;pComDoc); 
	if (FAILED(hRes)) 
		return; 

	VARIANT_BOOL isSaved;
	HRESULT hr = pComDoc-&amp;gt;get_Saved(&amp;amp;isSaved);
	if(isSaved == 0)
	{
		CString strCommand("FILEDIA\n0\n");
		BSTR bstCommand = strCommand.AllocSysString();
		
		hRes = pComDoc-&amp;gt;SendCommand(bstCommand);

		::SysFreeString(bstCommand);

		// saveas
		// dxf
		// 16
		// path
		// replace ? : yes
		strCommand.Format(ACRX_T("saveas\nDXF\n16\n%s\ny\n"), csDxfFullName);
		bstCommand = strCommand.AllocSysString();
		
		hRes = pComDoc-&amp;gt;SendCommand(bstCommand);

		::SysFreeString(bstCommand);

		if (SUCCEEDED(hRes)) 
			acutPrintf( _T("Saved."));
	}
	else
		acutPrintf( _T("No changes to save."));
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2013 10:36:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4342817#M13465</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2013-07-25T10:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: AcDbDatabase::dxfout</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4342850#M13466</link>
      <description>&lt;P&gt;Sorry, An update to my earlier reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The "SaveAs" method in COM API does save dxf files, but I did not find it creating a .bak file.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2013 11:19:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acdbdatabase-dxfout/m-p/4342850#M13466</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2013-07-25T11:19:17Z</dc:date>
    </item>
  </channel>
</rss>

