<?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: DBMOD = 32 ? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/dbmod-32/m-p/3740510#M51948</link>
    <description>&lt;P&gt;In order to set DBMOD variable you can P/Invoke acdbSetDbmod function:&lt;/P&gt;
&lt;PRE&gt;long __cdecl acdbSetDbmod(class AcDbDatabase *, long newDBMod);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Example:&lt;/P&gt;
&lt;PRE&gt;using System;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
[assembly: CommandClass(typeof(Rivilis.SetDbMod))]
namespace Rivilis
{
    public class SetDbMod
    {
        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("acdb16.dll", CallingConvention = CallingConvention.Cdecl,
           EntryPoint = "?acdbSetDbmod@@YAJPAVAcDbDatabase@@J@Z")]
        private static extern Int32 acdbSetDbmod16(IntPtr db, Int32 newDbMod);
        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("acdb17.dll", CallingConvention = CallingConvention.Cdecl,
           EntryPoint = "?acdbSetDbmod@@YAJPAVAcDbDatabase@@J@Z")]
        private static extern Int32 acdbSetDbmod17(IntPtr db, Int32 newDbMod);
        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("acdb18.dll", CallingConvention = CallingConvention.Cdecl,
           EntryPoint = "?acdbSetDbmod@@YAJPAVAcDbDatabase@@J@Z")]
        private static extern Int32 acdbSetDbmod18(IntPtr db, Int32 newDbMod);
        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("acdb19.dll", CallingConvention = CallingConvention.Cdecl,
           EntryPoint = "?acdbSetDbmod@@YAJPAVAcDbDatabase@@J@Z")]
        private static extern Int32 acdbSetDbmod19(IntPtr db, Int32 newDbMod);

        public static Int32 acdbSetDbmod(ref Database db, Int32 newDbMod)
        {
            switch (Autodesk.AutoCAD.ApplicationServices.Application.Version.Major)
            {
                case 16: return acdbSetDbmod16(db.UnmanagedObject, newDbMod);
                case 17: return acdbSetDbmod17(db.UnmanagedObject, newDbMod);
                case 18: return acdbSetDbmod18(db.UnmanagedObject, newDbMod);
                case 19: return acdbSetDbmod19(db.UnmanagedObject, newDbMod);
                default: return (Int32)ErrorStatus.NotImplementedYet;
            }
        }
        //--------------------------------------
        // Clear DbMod for Active document
        // Очистка DBMOD для активного документа
        //--------------------------------------
        [CommandMethod("ClearCurDbMod")]
        static public void ClearCurDbMod()
        {
            Database db = Application.DocumentManager.MdiActiveDocument.Database;
            acdbSetDbmod(ref db, 0);
        }

        //--------------------------------------
        // Clear DbMod for All opened documents
        // Очистка DBMOD для всех документов
        //--------------------------------------
        [CommandMethod("ClearAllDbMod")]
        static public void ClearAllDbMod()
        {
            foreach (Document doc in Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager)
            {
                Database db = doc.Database;
                acdbSetDbmod(ref db, 0);
            }
        }
    };
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;This code is only for x86 AutoCAD. x64 is different with&amp;nbsp; EntryPoint string:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;EntryPoint = "?acdbSetDbmod@@YAJPEAVAcDbDatabase@@J@Z"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Dec 2012 10:34:05 GMT</pubDate>
    <dc:creator>Alexander.Rivilis</dc:creator>
    <dc:date>2012-12-20T10:34:05Z</dc:date>
    <item>
      <title>DBMOD = 32 ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/dbmod-32/m-p/3740451#M51947</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone give me an example how to get the system variable DBMOD = 32 or (DBMOD AND 32)=32?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually, I consider the drawing need &lt;STRONG&gt;really&lt;/STRONG&gt; to be saved only if DBMOD is equal to 1,4 or 5. Is that right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2012 07:37:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dbmod-32/m-p/3740451#M51947</guid>
      <dc:creator>glanard</dc:creator>
      <dc:date>2012-12-20T07:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: DBMOD = 32 ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/dbmod-32/m-p/3740510#M51948</link>
      <description>&lt;P&gt;In order to set DBMOD variable you can P/Invoke acdbSetDbmod function:&lt;/P&gt;
