TheSwamp
Code Red => .NET => Topic started by: Draftek on May 08, 2007, 03:43:17 PM
-
I'm playing around with managed c++ and cannot get a command to work:
I can't get the assembly:CommandClassAttribute method to compile and if I comment it out, the command "MyTest" does not register with AutoCAD.
// MgdCpp.h
#using <System.dll>
#using <..\..\..\Program Files\Autodesk\Acadm 2007\acdbmgd.dll>
#using <..\..\..\Program Files\Autodesk\Acadm 2007\acmgd.dll>
#pragma once
using namespace System;
using namespace Autodesk::AutoCAD::Runtime;
//[assembly: CommandClassAttribute(MgdCpp::Commands::typeid)]
namespace MgdCpp {
public ref class Commands
{
[CommandMethodAttribute("MyTest")]
static void MyTest()
{
}
};
}
see anything blaring wrong?
-
Mr. Matchmaker;
I don't have my books here... but I remember that Master Daniel uploaded a SLN project here.
Anyway, I have never have done any managed C++ code, but, it does not follow basically the same as in C++?
Like in your header file:
using namespace Autodesk::AutoCAD::Runtime;
using namespace Autodesk::AutoCAD::DatabaseServices;
namespace ClassLibrary
{
public class LESQClass
{
private:
LESQClass() {};
[Autodesk::AutoCAD::Runtime::CommandMethodAttribute("CMDTEST1")]
static void cmdtest1();
};
}
void ClassLibrary::LESQClass::cmdtest1()
{
}
Don't know...
if you use the arxwizard for your solution and click in the .NET checkbox... it will generate the basic skeleton...
edit: some grammatical that was super mickey mouse...
-
I'm playing around with managed c++ and cannot get a command to work:
I can't get the assembly:CommandClassAttribute method to compile and if I comment it out, the command "MyTest" does not register with AutoCAD.
// MgdCpp.h
#using <System.dll>
#using <..\..\..\Program Files\Autodesk\Acadm 2007\acdbmgd.dll>
#using <..\..\..\Program Files\Autodesk\Acadm 2007\acmgd.dll>
#pragma once
using namespace System;
using namespace Autodesk::AutoCAD::Runtime;
//[assembly: CommandClassAttribute(MgdCpp::Commands::typeid)]
namespace MgdCpp {
public ref class Commands
{
[CommandMethodAttribute("MyTest")]
static void MyTest()
{
}
};
}
see anything blaring wrong?
You need to make your CommandMethod Public:
public ref class Commands
{
public:
[CommandMethodAttribute("MyTest")]
static void MyTest()
{
}
};
-
You need to make your CommandMethod Public:
DOH! - I KNEW it was something simple.
Thanks guys!
Any clue why the CommandClassAttribute will not compile? I'm guessing I'd have the same problem with IExtensionApplication Attribute as well, which I use on occasion.
-
Dang... I see that my response was indeed out-of-scope... :oops: :oops:
-
Dang... I see that my response was indeed out-of-scope... :oops: :oops:
I'll gladly trade my knowledge of C++/CLI for your knowledge of ARX... You'd
get the short end of that stick... :)