Author Topic: Lisp Equivalent to AddCommand  (Read 1622 times)

0 Members and 1 Guest are viewing this topic.

jtoverka

  • Newt
  • Posts: 127
Lisp Equivalent to AddCommand
« on: May 07, 2022, 10:34:15 AM »
Hello All,

Is there an equivalent to Autodesk.AutoCAD.Internal.Utils.AddCommand for AutoLISP functions?
The reason I want to directly register LISP functions instead of the LispFunction attribute is I am using an IronPython module to load Python scripts into AutoCAD. It would be nice to create Lisp functions from Python. Right now I don't know how to use .NET attibutes in Python as decorators, so I am adding python functions as commands directly.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8691
  • AKA Daniel
Re: Lisp Equivalent to AddCommand
« Reply #1 on: May 08, 2022, 05:53:29 AM »
I see a RegisterLispCommand in the same space, I have no idea how to use it.
Possibly use AddCommand first? I don’t see an analog for acedGetArgs(), maybe you can call GetLispSymbol, SetLispSymbol to pass arguments
I don’t know if it’s possible to do via p/invoke, i.e. acedDefun and listen for AcRx::kInvkSubrMsg

jtoverka

  • Newt
  • Posts: 127
Re: Lisp Equivalent to AddCommand
« Reply #2 on: May 08, 2022, 02:14:36 PM »
Maybe I'll create Lisp/Python wrappers using GetLispSymbol, SetLispSymbol.