Archive for Customization

Over the years Email has become the most prevalent method of exchanging files. As our DWG files get smarter and our users get lazier, the files continue to grow in size. A big market now is for file sharing applications that can allow users or entire companies to exchange files through a link instead of an attachment in an email. I do like this method for various reasons:

Email databases (Outlook PST files and Exchange message stores) are getting bigger and bigger as users send and receive large attachments every day. This has a domino affect in that it causes slow downs on servers, eats up network bandwidth, burns through backup media and extends backup and restore times. You can always enable compression on the servers, or buy more storage and get faster processes and more memory, but to what end?

The nice thing about file sharing applications like YouSendit or Sharefile or even Dropbox is that for Email, it is just a text message with a link included – very small and very fast. The files are automatically uploaded to an offsite location and therefore are only on your network once so you do not have them backed up twice – unless your doing Dropbox which may also store an additional local copy that you may be backing up as well. There are a lot of variables in this which depend on the particular service you are using and which features, but the basic file sharing service uploads a copy offsite and then allows you to share it with a link.

File sharing programs add other perks as well – they offer Email notices when files are accessed or shared and can offer password authentication for security.

I have personally used both Sharefile and YouSendit and use Dropbox regularly for personal use and backups to make my critical data mobile. I like all three and for most businesses it would not be hard to justify their costs – they can even be free for small usage.

These services add some efficiency to your daily workflow and on your network storage, email stores and backups, but is there a way to reduce some of the space requirements even more? Yes, and this is what this post is really about. For AutoCAD users, sharing data is a common occurrence. Architects share background files and other support drawings with their consultants and consultants in turn share their drawings back with the architects and other consultants. Most of thee file shares still happen through email and it is not uncommon to have project shared through a series of multiple emails because the files exceed either the sender’s or recipient’s email limits – especially those using “Free” email services for their email (That’s a whole other post entirely).

There are a few steps that the person sending or sharing the drawings can do to minimize the drawing size and should be standard practice.

Minimize copying other jobs in other current job to do your work. Use standard libraries and menu customization to insert your work or copy pieces as needed. I regularly deal with drawings with more than one project inserted in model space and in some cases I have seen up to five! Besides the file size, now everyone has to dig though the drawing to see which are the plans/elevations/sections that they need or call the architect/consultant for clarification.

Use Blocks – rectangles are not desks or lights, they are rectangles and a job that could be handled with a couple of blocks that uses 100 rectangles for lights is not a very smart or lean drawing. (another future post)

Purge! Yes, the big one. Since so many users still do use past projects for setting up new ones and copy items in from previous projects to address details in current ones, occasionally (regularly) purge your drawing – and definitely do so when sending them out.

How to Purge?

Purge can be done via the command line “-PURGE” or via a dialogue “PURGE”and it can be automated via a Macro or script.

Add this Macro to a toolbar button to make cleanup a single click:

^C^Cz;e;-purge;a;;n;audit;y;-purge;a;;n;qsave;close;

Note: This routine also does an AUDIT to check the drawing for errors. This routine was discussed in the “Macro Mania I” post and is included in the FS-Tools add-on menu that you can download here.

What can purge do for you?

On a recent project, there was an issue with the size of the drawings being shared so the sender made one attempt and received some failure notices by some of the recipients. They then started over and made them available on their FTP site. When I received the files, I typically clean them up for our use, and in this case I was curious to see just how bloated they were.

I have a simple toolbar Macro that I use nearly every day for this that purges the drawing and runs an audit to make sure their are no errors, does a zoom extents and saves and closes the drawing. Running this Macro which is a single mouse click on the drawings knocked them down from 35meg to 18meg – nearly a 50% reduction – and that was without removing extra “stuff” from the drawings. I did this same step yesterday and reduced the files provided on an FTP site by 60%. This is a regular step in my cleanup and sharing process and takes seriously a couple seconds per drawing to perform. Doing this with a script using Scriptpro, you could do an entire project in a flash.

I see these results on a regular basis, and sometimes the results are far greater.

I am curious if others deal with this issue as well – answer these four quick questions on purging and file sharing.

As I said in the previous post Macros can be used for a variety of tasks from auto answering prompts in commands and automating drawing processes to performing CAD management tasks. In this post we will cover some of each. Note that you will see “CTS” used throughout these macros which follows the previous initials setup in our first post on Macros. These initials can be set to something that fits your organization’s naming convention.

Drawing processes:

