Jump to content

How to add a lisp as a command to quick access toolbar


Recommended Posts

Posted

I am customizing quick access toolbar by adding some command or creating new commands, and I want to create a new command to execute a lisp. It is a speacil burst command and its short command is nb so I wrote ^C^C_bn; in its command macro in customize user interface, but I could not execute it. Thanks in advance.

nburst.jpg

Posted

Does your command nb run properly when entered in the command line?

  • Like 2
Posted

Remove the _underscore. 

About Special Control Characters in Command Macros https://help.autodesk.com/view/ACD/2023/ENU/?guid=GUID-DDDB6E26-75E1-4643-8C6A-BEAEBA83A424

_ Translates commands and options that follow from the localized name to the global name.

 

As bn is a command defined by lisp it wouldn't have a localized name.

 

Assuming the lisp has been loaded in the current drawing ^C^Cbn; should work.

  • Like 1
Posted (edited)

^c^c(if (not bn)(load "bnlispfile.lsp"))bn

Edited by BIGAL
  • Like 1
Posted

Lots of macro options.

The ^C^C cancels both current command and selection.

From the link I posted above a ( )space or (;)semicolon issues enter in a macro separating actions in the macro.

The or function evaluates the expressions from left to right, looking for a non-nil expression so if  C:bn is already defined and returns True the next expression (load "bnlispfile.lsp") isn't evaluated (reloaded).

^C^C(or C:bn (load "bnlispfile.lsp"));bn

If you wanted your lisp to work with preselected objects you would need to leave out the ^C^C.

 

To test if there is a current command you would need to use DIESEL in the macro.

For example I replaced the Ctrl+A macro in the CUI Keyboard Shortcuts → Shortcut Keys

^C^C_ai_selall

which cancels any active commands (not always what you want it to do) with 

$M=$(if,$(getvar,cmdactive),_all,^P_ai_selall ^P) 

Now Ctrl+A uses the selection option _all while in an active command and _ai_selall when there isn't an active command so it selects all either way.

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...