Message 1 of 4
Not applicable
03-19-2015
03:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have this code: (from here: http://www.acadnetwork.com/index.php?topic=292.0 )
// Replace "accore.dll" by "acad.exe" for AutoCAD versions prior to 2013
[System.Security.SuppressUnmanagedCodeSecurity]
[System.Runtime.InteropServices.DllImport("accore.dll", EntryPoint = "acedCmd", CharSet = System.Runtime.InteropServices.CharSet.Unicode, CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl)]
extern static private int acedCmd(IntPtr resbuf);
[CommandMethod("offpl")]
public void cmdOffset()
{
ResultBuffer rb = new ResultBuffer();
// RTSTR = 5005
rb.Add(new TypedValue(5005, "_.OFFSET"));
// start the insert command
acedCmd(rb.UnmanagedObject);
bool quit = false;
// loop round while the insert command is active
while (!quit)
{
// see what commands are active
string cmdNames = (string)Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("CMDNAMES");
// if the INSERT command is active
if (cmdNames.ToUpper().IndexOf("OFFSET") >= 0)
{
// then send a PAUSE to the command line
rb = new ResultBuffer();
// RTSTR = 5005 - send a user pause to the command line
rb.Add(new TypedValue(5005, "\\"));
acedCmd(rb.UnmanagedObject);
}
else
// otherwise quit
quit = true;
}
}In AC 2007 it works fine. I've changed acad.exe to accore.dll, but nothing happens.
I'm not getting even "Unknown command".
Can someone help me?
Solved! Go to Solution.