<?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: new database, readdwgfile, insunits in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/new-database-readdwgfile-insunits/m-p/8901804#M21850</link>
    <description>&lt;P&gt;Yes - thanks.&amp;nbsp; It occurred to me (too late) that I didn't need a transaction to set an application system variable.&lt;/P&gt;&lt;P&gt;In my own words - "SEARCH FIRST" and use the correct search parameters.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2019 17:29:53 GMT</pubDate>
    <dc:creator>fieldguy</dc:creator>
    <dc:date>2019-07-10T17:29:53Z</dc:date>
    <item>
      <title>new database, readdwgfile, insunits</title>
      <link>https://forums.autodesk.com/t5/net-forum/new-database-readdwgfile-insunits/m-p/8901712#M21847</link>
      <description>&lt;P&gt;I am using this code to rename dwg files from a third party.&amp;nbsp; The insunits are set to "2" (feet).&amp;nbsp; I thought I could change the units at the same time, but it is not working.&lt;/P&gt;&lt;P&gt;We work in metres (insunits = "6").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;string dwgname = "dwg from third party"; &lt;BR /&gt;string newname = "newname.dwg";&lt;BR /&gt;string savepath = "c:\\temp\\";&lt;BR /&gt;using (Database db = new Database(false, true))
{
  db.ReadDwgFile(dwgname, FileOpenMode.OpenForReadAndWriteNoShare, false, "");
  db.CloseInput(true);
  using (Transaction tr = db.TransactionManager.StartTransaction())
  {
    Application.SetSystemVariable("INSUNITS", 6);
    tr.Commit();
  }// using tr
  db.SaveAs(savepath + newname, DwgVersion.Current);&lt;BR /&gt;}// using new database&lt;/PRE&gt;&lt;P&gt;What is the correct procedure?&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 16:57:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/new-database-readdwgfile-insunits/m-p/8901712#M21847</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2019-07-10T16:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: new database, readdwgfile, insunits</title>
      <link>https://forums.autodesk.com/t5/net-forum/new-database-readdwgfile-insunits/m-p/8901770#M21848</link>
      <description>&lt;P&gt;The answer is&amp;nbsp; replace "Application.SetSystemVariable("INSUNITS", 6)" with "db.Insunits = acdb.UnitsValue.Meters;"&lt;/P&gt;&lt;P&gt;I should have searched a bit further.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 17:18:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/new-database-readdwgfile-insunits/m-p/8901770#M21848</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2019-07-10T17:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: new database, readdwgfile, insunits</title>
      <link>https://forums.autodesk.com/t5/net-forum/new-database-readdwgfile-insunits/m-p/8901775#M21849</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try doing simply like this:&lt;/P&gt;
&lt;PRE&gt;            using (var db = new Database(false, true))
            {
                db.ReadDwgFile(dwgname, FileOpenMode.OpenForReadAndAllShare, false, "");
                db.Insunits = UnitsValue.Meters;
                db.SaveAs(savepath + newname, DwgVersion.Current);
            }&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jul 2019 17:17:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/new-database-readdwgfile-insunits/m-p/8901775#M21849</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2019-07-10T17:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: new database, readdwgfile, insunits</title>
      <link>https://forums.autodesk.com/t5/net-forum/new-database-readdwgfile-insunits/m-p/8901804#M21850</link>
      <description>&lt;P&gt;Yes - thanks.&amp;nbsp; It occurred to me (too late) that I didn't need a transaction to set an application system variable.&lt;/P&gt;&lt;P&gt;In my own words - "SEARCH FIRST" and use the correct search parameters.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 17:29:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/new-database-readdwgfile-insunits/m-p/8901804#M21850</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2019-07-10T17:29:53Z</dc:date>
    </item>
  </channel>
</rss>

