.NET

Reply
Active Contributor
skeletank
Posts: 26
Registered: ‎08-25-2010
Message 1 of 2 (449 Views)
Accepted Solution

Dynamically load commands at AutoCAD start

449 Views, 1 Replies
08-25-2010 06:33 AM

Right now I have some explicitly defined commands in C# code like such:

 

[CommandMethod("SomeCommand")]

public static void SomeCommand()

{
   //Code
}

 

There used to be a large number of AutoCAD scripts that frequently change.  Each script was tied to a command using AutoLISP.  Now I have all of the script information stored in a sql database.  Included in the database information for each script is the old command name.  I need a way using C# to register these commands when I NETLOAD my dll.  Is this or a similar method possible? 

 

I already have two possible solutions but they are not preferred.

 

1.  Create one explicitly defined command which takes the old command as a parameter.  This option is probably not possible because the users are used to the command names and would prefer not to have to type more. 

 

2.  Create a code generator to explicitly define the commands.  The code generator would defeat the purpose of having a database because you would have to recompile whenever a new command is added, one is deleted, etc.

The undocumented AddCommand() method of the

Autodesk.AutoCAD.Internal.Utils class will do it.

Valued Mentor
caddzone
Posts: 305
Registered: ‎01-26-2005
Message 2 of 2 (415 Views)

Re: Dynamically load commands at AutoCAD start

08-26-2010 04:26 AM in reply to: skeletank

The undocumented AddCommand() method of the

Autodesk.AutoCAD.Internal.Utils class will do it.



AcadXTabs for AutoCAD
Supporting AutoCAD 2000-2011


Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!