AutoCAD tips

Full-screen Shortcut for AutoCAD

I wanted a full-screen shortcut like Internet Exploder, Firefox and other web browsers, just for having a good look at a drawing on the whole screen with no distractions.

The Cleanscreen command is a good start but it didn’t go far enough for me, so I hacked it and added a few things to it. Now my full-screen has only the Top window bar with the quick-access menu and nothing else. Just this …

AutoCAD - Quick Acces toolbar only

… the thin edge of the window itself and wall-to wall CAD.

  • F11 –> Absolutely everything disappears. Full-on full screen
  • F11 again –> all the toolbars, status bar, menus come back to their rightful place

How?

AutoCAD-CUI-Macro windowOpen the CUI Editor and follow the instructions in AutoCAD’s help system – F1 –> search for “To create or modify a shortcut key”. Their well-illustrated explanation saves me cobbling one together. The only thing I’ll add to their instructions is that you can narrow your search of commands by typing any (that’s cool) part of the command’s name in the search box in the Command List section of the CUI window (bottom-left).

I dragged the “Clean Window” command onto the Shortcut Keys node. This is the command I started with before I broke perfected it. Click on the Macro line of the command section on the right in the CUI window (highlighted in red), then click on the […] box that appears on the right (trust me, it appears).

… then paste this code in the Long String Editor (actually, read to the end of this post because there is a better version below. I left this here for history’s sake)

$M=$(if,$(and,$(getvar,CleanScreenState),1),^C^C_CleanScreenOFF _commandline _MenuBar 1 statusbar 1,^C^C_CleanScreenON _commandlinehide _MenuBar 0 statusbar 0)

It is important to note that the spaces in the command list are significant so make sure you select all of it at once. The spaces (and commas, as it turns out) are the same as pressing the enter-key to execute the command. The observant amongst you will notice there are a few more characters in the screenshot. My original code needed a bit of a tidy-up.

If you haven’t already, assign a key to the shortcut, as per Help’s instructions. I used F11. Why? It is the same shortcut for most Internet browsers to go full-screen. For once, I’d like AutoCAD’s User eXperience to match something from the real world. Don’t get me started on that. Find. Replace. 3 Tab stops. Why?

That’s the practical part, done.

How it Works

For those of you who love to know how it works, here it is in its 3 parts. It is a Diesel (see AutoCAD –> F1) Macro. Notice that there are 3x commas in the if command which wraps the macro. The format of this macro is basically [Test], [Do if True], [Do if False]. Here is the same macro on 3 lines

$M=$(if,$(and,$(getvar,CleanScreenState),1),

^C^C_CleanScreenOFF _commandline _MenuBar 1 statusbar 1,

^C^C_CleanScreenON _commandlinehide _MenuBar 0 statusbar 0)

Working through the macro, this is what it does

  • the first part checks to see whether you’re in Cleanscreen mode or not.
  • the rest of the macro is in two halves, Cleanscreen on, Cleanscreen off
  • wherever you see ^C^C_ that means Ctrl-C, twice. This exits any lingering previous commands. My original code had a few superfluous Ctrl-C's.
  • CleanScreenOFF returns the menus etc. that the CleanScreenON command in the 2nd half of the macro hides
  • commandline restores the command line which is hidden by commandlinehide
  • MenuBar 1 and MenuBar 0 restore / hides the file-menu bar at the top for old farts like me who have grown attached to it.
  • statusbar 1 and statusbar 0 show and hide the status bar which is right at the bottom of the AutoCAD window.
  • as yet I haven't figured out how to show and hide the Model / Paper Space tabs.

Remove any of the above combinations if they don’t suit you. Don't forget the ^C^C_ at the start and the trailing space. Feel free to add anything to the macro and also please add it here to the comments.

**Update** I figured out how to show & hide the Model / Paper Space tabs.

AutoCAD Model & Layout Tabs

