Just as AutoCAD .NET commands can be localizable, so can AutoCAD .NET LISP functions. We created a LISP function with AutoCAD .NET previously and specifically demonstrated various argument inputs and outputs. But that LISP function was not localizable. It only had a global name.
In this post, let us see how to define localizable LISP functions with AutoCAD .NET API.
It is pretty straightforward. We only need to use a different signature of the LispFuntion attribute which has four parameters this time. The first one is still the global name, the second resource id pointing to a local name of the LISP function, the third help file name, and the fourth help topic index. The argument for the method is still the same, a type of ResultBuffer:
[LispFunction("HelloFriends", "TestLispFunction_ID", "HelpFile.chm", "TestLispFunction_HelpTopic")]
public Object TestLispFunction_Method(ResultBuffer rb)
{
return true;
}
If the resource id is defined in an English resource file like the following for example:
and an AutoCAD English is launched, the assembly is loaded, and the LISP function with both the global name and the local name are tried, the command line outputs will look like:
Command: (HelloFriends)
T
Command: (HeyBuddies)
T
So both versions work well.
If the resource id is also defined in a German resource file like the following:
and the same things are tried in a German AutoCAD, the following outputs are expected:
The leading edge AutoCAD .NET Addin Wizard (AcadNetAddinWizard) provides a Lisp Functions Wizard to help us define localizable LISP functions in .NET addins.
Posted by: |