Ok, I took the most simple way out (for me anyway) and it seems to work, what you may need to do is have a C# command that asks for and loads you IronPy commands or just add them to a file similar to below, ie. create a delegate for each functions and call RegPyCmd() for each one.
hope it works at your end.
here's the C# code
// Created By: Mick Duprez, 27th August 2007
// Test application to test use of acedRegCmds wrapper function in C
using System ;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Runtime ;
using Autodesk.AutoCAD.EditorInput;
[assembly: CommandClass(typeof(ClassLibrary.DCSClass))]
namespace ClassLibrary
{
/// <summary>
/// Summary description for DCSClass.
/// </summary>
public class DCSClass
{
public DCSClass()
{
//
// TODO: Add constructor logic here
//
}
public delegate void TestCb();
public static void testcommand()
{
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
ed.WriteMessage("\ntest delegate seems to work!\n");
}
// import the dll:
[DllImport("IronPyCmdReg.dll",
CallingConvention=CallingConvention.Cdecl,
EntryPoint = "?RegPyCmd@@YAXPBD0HP6AXXZ@Z")]
public static extern void RegPyCmd(string cmdGroup,
string cmdName,
CommandFlags cmdFlags,
[MarshalAs(UnmanagedType.FunctionPtr)] TestCb functionptr);
// Define Command to register commands without using attributes:
[CommandMethod("regcmds")]
static public void test() // This method can have any name
{
// create the callback
DCSClass.TestCb cb = new DCSClass.TestCb(DCSClass.testcommand);
// PInvoke the RegPyCmd() function:
DCSClass.RegPyCmd("pycmds","testpy",CommandFlags.Session,cb);
}
}
}
The C code -
// Created By: Mick Duprez, 27th August 2007
//************ Iron Python Command Register Function ************************//
__declspec(dllexport) void __cdecl RegPyCmd(const char * cmdGroup,
const char * cmdName,
int cmdFlags,
void(*functionptr)())
{
// Note: cast functionptr as AcRxFuctionPtr.
acedRegCmds->addCommand(cmdGroup, cmdName, cmdName, (int)cmdFlags,(AcRxFunctionPtr)functionptr);
}
I've also attached the test C# dll and native dll that is PInvoked, I'll post the 2 solutions when I get a chance (I'm still getting a huge arx sln???). Both dlls' were tested on ac2006.