&lt;PRE&gt;long __cdecl acdbSetDbmod(class AcDbDatabase *, long newDBMod);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Example:&lt;/P&gt;
&lt;PRE&gt;using System;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
[assembly: CommandClass(typeof(Rivilis.SetDbMod))]
namespace Rivilis
{
    public class SetDbMod
    {
        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("acdb16.dll", CallingConvention = CallingConvention.Cdecl,
           EntryPoint = "?acdbSetDbmod@@YAJPAVAcDbDatabase@@J@Z")]
        private static extern Int32 acdbSetDbmod16(IntPtr db, Int32 newDbMod);
        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("acdb17.dll", CallingConvention = CallingConvention.Cdecl,
           EntryPoint = "?acdbSetDbmod@@YAJPAVAcDbDatabase@@J@Z")]
        private static extern Int32 acdbSetDbmod17(IntPtr db, Int32 newDbMod);
        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("acdb18.dll", CallingConvention = CallingConvention.Cdecl,
           EntryPoint = "?acdbSetDbmod@@YAJPAVAcDbDatabase@@J@Z")]
        private static extern Int32 acdbSetDbmod18(IntPtr db, Int32 newDbMod);
        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("acdb19.dll", CallingConvention = CallingConvention.Cdecl,
           EntryPoint = "?acdbSetDbmod@@YAJPAVAcDbDatabase@@J@Z")]
        private static extern Int32 acdbSetDbmod19(IntPtr db, Int32 newDbMod);

        public static Int32 acdbSetDbmod(ref Database db, Int32 newDbMod)
        {
            switch (Autodesk.AutoCAD.ApplicationServices.Application.Version.Major)
            {
                case 16: return acdbSetDbmod16(db.UnmanagedObject, newDbMod);
                case 17: return acdbSetDbmod17(db.UnmanagedObject, newDbMod);
                case 18: return acdbSetDbmod18(db.UnmanagedObject, newDbMod);
                case 19: return acdbSetDbmod19(db.UnmanagedObject, newDbMod);
                default: return (Int32)ErrorStatus.NotImplementedYet;
            }
        }
        //--------------------------------------
        // Clear DbMod for Active document
        // Очистка DBMOD для активного документа
        //--------------------------------------
        [CommandMethod("ClearCurDbMod")]
        static public void ClearCurDbMod()
        {
            Database db = Application.DocumentManager.MdiActiveDocument.Database;
            acdbSetDbmod(ref db, 0);
        }

        //--------------------------------------
        // Clear DbMod for All opened documents
        // Очистка DBMOD для всех документов
        //--------------------------------------
        [CommandMethod("ClearAllDbMod")]
        static public void ClearAllDbMod()
        {
            foreach (Document doc in Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager)
            {
                Database db = doc.Database;
                acdbSetDbmod(ref db, 0);
            }
        }
    };
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;This code is only for x86 AutoCAD. x64 is different with&amp;nbsp; EntryPoint string:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;EntryPoint = "?acdbSetDbmod@@YAJPEAVAcDbDatabase@@J@Z"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2012 10:34:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dbmod-32/m-p/3740510#M51948</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2012-12-20T10:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: DBMOD = 32 ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/dbmod-32/m-p/3740597#M51949</link>
      <description>&lt;P&gt;Hi Alexander,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably my question was not very clear &lt;img id="smileyembarrassed" class="emoticon emoticon-smileyembarrassed" src="https://forums.autodesk.com/i/smilies/16x16_smiley-embarrassed.png" alt="Smiley Embarassed" title="Smiley Embarassed" /&gt; (probably due to my poor english).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not want to &lt;U&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/U&gt; the DBMOD variable.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Futher more, I really don't see the interset to set this variable&lt;/EM&gt; &lt;img id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://forums.autodesk.com/i/smilies/16x16_smiley-surprised.png" alt="Smiley Surprised" title="Smiley Surprised" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I wanted to know is, in the reality as a simple user, &lt;U&gt;&lt;STRONG&gt;in which case this variable can be found equal to 32&lt;/STRONG&gt;&lt;/U&gt;.&lt;/P&gt;&lt;P&gt;In the documentation, they talk about "field"?!&lt;/P&gt;&lt;P&gt;I tried some tests modifying text's field, but this does not set the DBMOD to 32...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2012 13:22:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dbmod-32/m-p/3740597#M51949</guid>
      <dc:creator>glanard</dc:creator>
      <dc:date>2012-12-20T13:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: DBMOD = 32 ?</title>
      <link>https://forums.autodesk.com/t5/net-forum/dbmod-32/m-p/3740965#M51950</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/246236"&gt;@glanard&lt;/a&gt; wrote:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;What I wanted to know is, in the reality as a simple user, &lt;U&gt;&lt;STRONG&gt;in which case this variable can be found equal to 32&lt;/STRONG&gt;&lt;/U&gt;.&lt;/P&gt;
&lt;P&gt;In the documentation, they talk about "field"?!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="hps"&gt;I do not know&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;how&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;a normal user&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;can&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;get&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;value&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;DBMOD =&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;32 without&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;using the application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="hps"&gt;Also, I&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;should clarify that&lt;/SPAN&gt; &lt;U&gt;&lt;SPAN class="hps"&gt;the function&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;acdbSetDbmod&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;is&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;undocumented&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;and&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;unsupported and could change or go away&amp;nbsp;in any future release including an API compatible release &lt;/SPAN&gt;&lt;/U&gt;&lt;SPAN&gt;, I&lt;/SPAN&gt; was &lt;SPAN class="hps"&gt;reminded&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the guys from&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;Autodesk.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2012 18:15:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dbmod-32/m-p/3740965#M51950</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2012-12-20T18:15:00Z</dc:date>
    </item>
  </channel>
</rss>

