View Full Version : New function in ObjectARX for LISP
erick_19_hk266024
2013-08-24, 04:34 PM
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
BlackBox
2013-08-26, 12:46 PM
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 (http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=773204):
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
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:
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 (http://forums.augi.com/showthread.php?80461-Page-Setup-Manager&p=1219546&viewfull=1#post1219546) includes one such example.
Cheers
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.