New function in ObjectARX for LISP
Good morning, I would like to ask a favor, could someone give me an example of how to create a new function in ObjectARX for LISP? and how could put on and take values in Lisp from ObjectARX?
Thank you very much now
Re: New function in ObjectARX for LISP
Welcome to AUGI, and congrats on your first post! :beer:
Here's an excerpt from ArxDev.chm on the LispFuncton Method, which is part of the ObjectARX SDK:
Quote:
Originally Posted by ArxDev.chm, Defining Methods That Can Be Called From AutoLISP
Defining Methods That Can Be Called From AutoLISP
Managed applications can define methods so that they can be called by AutoLISP applications. To do so, the managed application tags the desired method with the Autodesk.AutoCAD.Runtime.LispFunction attribute. This attribute can be used in the same places and has the same properties as the CommandMethod attribute. The key difference lies in the signature form to which LispFunction may be applied. LispFunction is valid only for methods of the form
Code:
public ResultType MyHandler(ResultBuffer args) {
...
}
where ResultType can be any one of the following types:
- int
- double
- TypedValue
- ResultBuffer
- string
- Point2d
- Point3d
- bool
- void
- ObjectId
- SelectionSet
The Autodesk.AutoCAD.Runtime.LispDataType enumeration defines .NET identifiers that represent the data types passed through AutoLISP ResultBuffer arguments.
For instance, the following C# code defines an AutoLISP-callable “Hello World” method:
Code:
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.ApplicationServices;
...
[LispFunction("c:helloworld")]
public void hw(ResultBuffer args)
{
Editor ed =
Application.DocumentManager.MdiActiveDocument.Editor;
ed.WriteMessage('\n' + "Hello World!" + '\n');
}
... There are a lot more examples of custom LispFunction Methods in .NET API (specifically C#) - this post includes one such example.
Cheers