For example:
[code]
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)]
extern static private void ads_regen();
// Define Command "REGEN_CS"
[CommandMethod("REGEN_CS")]
public void Regen_CS() {
ads_regen();
}
[/code]
Other solution:
[code]
using System ;
using Autodesk.AutoCAD.Runtime;
// You *MUST* add Reference to 'AutoCAD 200X Type Library'
// and 'AutoCAD/ObjectDBX Common 16.0 Type Library'
using Autodesk.AutoCAD.Interop;
using Autodesk.AutoCAD.ApplicationServices;
using AcadInt = Autodesk.AutoCAD.Interop;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
[assembly: CommandClass(typeof(ClassLibrary.Class))]
namespace ClassLibrary {
public class Class {
public Class() {}
// Define Command "REGEN_ALL"
[CommandMethod("REGEN_ALL")]
static public void REGEN_ALL() {
AcadInt.AcadApplication App = (AcadInt.AcadApplication)AcadApp.AcadApplication;
AcadInt.AcadDocument Doc = App.ActiveDocument;
Doc.Regen(AcadInt.Common.AcRegenType.acAllViewports);
}
// Define Command "REGEN_ACTIVE"
[CommandMethod("REGEN_ACTIVE")]
static public void REGEN_ACTIVE() {
AcadInt.AcadApplication App = (AcadInt.AcadApplication)AcadApp.AcadApplication;
AcadInt.AcadDocument Doc = App.ActiveDocument;
Doc.Regen(AcadInt.Common.AcRegenType.acActiveViewport);
}
}
}
[/code]
Message was edited by: Alexander Rivilis