Code Red > .NET

Macro based upon calls from within a DLL command


Is it possible to create a button macro from calling loading a dll, then executing the calls from within the dll?

--- Code: ---^C^C(Load "C:\\Test\\Test.dll");Test1;;
--- End code ---

Loading the dll, the call would be Test1, with 2 enters to complete the macro.

If not, it was worth a shot.

First of all, the (load) function only loads lisp files. NET dll's must use the NETLOAD command.
What you want to do is called demand loading. The best way to deploy is to use a bundle. It supports the autoloader technology. From the preceding article, you would use the LoadReasonsflag and specify LoadOnCommandInvocation. To use this option, you also have to include a list of the commands you dll has defined. When your menu macro calls a function and the dll hasn't been loaded yet, acad automatically loads it.

The stackflow post you pointed to also mentioned another problem with trying to do what you warnings. Bundles get stored in folders that are trusted locations.

Thank you for shedding some light on that. On top of that, If the dll has sub options within the command, could a macro still be setup?

example. Test1, activates the command, then user has to click somewhere, a new subcommand prompts user, then the command would be completed.

--- Code: ---command: Test1
command: User pick polyline: (User picks)
command: Change the (L) Lineweight or (PE) pedit the polyline width: (User picks L)
command: What lineweight do you want to use?: (User types in 0.00) (Command is completed.)

--- End code ---

If your command follows AutoCAD standards, you can use standard command macro syntax. ^C cancels any command in progress. A space acts like {Enter}. a backslash = pause.


[0] Message Index

Go to full version