How do you run a custom macro cui command

How do you run a custom macro cui command

MikeKovacik4928
Advisor Advisor
5,836 Views
6 Replies
Message 1 of 7

How do you run a custom macro cui command

MikeKovacik4928
Advisor
Advisor

Hi all

 

I am new to this customisation. I tried it way back in 2000, gave up and am now trying again.

I have entered a test command in the CUI dialogue box.

I tried typing in the new command name at the command line. No luck, not recognised.

 

How do I run my test command?

 

 

Michael Kovacik
AutoCAD 2d & 3d (29 yrs)& Inventor (7 yrs)
Manufacturing (30 yrs) Draughtsman/Designer
Autodesk Product Design Suite Ultimate 2018
Johannesburg, South Africa

Autocad 2018, Inventor Pro 2018

Impossible only means you haven't found
the solution yet

0 Likes
5,837 Views
6 Replies
Replies (6)
Message 2 of 7

Ranjit_Singh
Advisor
Advisor

Maybe something like this 

^C^C_line;\\;_line;\\;

I also don't think you can call it at command line. You need a toolbar.

0 Likes
Message 3 of 7

cadffm
Consultant
Consultant
^C^C_line;\\;_line;\\;
For 2 Lines
*^C^C_line;\\;
Should work for new lines till escape

"Test1" is only the name of your cui item, not a command name

You can attach a shortcut to start the macro
http://help.autodesk.com/view/ACD/2018/ENU/?guid=GUID-B07858CD-9B39-42CD-ADF1-D67B61F8B9A5

Or you create a action macro (action recorder)
Or use Lisp for that, then you have to load the code in every file.
http://help.autodesk.com/view/ACD/2018/ENU/?guid=GUID-FDB4038D-1620-4A56-8824-D37729D42520
(defun c:Test1 () (command "_.line" pause pause "")(princ))

Sebastian

0 Likes
Message 4 of 7

MikeKovacik4928
Advisor
Advisor

Still can't figure it out.

Just want the step to run the custom command created "test"

If I can't run it from the command line, what is the best way to do it and how.

I am afraid I am going to have to be spoon fed.

Can anybody explain simply or point me to a nice step by step tutorial

 

Michael Kovacik
AutoCAD 2d & 3d (29 yrs)& Inventor (7 yrs)
Manufacturing (30 yrs) Draughtsman/Designer
Autodesk Product Design Suite Ultimate 2018
Johannesburg, South Africa

0 Likes
Message 5 of 7

devitg
Advisor
Advisor

I used to run a LISP defun , at the customize tool bar settings , then load it with the ACADDOC 2xxx , so I , if need,  type it at the command line 

 

Hope it help. 

 

 

 

 

 

0 Likes
Message 6 of 7

wkmvrij
Advocate
Advocate

Step 1:
Decide whether you want a Button to get your command going or a ribbon or both.

 

THIS WILL STICK TO A TOOLBAR BUTTON.

 

 

Step 2: Giving a name to your new command:


If you have toolbars on, click on an empty space on a toolbarline.
If you have the command lie on, type in _CUI.


The CUI opens. On the LEFTHAND side you will have two panels visible. The bottom one called "COMMAND LIST" will list all currently named (and defined) commands. Looking down you will have first a search panel, then a filter list, next to which there are two buttons. The righthand button will create a new entry in the list, called "command1". Edit it to the name of your command.

 

 

Step 3: Defining what your command will do:


If the CUI interface shows one column of panels only, click the button on the far right bottom of the CUI.
Make sure you have the new command name selected in the Command list. Then the right side of the CUI will give you all the possibilities to define and illustrate your new command. The "Macro" entry will open a small stringeditor allowing you to write a (small) macro that will be executed when the command is called. The editor is already preloaded with the obligatory escape codes preceding all menu commands.
If you remeber the old days where one would write screen menus or tablet menus grosso modo all syntax requirements are still valid in this string editor. In fact, this little editor replaces the functions of the MNU and MNX files. 


If your command were to be calling a Lisp routine, the macro would be something like "^C^C(somefunc)" or if the LSP would contain a (defun C:somefunc one would write "^C^Csomefunc;" 

 

Add the references to helpfiles you might have written, and the names of bitmapfiles you want to appear on toolbuttons or ribbons.

 

Step 4: putting the new command at the disposal of the user:


Here you decide from which source you want to present the new command to the user. Possebilities are: a panel in a tab in a ribbon, a button in a toolbar, an entry in a menu, an entry in a shortcut menu, or all or any off the above.


Display the TOPLEFT interface in the CUI.
You navigate within the treeview to the place where you want to be: Select toolbars, select a specific toolbar and display the contents of the toolbar.

 

Now in the command list, select the command name you just created and dragdrop it to the position in the displayed toolbar where you want it to be.

You may swap steps 3 and 4, however the order here presented seems moor logical.

 

Pressing Apply (on the bottom line of the CUI) will show your toolbutton in the appropriate position. Clicking the button will execute your new command

Be sure to save your changes. Make sure that the location of the bitmaps for the newly made button is listed in the file search path or a default question mark bitmap is shown.

Message 7 of 7

scot-65
Advisor
Advisor
If you want to use the keyboard as part of the interface,
you will need to create a LISP file (there are other methods
as well, such as executing a SCR file, but let's not go there
for now).

This file will have to be loaded from one of several
third-party interface points.
The easiest one to use is the APPLOAD --> Startup Suite.
ACADDOC.lsp, ACAD.lsp and MyMenu.MNL are a few others.
These others are not in the OOTB folder system. It is up to
us third-party people to create these files and place in the
appropriate area.

Inside the LISP file, the first line of code will be
(defun c:TEST (/)

The last line will be the closing parenthesis.
)

In between is where you enter commands, etc.
(command "LINE" pause pause "")
is one very simple example.

Expanding the above, let's test user input first:
(if (and (setq pt1 (getpoint "Specify first point: "))
(setq pt2 (getpoint pt1 "Specify end point: ")))
(command "LINE" pt1 pt2 "")
);if

Now that you have a keyboard declaration and the
program is loaded when the editor is started, one
can define a command in the CUI command list where
in the Macro section make a call to the LISP
^C^Ctest;

Drag and drop this newly created command into any
of the on-screen user interface (UI) elements.

???

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