Really basic - how to string commands together?

Really basic - how to string commands together?

MbMinx
Enthusiast Enthusiast
1,803 Views
8 Replies
Message 1 of 9

Really basic - how to string commands together?

MbMinx
Enthusiast
Enthusiast

I would like a custom tool that can basically set both UCS and PLAN back to world with one click. I just can't find out how to create a command string because I don't know what character to use to separate the commands. In my preferred software, I would type it something like:

 

UCS WORLD; PLAN WORLD

 

And I could assign that to a function key or special icon or such. I have found where I could include some of my own customizations, but I don't really know the first thing about how to string more than one command together.

 

And just to let you know, my first language is Bentley/Microstation, so while we're speaking AutoCAD, please speak slowly and specifically. I'm not actually an idiot, but I resemble one in AutoCAD. Thank you.

0 Likes
Accepted solutions (3)
1,804 Views
8 Replies
Replies (8)
Message 2 of 9

pendean
Community Legend
Community Legend
Accepted solution
Button/icon macro code or keyboard shortcut through CUI command:

^C^C_ucs;_world;_plan;_world



0 Likes
Message 3 of 9

ВeekeeCZ
Consultant
Consultant
Accepted solution

If you omit all the fancy stuff, this simple one will actually work too.

 

ucs world plan world

A space works as well as semicolons, but semicolons are more common to use in Command Macros.

Macros with _EnglishCommandNames with underscore prefix are understandable to non-English versions of AutoCAD as well. Since you're probably using English AutoCAD, you don't need them. ^C is as ESC hit to exit any running command, if there is any. 

 

For more info about Command Marcos look HERE 

0 Likes
Message 4 of 9

Johneng
Collaborator
Collaborator

I have always liked this PDF Introduction to Macro Writing from Kate Morrical.

 

https://forums.autodesk.com/autodesk/attachments/autodesk/520/11526/1/AU09_SpeakerHandout_CP214-1.pd...

 

Message 5 of 9

Anonymous
Not applicable

A simple lisp defun [code]

(defun c:wplan () (command “Ucs” “world” “plan” “world”))

[\code]

0 Likes
Message 6 of 9

Kent1Cooper
Consultant
Consultant
Accepted solution

@pendean wrote:
Button/icon macro code or keyboard shortcut through CUI command:
^C^C_ucs;_world;_plan;_world

 

Or even just:

 

^C^C_.ucs ;_.plan ;

 

since World is always the default option for the UCS command, and the current UCS is always the default for the PLAN command.

 

[I included both the _ and . prefixes for any-language-version and native-command-definition usage -- you can omit those if you use whatever the command names are in the language version you use, and if there's no chance either of those commands will have been given a different definition.  And I used a space followed by a semicolon {= Enter} for both, but you can use two semicolons, or even two spaces, which I don't typically do because with more than one, it's harder to tell how many there are when looking at the code.]

 

If you have UCSFOLLOW System Variable set to 1, you can do merely:

 

^C^C_.ucs ;

 

and it will automatically go into PLAN view in it without the need for a PLAN command.

Kent Cooper, AIA
Message 7 of 9

MbMinx
Enthusiast
Enthusiast

Thank you all - that is very helpful!

It just seems like the easiest way to make sure I get any UCS set back to world. Thank you so much for your suggestions and insight.

0 Likes
Message 8 of 9

pendean
Community Legend
Community Legend
Good tip Kent, but I prefer to spell it out all the time (no harm is ever done that way) and I tend to avoid spaces as on some screens it is hard to spot 1 vs 2 spaces when you are rushed.


0 Likes
Message 9 of 9

Nik4_99
Enthusiast
Enthusiast
A few minutes ago I was looking for some other solution, and thinking "things I need to do are not too complicated, and yet - I need some basic Macro tutorial" - and there it is.
Thank you.
0 Likes