1. Computing

Customizing CAD

The Basics

By

Customizing CAD

Image Courtesy of renjith krishnan| freedigitalphotos.net

Lisp Programming

Lisp (short for List Programming) is a computer language that has been embedded into most major CAD packages for decades. It offers a direct method for end users to customize commands, expand on existing functions, and automate many repetitive processes within the software. Lisp programs are saved as external text files, named with an .LSP extension, which can be automatically loaded into your drawing session or called up using the AppLoad function of the software as needed. Lisp is an older programming language that has little in the way of graphic capabilities, but it excels within the CAD environment because of its ability to process extensive lists of information, calculate variables from them, and pass that data directly into the command line of the software. This essentially imitates the input of an end user, via programming, in order to speed up and simplify drafting processes. Within a Lisp file, you define named "functions" that can be executed from the command line of the program. Each function contains a number of variables, display options, or prompts for user input that will give the program the information it needs to control the built-in functionality of the program. For example, a simple Lisp program to draw a line at set coordinate points would consist of a DEFUN (define function) LINEDRAW (name used to run the program), a getpoints variable to get the needed information on where to draw the line, and then a COMMAND statement that will run the line command and use the data collected in the getpoints variable as the start/end point of the line. Lisp gives the programmer the ability to perform complex mathematical calculations, geometric extrapolation and pass the results of all such data back to the software for drafting purposes. Learning basic Lisp is very easy, particularly since programs like AutoCAD come with built-in tutorials and command references for developing simple programs in the CAD environment.

Scripts

Script files are not actually programs in the traditional sense; rather they are text files that pass commands one line at a time to the software for implementation. While they do not have the robust capabilities of a Lisp file, they have the benefit of being simple enough to use that most drafters can create their own custom scripts in order to simplify repetitive processes. For example, if the drafter needs to insert a block called "title.dwg" into every single drawing, all they need to do is copy down the steps -in exact order- that they use from a single instance and save it out as a script file. The script for the example above might look like this:

-insert (the insert command. The dash keeps the program from loading a dialog box.

"c:\blocks\title.dwg" (the names & location of the file to insert)

0, 0, 0 (the coordinate location at which to insert the file)

1 (the "X" scale factor of the block)

1 (the "Y" scale factor of the block)

0 (the rotation angle of the block)

The script file is saved out as a text file with a .SCR extension and it can then be loaded into any file and run. Script files are powerful, yet simple, tools for automating repetitive drafting processes such as layer creation, text and dimension style loading, title block insertions, etc. They will work with any series of commands and there are a number of free to use applications on the web that will allow you to select multiple files to run your scripts on, so you don't have to load each file manually.

Modifying the CUI

The Command User Interface (CUI) is a series of customizable files that control the display of toolbars, menus, available commands, and even controls loading of vertical interfaces in order to allow CAD Managers the ability to structure the drafting environment to the needs of the company. The CUI allows the manager to create "workspaces" - display interfaces- with different tools and option loaded for differing types of work. For example, a manager in a civil firm might develop different workspaces for the survey and municipal engineering groups. Each group uses different tools and performs different functions, so having a way to customize their user interface allows the manager to remove unnecessary tools from each group, leaving only those needed for a specific type of work, hence increasing productivity. CUI's can be structured on two levels: user customizable CUI's and Enterprise -or company standard- CUI's. The prior is located on a drafter's local machine and it allows them to create their own workspaces. The latter is a locked down company standard set of workspaces that can only be changed by management. This helps ensure consistency throughout the firm and helps to reduce downtime when problems are encountered because each system has the same commands, in the same locations, available so the manager can more quickly isolate problems.

©2014 About.com. All rights reserved.