A nuisance that I see on a regular basis when working with consultants and clients drawings is finding symbols and linework on the wrong layers. It’s very hard to automate a cleanup process if the person who created the original drawings doesn’t put their items on consistent layers. Worse yet are the those that put stuff on the wrong layers then just change the color to the color that it was supposed to be. Although this type of user needs a serious talking to, most of the time when stuff gets on the wrong layer it’s accidental. This accidental step is often caused because clients use a limited number of colors, and when an item is inserted on a layer that happens to be the same color that the symbol is supposed to end up, they assume that they are on the right layer. Some basic macros on their end would easilly fix this issue. Of course these are also ways to increase your efficiency as well.

Defining layers and line-work :

Macro to create a 4-segment conduit run on a specific layer:

^C^CORTHO;OFF;_PLINE;\\’ORTHO;ON;\\’ORTHO;OFF;\;FILLET;P;LAST;

Inserting blocks:

Macro to set the appropriate layer, and insert a 2×4 light fixture (which is a dynamic block). Since it is real scale, the scaling prompts are defaulted and it only asks for rotation.

Macro to set the appropriate layer, and insert a fire alarm device (which is a dynamic block). Since it is not real scale, the scale is determined by the current dimscale and it only asks for rotation. Note: If your Dynamic block has the “Alignment” parameter, rotation can also be removed. (I have found this option a bit quirky for many users and have stopped using it for now).

Yet another annoying trend is the use of AutoCAD’s “Standard” styles for use as company standards. The “Standard” styles, just like Layer “0” are in all drawings, and cannot be renamed. The built-in standards should be used as a template to create your own standards. Note although you cannot rename the “Standard” style in the style dialogue, you can with the rename command, which is used in this Macro.

Scenario:

Architect adapts the “Standard” style as their default text style and just changes the font to “Hand1.shx” and sets the width to .8. Our default Standard style uses the “txt.shx” font with a width of “1”. When we block in room names from an Architect’s drawing (so that we can move them around), they change to the standard ugly TXT font. We don;’t use “Standard” styles, we leave them as is. You might think that changing them to the architects font would be a quick fix, and it would if we only worked with one architect that does this common mistake.

The Standard Style Fix: (Do this in their drawing prior to import)

^C^C-RENAME;S;STANDARD;ARCH-STD;

Some other useful Macros to save Keyboard and mouse clicks.

Drawing Setup:

Import all company standard layers via a master drawing and set all settings for a specific scale (this one is 1/4″ scale) and assumes you are not using annotative scales for everything (this all one line – copy and modify for other scales):

Note: the above also sets some commonly changed variables as well as being useful when working on an existing drawing setup by someone not following your standards. (Say it isn’t so!!)

CADD Management:

On the CADD management side another use for a macro is updating your template files and your standard layer states. Many people use template files to start their projects because it allows them to get their standards in place as soon as they start a new drawing. This is good but sometimes you need your standards brought in after your drawing is already in the works or because of purging you need to get your layers back to where they were. Regardless of the reasons, you need to keep various master files up to date, especially early in your standards setup.

To keep these Master files into their Proper locations takes a series of steps. The following macro uses your master drawing to update your master template, master CADD standards file and export out your master layer states. Speaking of layer states, this is another very efficient tool that can be used to automate and control your drawing files. We will talk about this in a future post on efficiency.

If your company has a set of standards that you want implemented in your drawings, macros make typical processes a lot faster and maintain consistency and accuracy. Time is money so faster is more efficient. Keep in mind that efficiency is not just about speed – accuracy is an essential factor. With good accuracy you have less to revise or fix.

Background Cleanup:

If you get a lot of background updates on a project from an architect and he/she uses a consistent Layering scheme macros are a great way to clean up the drawing to meet your needs. It is not uncommon for myself and I’m sure some of you to take 10 to 30 minutes on a background cleanup process. You can whittle that process down to a couple minutes or even seconds with a macro. For instance, the following macro reduced a thirty minute typical cleanup time for a co-worker on a repeat client’s work from 30 minutes to less than a minute – including visual checking. And since it seems like were getting background updates every other day – some last minute, this has become a huge time saver.

The following routine sets our preferred units, sets all changeable items to color by layer, erases what we do not need, purges and prompts for a SAVEAS. NOTE: “WX-D” is the name of the Layer state that we are restoring. This routine took about 30 minutes to write, tweak and test. (This routine can vary greatly by the type of background you are cleaning up).

