<?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 Re: Save down to version 2010 from 2015 in VB.NET in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5769787#M39167</link>
    <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;yes, i did not went in deep with my tests, the usage of SaveAs in your post is the ticket - thanks!&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Aug 2015 14:18:35 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-08-13T14:18:35Z</dc:date>
    <item>
      <title>Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5743805#M39155</link>
      <description>&lt;P&gt;I need the ability for my VB.NET application to save down to 2010 format when I am running 2015 autocad&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 20:35:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5743805#M39155</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-27T20:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5743821#M39156</link>
      <description>&lt;P&gt;look at database.SaveAs(fileName, DwgVersion)&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 20:41:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5743821#M39156</guid>
      <dc:creator>Keith.Brown</dc:creator>
      <dc:date>2015-07-27T20:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5745883#M39157</link>
      <description>&lt;P&gt;I tried this, but the problem is that I get an unhandled access violation when I try to save the current drawing down to 2010 format. &amp;nbsp;I don't want to rename it to something else, and I cannot force my users to exit the drawing when saving. &amp;nbsp;Is there some way to get around this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2015 22:18:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5745883#M39157</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-28T22:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768257#M39158</link>
      <description>&lt;P&gt;Is there no solution to this? &amp;nbsp;I just want AutoCAD 2015 to always save down to 2010 format because I have some users using machines with 2015, and other users using 2010, and they will all be accessing the same files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2015 17:20:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768257#M39158</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-12T17:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768366#M39159</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;i think that now you are supposed to use SaveAs method, you can check the backward compability (if you have the ARX downloaded and look for dbmain.h, for&amp;nbsp;acdbSaveAs2000(), etc) those can be p-invoked, i tried that many moons ago, but no luck backthen... maybe (not tested, just grabbed from my old dwgConvert class), something like, in my case was a conversion from ADT to AutoCAD, see if you use the built-in +SAVEAS command, might work, do not recall if now it is a command line access and no need to do any Pinvoke:&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;        const int RTNORM = 5100;
        const int RTCAN = -5002;
        const short RTSTR = 5005;
        const string PrefixConvert = "CONVERTED-";
        const string prefixAcad = "ACAD-";
        const string prefixBackup = "BACKUP-";

        [SuppressUnmanagedCodeSecurity]
        [DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)]
        extern static int acedCmd(IntPtr resbuf);

        public void MySaveAsTest()
        {
            // save the drawing to a new one using exporttoautocad
            // I need to use this approach - any other I tried did not work
            // like SaveAs() or SaveDatabaseAs2000()
            var resultBuffer = new ResultBuffer
            {
                new TypedValue(RTSTR, "_.-EXPORTTOAUTOCAD"),
                new TypedValue(RTSTR, "_Format"),
                new TypedValue(RTSTR, "2000"),
                new TypedValue(RTSTR, "_Type"),
                new TypedValue(RTSTR, "_Insert"),
                new TypedValue(RTSTR, "_Prefix"),
                new TypedValue(RTSTR, PrefixConvert),
                new TypedValue(RTSTR, ""),
                new TypedValue(RTSTR, "")
            };

            var status = acedCmd(resultBuffer.UnmanagedObject);
            if (status == RTNORM || status == RTCAN)
            {
                //...
            }
        }&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;hth.-&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2015 18:04:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768366#M39159</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-12T18:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768672#M39160</link>
      <description>&lt;P&gt;Can you show the code that generates the exception? &amp;nbsp;SaveAs is described&amp;nbsp;&lt;A href="http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html?url=WS73099cc142f48755-385a98b0121d1bb015f-3009.htm,topicNumber=d0e7906" target="_self"&gt;&amp;gt;&amp;gt;here&amp;lt;&amp;lt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2015 20:25:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768672#M39160</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2015-08-12T20:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768815#M39161</link>
      <description>&lt;P&gt;Here is the code that generated the exception error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;acCurdb.SaveAs(acdoc.Name, DwgVersion.AC1024)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2015 22:08:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768815#M39161</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-12T22:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768852#M39162</link>
      <description>&lt;P&gt;What about the security parameters?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2015 22:34:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768852#M39162</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2015-08-12T22:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768858#M39163</link>
      <description>&lt;P&gt;That is all I used for the code.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2015 22:35:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768858#M39163</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-12T22:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768985#M39164</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;this works for me, see if helps now:&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;        [CommandMethod("MYSAVEAS")]
        public void cmd_mySaveAs()
        {
            var document = AcadApp.DocumentManager.MdiActiveDocument;
            var database = document.Database;
            document.DowngradeDocOpen(false);
            document.PushDbmod();
            database.SaveAs(database.Filename, DwgVersion.AC1024);
            document.PopDbmod();
        }&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Aug 2015 00:54:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5768985#M39164</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-13T00:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5769339#M39165</link>
      <description>&lt;P&gt;@Anonymous﻿&amp;nbsp;DowngradeDocOpen throws an exception (eInvalidContext) if called with&amp;nbsp;bPromptForSave at false and a modified drawing. And you need to call&amp;nbsp;UpgradeDocOpen otherwise the drawing will stay in read-only mode.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2015 10:03:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5769339#M39165</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2015-08-13T10:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5769349#M39166</link>
      <description>&lt;P&gt;When you save the active drawing, you must use the overload which take a boolean value for bBakAndRename and pass true for this argument:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[CommandMethod("MYSAVEAS")]
public void MySaveAs()
{
  Document doc = Application.DocumentManager.MdiActiveDocument;
  Database db = doc.Database;
  if (doc.IsNamedDrawing)
  {
    db.SaveAs(doc.Name, bBakAndRename: true, version: DwgVersion.AC1024, security: db.SecurityParameters);
  }
  else
  {
    // Prompt for file name...
  }
}&lt;/PRE&gt;&lt;P&gt;You've got a FileSharingViolation because AutoCAD maintains a lock on the file. When you pass true for bBakAndRename, AutoCAD release the lock, rename&amp;nbsp;the active drawing&amp;nbsp;with a bak extension and if it success, it writes the new .dwg file. If something goes wrong during the write, the .bak file is safe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Don't use db.Filename (use doc.Name instead) as it will contain the path of the template (.dwt) used to create the drawing. And check if the drawing has already a name with IsNamedDrawing.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2015 10:18:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5769349#M39166</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2015-08-13T10:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Save down to version 2010 from 2015 in VB.NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5769787#M39167</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;yes, i did not went in deep with my tests, the usage of SaveAs in your post is the ticket - thanks!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2015 14:18:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/save-down-to-version-2010-from-2015-in-vb-net/m-p/5769787#M39167</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-13T14:18:35Z</dc:date>
    </item>
  </channel>
</rss>

