Category: Macros

We’re Migrating! (Part I: Exporting)

AutoCAD 2013 will be sweeping the office and magically finding its way onto our hard-drives (or in my case, solid-state drive #upgrade!) in a few days. Training will be held for a few hours and by the end of it all, I’m sure that I will be the only one still excited or willing to use 2013 with any new features. I’m waiting for the “How do you turn this ribbon thing off?!” calls resounding through the office.

I thought this would be a good chance for me to describe some migration techniques that can help anyone through this IT ordeal. I will soon be doing this myself as to not lose the interface I’ve worked so hard on. I already described for you how to create buttons, macros and profiles; so this will build on those concepts. (If you need more detailed descriptions for these items, please see past entries of the AngryCAD blog.)

You’re going to want to save three items. Your profile, (if you using AutoCAD full, not LT… Sorry LT people. ) Your .CUI file (which includes all of your custom toolbars, palates and menus) and your .PGP file (this is where all of your custom aliases are stored).

We’ll start by exporting your custom toolbars and palates in the .CUI file.

  1. Start by tying “CUI” into the command line.
  2. Next, Click on the “Transfer” tab at the top of the window. Now what you should see are (2) frames. The left side represents your current AutoCAD configuration concerning Toolbars, Menus, LISP Routines and anything else you have customized that is shown here. (Be aware that custom aliases are not in this location. We’ll cover how to save those in a minute.) The right side represents a blank file in which you are to fill up with your customization items that you wish to save. It should look something like this:
  3. I’ll illustrate how to export your custom toolbars, and you should be able to translate that knowledge into exporting other items.
  4. Expand “Toolbars” in the left hand pane by clicking the + sign.
  5. Find the toolbars that you intend to export. Then, click and drag them to the “Toolbars” heading on the right hand pane. You should now see it where you dropped it.
  6. Once you have moved all of your custom items, click the save icon in the right hand corner of the right hand pane and save it to your safe space. (Make sure IT isn’t clearing your HD or giving you a new machine, because saving it on your HD won’t work if this is the case. Find a flash drive or use a personal network folder, if you have one and save your .CUI file there.)
  7. Now that your .CUI is safe, we’ll focus on some other aspects of migrating.

Lets move on to your profile, which is much easier.

  1. Type “OPTIONS” into the command line.
  2. Click on the tab named “Profiles”.
  3. Next, click the export button on the right hand side and save it to your safe space.
  4. Click “OK” then close the options window.
  5. That’s it for now. We’ll import it when you get the shiny new version.

Lastly is your .pgp file. 

If you have any custom aliases defined, this is where they are stored. (I’ll write a future blurb on this to explain more in depth, but for now you’ll most likely know if you have modifications here that you will need to save.) Aliases are shortened keyboard entries that execute commands. For example; by typing “CO” into the command line, it will execute the Copy command. Now, a lot of users don’t like “CO” as the alias for this command because it’s not executable with one hand. I see a lot of users change it to “CC” instead. As I said, I’ll touch more on the .pgp file later on. Let’s make sure we save it today.

  1. Click “Tools”, “Customize” then “Edit Program Parameters (acad.pgp)” The window that comes up should look like this:
  2. Simply click “File” and “Save As…” and save it to your safe space with your .cui and .agp files.
  3. Close everything, there is no need to save if it asks. (unless you modified anything.)

Now everything should be saved! Unless you are using .lsp files or scripts, everything should be saved. If you are using LISP’s or scripts, simply copy them from the AutoCAD support directory to your safe space. Simple as that.

Contact me with any questions about anything you see here!

 

Anger clouds the mind. – Master Splinter

…. and your AutoCAD drawings.

Enjoy the day.

Advertisements

My Favorite AutoCAD Macros

As promised, here are a few of my macros that I use on a daily basis. Steal these ones, or devise your own for yourself!

  • Horizontal Construction Line:  ^C^C_XLINE;H;

Creates a horizontal extension line at infinite length for construction.

  • Vertical Construction Line: ^C^C_XLINE;V;

Creates a vertical extension line at infinite length for construction.

  • Create Polyline: ^C^C_PE;\;J;

Enters polyline edit command and automatically enters the join option.

  • Lock Viewports: ^C^C_-VPORTS;LOCK;ON;ALL;;

Locks all viewports on the current layout tab.

  • Un-Lock Viewports:  ^C^C_-VPORTS;LOCK;OFF;ALL;;

Un-locks all viewports on the current layout tab.

I use a layer called “Construction” where I make a lot of chicken scratch, notes and model space dimensions. Usually when I’m done I like to freeze this layer; or when I need this layer on and off quickly for visualization, this is the button I use:

  • Freeze Constructions: ^C^C_-LAYER;SET;0;FREEZE;CONSTRUCTION;;

Freezes the construction layer and sets the current layer as “0”.

  • Thaw Constructions: ^C^C_-LAYER;SET;0;THAW;CONSTRUCTION;;

Thaws the construction layer and sets the current layer as “0”.

I continually need to insert blocks from a common network directory throughout my day. The following button lets me simply type the name of the block into the command line and it will insert. If you are to make a button like this, you will need to add the folder directory in which the block comes from to your “Support File Search Path” and “Working Support File Search Path”. To do this, follow these instructions:

  1. Click “File” then “Options” or simply type options into the command line.
  2. Click the “Files” tab and click the small + sign next to the top two items so your window looks like this:

  1. Click on the text of “Support File Search Path” so that it is highlighted and click the ”Add…” button on the right.
  2. Now, you will need to browse to the folder of your intended block directory.
  3. Click on the text of “Working File Search Path” and follow the same process.
  4. Click Apply and Close.

My code reflects a “B” that automatically enters due to the fact that the name of every block in this directory starts with “B”. I don’t want to have to type it every time.

  • Insert Shape: ^C^C_-INSERT;B\;\;1;1;0;

Definitions of symbols:

; – I defined the semi-colon in the last post as being equivalent to hitting enter or the space bar.

– – A dash was also defined in the last post as the indicator that prevents a window from appearing for a command that would normally launch one.

\ – backslash is a new one. This is a “pause for user input” signifier. In my last example, you see two of them used. The first is to let me type in my extrusion number (block name), and the second lets me place it where I need to on screen with a click.

Some of the examples here, as you can probably tell, are pretty specialized. This is how you should be using this method! My examples are to simply show you how the tool works, now you need to think about what your daily time wasters are and create something that can help you through it.

I also wanted to note that when making an image for your button you can browse to an image that you have downloaded or pulled from somewhere else.  I know that I am not an artist and have trouble concocting a suitable image that will convey the intent of the command activated by the button, so this is what I do!

 

Anger clouds the mind. – Master Splinter

…. and your AutoCAD drawings.

Enjoy the day.

You’re Typing Way Too Much… Use Macros! (Creating Custom Toolbars & Buttons)

This one is a twofer. First will be a quick lesson on creating a custom toolbar with buttons along with a shnazy image (so you remember what it does), as well as a “how to” on creating a macro to save steps whilst going through your commands.

I sit next a very loud typist. He’s a designer and uses AutoCAD daily. Some days (most days) it sounds like he is working on his next best selling novel that will hit bookstore shelves in two weeks and he’s struggling to meet his publisher’s deadline. He’s really just using AutoCAD, and killing his keyboard in the process. Save your keyboard! Save your mouse! Save your neighbors, for goodness sake! Exaggeration intended…

Many commands have a lengthy string of additional options inside the initial command which must either be typed into the command line, or clicked through in menus. A lot of times you’re repeating the commands you use throughout the day and many of these commands are multi-entry commands. Case and point – Fillet. Most of us don’t just fillet one item at a time. So, we enter the fillet command, then type the command for MULTIPLE. (It’s a different key in different releases. From here on, I will be using “M” for multiple in this example.) This is really an extra step in your day and a button could be created for this operation. The macro you would assign to your “Fillet Multiple” button would be ^C^C_FILLET;M;. This is a very simple and minor example and I’ll dissect this code later on in the post, but the operation would be one click of a button from now on.

Just to simplify my statement above and give it a definition; A macro is the equivalent of typing commands into the command line, Which, coincidentally, is the best way to preliminarily construct and troubleshoot your custom macros.

First, we’ll create a new toolbar. (Please note that this method will be for releases of AutoCAD 2006 and later using the .cui file.)

  1. Simply type “CUI” into the command line. It should look like this:

  1. In the top left pane (Customizations in All CUI Files), click the plus sign to expand “Toolbars”.
  2. Right Click on the text that says “Toolbars” and then click “New Toolbar”. Congrats. You have just created your very own toolbar.
  3. In the right pane (Properties), you will see all of the data about your new toolbar. Click in the “Name” section under “General” and call it what you will. You can also add a description here if you like, but most of the other properties I don’t typically mess with.

Next we’ll create the custom button.

  1. From the CUI window, Check out the bottom left pane (Command List).
  2. Click the button that looks like a shiny star. (The “star” button on the right.) If you hover over this one, it will say “Create a new command”. This is what we want to do.
  3. “Command1” has now appeared in the “Command List” area and your “Properties” on the right have changed as well. We’re going to start simple and create the Fillet Multiple command.
  4. Click in the name section and type “Fillet Multiple”.
  5. Click in the description section and type “Enters Fillet Command for Multiple Instances” You can make this whatever you want. It’s just to remind you of what the command is if you have a large amount of custom buttons.
  6. Lastly, click in the macro section. After the ^C^C, add: _FILLET;M; So the entire macro should read: ^C^C_FILLET;M;
  7. In the top right pane (Button Image), scroll through the images to find the image for Fillet and click on it.
  8. Next, click the edit button and scribe an “M” in the empty space using the line or pencil tool. This will differentiate your modified fillet from the standard fillet. Click “Save” when you’re done.
  9. Click “Apply” at the bottom of the window. Then click “OK”.

If your new toolbar is not floating in space, right click on any button you like and find your toolbar in the list. Click it and now it will be floating in front of your face and you can drag it and dock it wherever you like. Be sure that each time you add a new toolbar or modify an existing toolbar, afterwards export your template. This will update it with your current interface.

Here is what some of the general functions of the macros are:

“-“ – A dash before any command will eliminate a window opening. You can then navigate using text commands instead of click. This is the way to make macros for certain commands. For example, PURGE or XREF.

“;” – Semicolon is the equivalent of hitting enter or the spacebar.

“^C” – Carrot and “C” is “CANCEL”, or the equivalent of hitting Escape. It’s a good idea to place this at the beginning of all macros just to clear the command line.

Remind me to outline the process of exporting your toolbars in case you’re re-formatting or something similar where AutoCAD gets uninstalled. It’s a little lengthy and not really applicable quite yet.

Have fun with these, experiment and don’t hesitate to leave feedback or ask questions in the comment thread below. I will respond! My next post will be a list of my favorite, time saving macros that I use on a daily basis and one’s I have created in an effort to reduce my department’s redundant tasks.

Anger clouds the mind.

…. and your AutoCAD drawings.

Enjoy the day.