How to get Command in MenuGroup not used in Menu or Toolbar yet via VLISP?

How to get Command in MenuGroup not used in Menu or Toolbar yet via VLISP?

alexKoshman
Collaborator Collaborator
661 Views
6 Replies
Message 1 of 7

How to get Command in MenuGroup not used in Menu or Toolbar yet via VLISP?

alexKoshman
Collaborator
Collaborator

Hello to everybody!

 

Who can tell me how to get the access via VLISP methods to the Command that was created in the CUI but not used yet in any Toolbar or Menu?

Why we can only have access to Menu or Toolbar Items?

 

That's strange!?

Why to have "universal" Commands for Ribbons\Menus\Toolbars and can't catch them via VLISP?..

0 Likes
662 Views
6 Replies
Replies (6)
Message 2 of 7

scot-65
Advisor
Advisor
I believe not enough information on your part.

Are you loading your custom LISP thru a third-party
interface point such as ACADDOC.lsp or MyMenu.MNL?

If not, then you must have something like a hard-path
prefix + file name that is declared in the commands
section of the CUI?

For this second query, keyboard commands will (may)
not be available. Only being able to populate the UI
elements is what you get. Oh, yea, once the LSP files are
loaded, then you have keyboard assignments, but your
talk hints that it is being loaded from the first call via a UI
element.

For the earlier, keyboard commands are declared and one
can populate the command section of the CUI with these
keyboard commands and thus populate the UI elements.
The result is both keyboard and UI access to your custom
commands.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 3 of 7

alexKoshman
Collaborator
Collaborator

Hi scot-65!

 

When I say "Commands created in the CUI" I exactly mean "Commands created in the Command section CUI dialog" here at its bottom left corner.

And there are no way to get the Command object via VLISP if that Command don't have his place in Toolbar or Pop-up Menu.

 

The Holy Help ; )) says that we can't get it via the AutoCAD Object Model. See attached picture...

 

And we know very well that there can be a lot of Commands that are not used at the moment in the Toolbars or the Menus OR is used in some Ribbons!!

0 Likes
Message 4 of 7

scot-65
Advisor
Advisor
Point to a desired command in that bottom-left pane.
Now, in the bottom-right pane is a line that says "Macro".
That is the command.
If you cannot see the right panes (due to QuickCUI), select
the black dot with the greater-than symbol.

FYI:
^C^C is a cancel prefix.
' (apostrophe prefix) is a transparent command
_ (underscore prefix) is use native language

Example:
^C^C_3dalign

To make this a keyboard command, there are 2 ways of doing this:

1) Edit the acad.PGP file and create a command alias. This file is
for native AutoCAD commands (only). It is not for commands
with one option pre-selected.

2) If it is not a native command, then create ACADDOC.lsp file and
place this file in one of the support paths declared in OPTIONS
(or create a path of your own). Edit this file using an ASCII text editor
(not WORD), and add lines inside defining your custom keystrokes.
For this example, I will use the above example even though it is
a native command and can be written into that PGP file.
(defun c:3da () (command "_3dalign" pause)(princ))
If the custom file has no "defun c:..." inside, then either add it or
use this format:
(defun c:ABC () (load "ABC")(princ)) ;<-- if file is in a support path
(defun c:ABC () (load (strcat HardPathPrefix "ABC"))(princ))

Command 3Point cannot be written in the PGP file due to one option
is pre-selected:
^C^C_ucs _3

Instead, do this:
(defun c:3P () (command "_UCS" "_3" pause)(princ))

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 5 of 7

alexKoshman
Collaborator
Collaborator

"VIA VLISP"...   : (((

0 Likes
Message 6 of 7

dgorsman
Consultant
Consultant

IMO you're looking at this in the wrong direction.  Work from the outside (user) down - use the "command definitions" in the CUIx to call functions defined in LISP or other APIs.  Trying to go from the bottom (functional code) up is problematic at the very least.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 7 of 7

alexKoshman
Collaborator
Collaborator

Thank you dgorsman

 

 

I wanted to add some "ready-to-cook" CUI Command from some loaded CUI (MenuGroup) in place of making it inside some other CUI (MenuGroup).

Ten I thought it would be easier... : ((

 

And I still hope I can! ; ))

0 Likes