When writing macros be sure to draft them out on paper before you jump into the CUI editor. No matter how fast your machine as it takes time for the CUI editor to launch modify save and get you back to your editing session. The more corrections you have to make the MoreTime your CUI editor takes away on your productivity. Use the F2 key to watch your commands in the text window to verify what your prompts are and what your answers need to be.

Call External Scripts:

Another trick you can use to save time and also make your updates instantly available to others without requiring them to reload their menu, is to create a short macro that calls an external script. You can quickly edit the script on the fly and changes are available as quickly as you select “Save”.

The following macro string calls an external script file called “setvars”.

^C^Cscript;f:/custom/scripts/setvars.scr;

If you’ve written some really cool macros that you would like to share or need help with a macro you’re stumbling with, email me.

In upcoming posts, we are going to get a firmer Grip on efficiency by performing common actions in AutoCAD without actually typing any commands and we’ll look at dynamic blocks as a way to reduce our workload.

Moving ahead in our year of efficiency, we need to find ways to do more in less time while not reducing the quality of the end product. With AutoCAD being a major tool in our daily workflow, it is a prime target for optimization. In a recent article I wrote (not yet published) I used the following definition for efficiency when working with AutoCAD:

Having and using requisite knowledge, skill, and industry experience to competently perform or function within AutoCAD to create drawings in the best possible manner with the least waste of time and effort.

With this concept in mind, the first post in our two-part series is going to be about creating and using macros in AutoCAD and how they can speed up your work Tenfold. Macros can be very powerful and can be used to perform a variety of tasks, including automating command prompts, controlling CADD standards and even automating CADD management steps. I will cover some examples of each in this series.

No matter what field you’re in, after a while you find yourself doing the same steps over and over again. Some are on a weekly basis, some daily and some even hourly or shorter. Anytime we repeat a step, task, process, or command there are certain questions or prompts that need to be answered like; Yes, No or Return. We are also prompted to pick points, set layers, set styles and choose rotations. These are things that are repeated so much we answer them without much thought, all while caring on a conversation with our cube mate and planning the next two commands and the answers to their associated prompts. Although we can practically enter these choices in our sleep, my question is why are we?

Well I for one am not going to do it anymore and neither are you. Something has to automate this process so we can use our brain for thinking about more important things. “Macros” to the rescue. I do not recall when macros came in to play in AutoCAD, but I know I have been customizing and using them since AutoCAD version 9. No matter your experience level, macros are one of the easiest customization tools you can do to increase your productivity and you are only limited by your creativity. In the current company I work with, 95% of our work is accomplished through Toolbar Macros, including customized replacements of standard AutoCAD commands.

For this exercise we are going to need a toolbar to place our custom macros on, so we need to take a quick look at the CUI editor (I miss the old MNU text editor days). I am currently working in 2013, but some variation of the CUI editor has been around since version 2006. If you’re a visual person, I created a PDF of version of this article with screen shots here.

For a more in-depth look at the CUI editor, check out Melinda Heavrin’s article from AUGI World on AUGI.com labeled:

To keep our customized work separate from the main menu (highly recommended) and make it available to everyone in the company, you are going to want to have this in your central customization file on the company server. Don’t have one yet – let’s get one started (If you already have one, skip past this section):

Central Customization Menu File Creation:

At The command prompt type: “CUI” (no quotes) and when the editor comes up (see below), select the transfer tab. In the transfer tab on the right, you will see the words “New File” and a Save option to the right of that.

Select Save and browse to a shared folder on your server that everyone has access to. This should be in your central CADD standards drive (preferred) or CADD standards folder. If you do not have one, we have some more work to do, but we will have to address that another day. Email me if you need some help on that.

Assuming you or someone else set this up already, under your “Menus” directory save the file with a logical name (other than custom). Precede it with the same thing you preceded your other standards with… I mean if you have them… If you don’t have this type of setup, let’s use your initials to get the ball rolling, we can rename it later once your actual standards are in place. Let’s assume your initials are “CTS” for Carol or Conrad Smith. Save the file as CTS-Custom. Yes I used “custom”, but the trick is to use a prefix that makes it unique. You can call it CTS-Master, or CTS-Standard or whatever you like, but make sure it has the prefix. You will understand as we talk more about this concept in future posts or you can email me if you need to know now.