Add the code below to the bottom of your acadXXXXdoc.lsp (XXXX is the version of AutoCAD you are using). I found it in C: - Program Files - Autodesk - AutoCAD 2011 - Support**Update**  My bad - you are not meant to modify these files. Find (or if it doesn't exist, create) a file called acaddoc.lsp. See the link in the previous sentence for where to create this, depending on how specific you want it to be. By default AutoCAD will walk the support paths list looking for it. Basically, just put it somewhere in your support path, perhaps in the same place as the one you're not meant to modify.

The following LISP code sets up the commands to show and hide the Model / Paper Space tabs. You can actually use the commands anytime you want. Use Notepad or a similar plain text editor. DO NOT USE WORD !! Make a backup first, just in case. Watch out you don't miss any brackets - they are annoyingly important)

(DEFUN C:MLTABSON ()
(setenv "ShowTabs" "1") () (PRINC)
)
(DEFUN C:MLTABSOff ()
(setenv "ShowTabs" "0") () (PRINC)
)

Before these lines at the end of the acaddoc.lsp file (or add them if they don't exist):

;(princ "loaded.")
;; Silent load.
(princ)

The new macro to paste in the Long String Editor is:

$M=$(if,$(and,$(getvar,CleanScreenState),1),^C^C_CleanScreenOFF _commandline _MenuBar 1 statusbar 1 MLTABSON,^C^C_CleanScreenON _commandlinehide _MenuBar 0 statusbar 0 MLTABSOFF)

Here’s a tip conveniently placed at the end to see who dived in and who read the whole post before tinkering … Open a text editor and copy-paste your macro code at various crucial stages. This will give you an easy way to go back if you miss a space, comma or just generally mess it up.

5 thoughts on “Full-screen Shortcut for AutoCAD

  1. “as yet I haven’t figured out how to show and hide the Model / Paper Space tabs.”
    You can hide the tabs by choosing ‘Hide Layout and Model Tabs’ when you rightclick on the Space tabs.

    • Thanks Jan. I was trying to figure out how to do it programmatically so I could include it in my macro, I actually figured it out a week ago but I hadn’t got around to updating this post. You comment spurred me into action. Thanks.

  2. An official solution to “fullscreen” is here:
    http://www.cadforum.cz/cadforum_en/qaID.asp?tip=4767
    All it does is that “Cleanscreen” you said about (It also says that Ctrl+0 does it, too).
    However, I wanted to say that once you enter fullscreen in a way you described and exit it with “Cleanscreenoff” (or Ctrl+0), “CleanScreenOn” starts working just like your modified F11 :D

    Edit: Try using “Notepad++”. It makes any type of code easier to read. Changed “DEFUN” and “MLTABSOff” to “defun” and “MLTABSOFF” just for them to blend in ;-)

    Edit2: I get this:
    “Command: MLTABSON ; error: bad argument type: stringp nil”
    I’ve tried making an acaddoc.lsp file as well as editing acad2010doc.lsp. Lastly, leaving them both in Support folder at once. Even undoing what I did in my first “Edit”. To make it clear, the acaddoc.lsp looks like this:

    (DEFUN C:MLTABSON ()
    (setenv “ShowTabs” “1”) () (PRINC)
    )
    (DEFUN C:MLTABSOff ()
    (setenv “ShowTabs” “0”) () (PRINC)
    )

    (princ “loaded.”)
    ;; Silent load.
    (princ)

    Other than that, the macro runs fine.

    • Uthael , it looks like the quotes around the text had been hijacked by html rendering. They were smart quotes and LISP doesn’t recognize them. I’ve updated the post with code tags to render the quotes properly in the LISP code. Try copy-pasting again and it should work. Compare the new & old in Notepad++ – the text inside quotes is not syntax-highlighted in the version with the smart quotes – that was the clue that led me to the quotes issue.

      You shouldn’t edit acad2010doc.lsp, FYI – the acaddoc.lsp gets loaded after it anyway so anything in acaddoc.lsp will override the standard installation.

      Thanks for your feedback.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s