Tony, I found the following code posted by you. I changed it to fillet the last polyline. But when I run TestInvokeLisp in AutoCAD i don't get a result. Nothing happens and I do not really understand what your code does, so it's very difficult to find the bug. Perhaps you can help me.
Thank you.
// Here ist the code I have
using System;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using System.Runtime.InteropServices;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
namespace AcadTools
{
public class AcedInvokeSample
{
public const int RTLONG = 5010; // adscodes.h
public const int RTSTR = 5005;
public const int RTNORM = 5100;
public AcedInvokeSample()
{
}
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)]
extern static private int acedInvoke(IntPtr args, out IntPtr result);
public static ResultBuffer InvokeLisp(ResultBuffer args, ref int stat)
{
IntPtr rb = IntPtr.Zero;
stat = acedInvoke(args.UnmanagedObject, out rb);
if (stat == (int)PromptStatus.OK && rb != IntPtr.Zero)
return (ResultBuffer)
DisposableWrapper.Create(typeof(ResultBuffer), rb, true);
return null;
}
[CommandMethod("TestInvokeLisp")]
public static void TestInvokeLisp()
{
ResultBuffer args = new ResultBuffer();
int stat = 0;
args.Add(new TypedValue(RTSTR, "_fillet"));
args.Add(new TypedValue(RTSTR, "p"));
args.Add(new TypedValue(RTSTR, "_last"));
ResultBuffer res = InvokeLisp(args, ref stat);
if (stat == RTNORM && res != null)
{
PrintResbuf(res);
res.Dispose();
}
}
}
}