Now that you have a new customization file, let’s add a toolbar. Right click on the word “Toolbar” in the right hand pane and select “New Toolbar”. Name it “Efficiency” (no Quotes). Now select “OK” at the bottom of the screen and you will be back in AutoCAD. Now type “MENULOAD” (no quotes). Select Browse and browse to the folder where you saved the CTS-Custom menu, which will be called CTS-Custom.cuix. Highlight the file and select “Load” and then “Close”. When you are back at the AutoCAD screen, you will see an empty floating toolbar, and if you roll over it with your mouse it will be called “Efficiency”.

Now on to get the Toolbar populated

Get back in to the CUI editor by typing “CUI” (from here on out, remember “no quotes” unless I tell you). While on the “Customize” tab, on the same line as the “Customizations in All Files” line, pick on the down arrows to show all your customization menus.

Scroll down to “Partial Customization Files” and keeping selecting the “+” signs to get out to your “Efficiency” Toolbar. Now switch down to the bottom pane and select the “Create a new command” symbol.

We are going to address all the important items here.

Command1This is what your new command OR Macro will be called, and you will replace this with what you want the actual name to be. This will auto-populate the “Name” field to the right.

Source – “ACAD”This is the current Menu that the command is registered to. Once you add it to your Efficiency Toolbar, this will show up as “CTS-Custom”. (We will do that shortly).

Name(see Command1)

DescriptionThis is where you will place a description if necessary – Although I rarely do, it is always good practice to describe what your macro does for future folks that may inherit your menu system.

MacroThis is where the action happens and your efficiency increases! To see more specifics about the command options in Macros see “Writing Macros” below.

Element IDAn ID name that you give your macro. I always use ID_name, with “name” being what the tool is.

Small/Large ImageThis is the graphic image that shows up on your toolbar that users see and select to run your macro. Typically these are set to the same. If you have a lot of people who use the LARGE icon option, you may wish to create one for each. Starting out, especially if you are not a creative wiz, I would use an existing button image with a splash of color. I.E. use the save button image for a special file save macro, but color the inside red – then ‘saveas’ a new icon.

Writing MacrosAt its most basic level, macros are simply automating the prompts that a command throws out to you. Although this is a powerful feature in itself, by stringing multiple commands together, loading and running lisps combined with commands you can do amazing things that will drastically cut back on your keyboard and mouse time. Below are some basics that you will need to know and common issues that you run into when writing macros. Note that this list is not the entire list of macro options, but represents the most commonly needed or utilized.

Basic Macro Options:

^C^CCancel and is the default and most common way to start a macro.

;Equal to a keyboard Return. Note: Spaces can also be used but are easily lost in a macro string. I personally do not recommend their use.

\Pause for mouse or keyboard input

/Use when specifying paths outside of AutoCAD. Note that this is the opposite of what you would see at a command prompt or path description. Example: a command prompt to a network share drive and folder would look like this: “F:\MSTRSYMBOLS\BLOCK.DWG” In a script it looks like this: “F:/MSTRSYMBOLS/BLOCK.DWG”

“Quotes – Encapsulates a group. This comes in handy when specifying paths that have spaces in them. For instance the path above has not spaces, but if there was a space between MSTR and SYMBOLS, the macro would assume that was a return. Putting quotes before and after will cause the whole group to be read as one parameter.

–Hyphen – this is used to run commands without Dialogue boxes popping up.

^OTurns ORTHO ON or OFF

.Period – This allows you to use built-in commands even if they have been undefined. Useful for CADD managers that have undefined commands.

Now let’s do a quick macro to get your feet wet. We will call this “Super Save”. The purpose of “Super Save” is to zoom extents to get a full view image for previewing (which gets updated on saves), purge our file, audit it, purge it again, save and close it. If you type each of the commands out at your command line, you will see what each letter is answering – remember that the “ ; “ symbol is a return. Time yourself by typing this command out manually and then pick the button and see how much faster it is. And this is just the beginning.

As you may have noticed, this routine is for the still common model space users in the group, it would be simple enough to add a switch to PaperSpace before running the “Zoom” and “Save” options – I’ll leave that for you as homework! (Email me if you need help).

For the Button image, I selected an existing image icon from the Button Image dialogue above and selected Edit (Notice the existing name is RCDATA_16_SAVE) and I chose ‘Both’ for my image option. On the right, color in the center area red, select “Save” and give it a new name, then select “close”.

Select Apply to save your work.

To get the Macro button added to your toolbar, drag it from the left lower window pane to the top left window pane until you see a small arrow next to your toolbar, then, drop it. You should see something similar to the right side graphic now.

Yea!! You are on your way now!

In the next post we can skip the toolbar work and concentrate on some more practical macros.