Results 1 to 2 of 2

Thread: New function in ObjectARX for LISP

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2013-08
    Posts
    1


    Smile 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

  2. #2
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,195


    Default Re: New function in ObjectARX for LISP

    Welcome to AUGI, and congrats on your first post!

    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
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Autodesk Exchange Apps

Similar Threads

  1. CP33-2: Creating Your Own LISP API with ObjectARX®
    By Autodesk University in forum Customization and Programming
    Replies: 0
    Last Post: 2013-03-30, 02:10 AM
  2. My first lisp function...
    By JLHConsulting in forum AutoLISP
    Replies: 19
    Last Post: 2010-06-11, 06:06 PM
  3. Replies: 7
    Last Post: 2009-11-02, 05:38 AM
  4. Arrow OR Tab Key Function In Lisp?
    By omorah in forum AutoCAD Customization
    Replies: 2
    Last Post: 2008-11-20, 02:59 AM
  5. Using the inters function in Lisp
    By Lions60 in forum AutoLISP
    Replies: 5
    Last Post: 2007-07-09, 12:27 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •