.NET

Reply
Contributor
simonkx
Posts: 20
Registered: ‎12-29-2005
Message 1 of 2 (355 Views)

How to regenerate the drawing?

355 Views, 1 Replies
03-05-2006 02:10 AM
How to regenerate the drawing with C#,or which method can?
Thanks for the example!
Distinguished Contributor
Alexander Rivilis
Posts: 303
Registered: ‎09-26-2004
Message 2 of 2 (354 Views)

Re: How to regenerate the drawing?

03-05-2006 10:14 AM in reply to: simonkx
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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.