Hi,
I used send command for Export Layout
But the line only executes after exiting command method.
Can anyone help in this case.
thanks in advance.
Hi Everyone! I want to use this code in .net 2.0 and there is no LINQ. So I am using a library called LINQBridge to implement LINQ Objects but still i have problem with piece of code that needs linq.lambda.expressions ! Can Anyone Help Me? (In my case i need to use commands syncronously in autocad 2013)
Hi again!
Sorry i was wrong about my case. I need to run it for Autocad 2007, 2008 and 2009.
Any help would be appreciated
You can try this way (also from Tony Tanzillo) which does not use Linq.
public static class EditoExtension
{
static MethodInfo runCommand =
typeof(Editor).GetMethod("RunCommand", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
public static PromptStatus Command(this Editor ed, params object[] args)
{
if (Application.DocumentManager.IsApplicationContext)
throw new InvalidOperationException("Invalid execution context for Command()");
if (ed.Document != Application.DocumentManager.MdiActiveDocument)
throw new InvalidOperationException("Document is not active");
return (PromptStatus)runCommand.Invoke(ed, new object[] { args });
}
}
If it still doesn't work, you have to P/Invoke the unmanaged acedCmd method.
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acad.exe", EntryPoint = "acedCmd",
CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
extern static private int acedCmd(IntPtr resbuf);
/// <summary>
/// Call an AutoCAD command (works synchronously).
/// </summary>
/// <param name="args">A ResultBuffer containing the command name followed by command inputs.</param>
public static void Command(ResultBuffer args)
{
acedCmd(args.UnmanagedObject);
}
Hi, I'm trying to use this method but ran into an issue where I get 'null' for the MethodInfo object. I made a post about it. If anyone can help me out, that would be great. Thanks! https://forums.autodesk.com/t5/net/question-re-send-command-executes-after-exiting-command-method/td...
Can't find what you're looking for? Ask the community or share your knowledge.