.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
DBMOD = 32 ?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
Can anyone give me an example how to get the system variable DBMOD = 32 or (DBMOD AND 32)=32?
Actually, I consider the drawing need really to be saved only if DBMOD is equal to 1,4 or 5. Is that right?
Regards,
Re: DBMOD = 32 ?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
In order to set DBMOD variable you can P/Invoke acdbSetDbmod function:
long __cdecl acdbSetDbmod(class AcDbDatabase *, long newDBMod);
Example:
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.Data base;
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.D ocumentManager)
{
Database db = doc.Database;
acdbSetDbmod(ref db, 0);
}
}
};
}
This code is only for x86 AutoCAD. x64 is different with EntryPoint string:
EntryPoint = "?acdbSetDbmod@@YAJPEAVAcDbDatabase@@J@Z"
Re: DBMOD = 32 ?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Alexander,
Probably my question was not very clear
(probably due to my poor english).
I do not want to set the DBMOD variable.
Futher more, I really don't see the interset to set this variable ![]()
What I wanted to know is, in the reality as a simple user, in which case this variable can be found equal to 32.
In the documentation, they talk about "field"?!
I tried some tests modifying text's field, but this does not set the DBMOD to 32...
Regards,
Re: DBMOD = 32 ?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
glanard wrote:
What I wanted to know is, in the reality as a simple user, in which case this variable can be found equal to 32.
In the documentation, they talk about "field"?!
I do not know how a normal user can get value DBMOD = 32 without using the application.
Also, I should clarify that the function acdbSetDbmod is undocumented and unsupported and could change or go away in any future release including an API compatible release , I was reminded the guys from Autodesk.




