Code Red > .NET

Creating a "CommandMethod" through code.

(1/3) > >>

TR:
I have a demo of AutoCAD 2007 installed on my system and within a few weeks I will have 2008 electrical installed. Now that I have a version of AutoCAD that doesn't have a crippled version of the .NET API (ACAD 2005) I have decided to start working on my PyAcad.NET project again. With this being said I am trying to find a way to create a command method through code. IronPython doesn't support .NET attributes so I'm out of luck there but I'm sure there is a way to define them without using attributes. Since my python code is compiled when executed I should be able to somehow plugin to the command registration stuff I'm thinking.


Any thoughts?


note:
1) You can download a binary package for AutoCAD 2007 and/or the source from the google code page linked above.
2) I asked this in another post but my ideas have changed a bit.

Edit by MP: Fixed the url.

TR:
Thanks for fixing that for me Michael. :)

It's Alive!:
Question, are you referencing a compiled .NET .DLL or are you still compiling/executing on loading of the file?

TR:
I''m compiling and executing when loading the files.

It's Alive!:
Yeah, that’s a tough one. I don’t quite follow what your intentions are.

There are a couple of different ways you can define a new command, but in all cases, you would need to provide a pointer or reference to the method you wish to invoke. Even a wrapper method would need to know what to invoke when called.

You might be able to get around not having an attribute by putting a prefix on the method such as “cmd:”,
upon loading an assembly…

--- Code: ---System::Reflection::Assembly::LoadFrom(fileName);

--- End code ---

You could probably scan all the method names and add them as AutoCAD commands.

But you are doing something entirely different right?


--- Code: ---CompiledCode cc = engine.CompileFile(ofd.FileName);
cc.Execute();

--- End code ---

I am not sure where you want to point your new commands at.

Navigation

[0] Message Index

[#] Next page

Go to full version