.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to regenerate the drawing?

1 REPLY 1
Reply
Message 1 of 2
Anonymous
752 Views, 1 Reply

How to regenerate the drawing?

How to regenerate the drawing with C#,or which method can?
Thanks for the example!
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost