BB pro

Boundary Builder for AutoCAD 12 to AutoCAD2012

BB pro is an AutoLisp routine that helps designers create clean polyline boundaries from their drawings. The resulting drawing is then suitable for translation to a number of mask making formats - Gerber, GDSII, Electromask and Mann - that depend on receiving clean boundaries in DXF format.


The BB Pro distribution consists of:

bbpro.lsp the bbpro lisp routine
demo1.dwg sample dwg in R12 format (can be read by R13)
demo2.dwg sample dwg R12 format (can be read by R13)
demo3.dwg sample dwg in R12 format (can be read by R13)

Installing BB Pro

Bbpro.lsp should be copied to the directory where AutoCAD normally stores Lisp files. This directory may vary depending on how you installed AutoCAD, but a typical installation is shown below.

|        |          |         |       |        |
ads    fonts    igesfonts  samples  source  support

AutoCAD 13 often has a more complex directory tree. Here is a typical one -

              |                                   |
             com                               windows
              |                                   |
       ------------------         --------------------------------------
       |      |        |          |    |      |      |        |        |                           
     fonts  sample  support      ase  drv   edoc   sample  support  tutorial

Automatic startup

You may wish to configure AutoCAD so that it loads BB pro each time that AutoCAD starts up. To do so, you should add a line to the lisp startup file used by AutoCAD. For AutoCAD release 12, the file is called acadr12.lsp. For AutoCAD release 13, the file is called acadr13.lsp. The entry is the same in both cases.
;;;===== Autoload LISP Applications =====

(autoload "appload" '("appload"))
(autoload "filter" '("filter"))
(autoload "bbpro" '("bbpro"))

Loading BB Pro Manually

If you do not configure BB Pro to load automatically then you will have to load it manually before using it. This is normally done from the AutoCAD command line:

Command:  (load "bbpro")

How BB Pro Works

BB Pro helps you build closed zero width polyline boundaries from lines, arcs and open zero width polylines. It works on the current layer. Data on other layers is ignored. It can only work on entity data - not data that is part of a block.

It cleans up lines/arcs whose endpoints don’t quite touch or overlap.

It removes any zero length segments, arcs or polyine sections that might cause a postprocessor problem.

It removes any stand alone lines/arcs that don’t form part of a boundary.

It uses the concept of a search radius to determine whether or not two endpoints should be linked.

If BB Pro reaches an ambiguous situation, such as a point where more than two lines meet, it stops, zooms in, and asks the user to interactively choose the correct path to follow.

BB Pro Preliminaries

Freezes all layers except for the current layer

Create two new layers

bb_open - open entities moved to this layer
bb_closed - closed entities moved to this area

Moves the following entities to the closed layer:

  • circles
  • solids
  • polylines with non-zero width
  • zero width closed polylines (optional - you may wish BB Pro to explode and rebuild these to remove zero length segments)
  • text

User Input

BB Pro prompts the user for several pieces of information prior to starting the linking routines.

Command: bbpro [enter]
BB Pro version 2.03 (C) Artwork Conversion Software (831) 426-6163
Enter Units  of Drawing (IN/MIL/UM/MM/CM/Other) :
Prompts the user to select a units value. The units information is used only to calculate a search radius around each line or arc endpoint. Units and their search radii are shown below:

Unit Search Radius
inch 0.0005
mils 0.5
mm 0.00125
cm 0.000125
um 0.1
other user specified

Use other and specify a different search radius as needed.

Select the color for the Boundary layer 
You should select a color that is not the same as the current layer’s color.

Select the color for the Open layer 
You should select a color that is not the same as the current layer’s color. This is quite important since BB Pro may zoom in and ask you to select the line to continue building the path - unless the current layer’s color, and the open layer color are different, you may not be able to tell which line to select.

Do you want to process 0 width closed polylines (Y/N) :


BB pro will explode all zero width closed polylines into lines and arcs. It will then rebuild the polyline. It does this so that it can find and remove any zero length segments as well as any co-linear segments. While co-linear segments are not necessarily bad, we have found some data translators that do not correctly process boundaries containing co-linear segments.


BB pro will immediately move all zero width closed polylines to the boundary layer (bb_closed) without processing them in any way. This is fast but does not check for any problems in such polylines.

Selecting the Area to Process

BB Pro will prompt you to select the entities to work on. This is done using a window. Use your mouse or tablet to define the area you wish to process.

Building the Closed Polyline

BB Pro graps the first line or arc in the selected area and using the search radius trys to find a line or arc whose endpoint is within this search radius. There are three possible outcomes:

    1. Nothing is found
    2. A single endpoint is found
    3. More than one endpoint is found

Case 1: Nothing is found

If nothing is found, BB Pro will increase the size of the search radius and try again. If nothing is found after the second try BB Pro will send the unlinked lines to the open layer.

If an endpoint is found within the larger search radius BB Pro will offer you the following options:

Leave Open - the pline under construction is sent to the open layer.

Fillet - you select an entity to fillet to the polyline under construction.

Close - closes the polyline under construction back to the starting vertex.

Case 2: A single endpoint is found

BB Pro will use the fillet command to clean the intersection and attach the line to the pline under construction. If an arc is involved BB Pro uses a different approach since arcs do not fillet well.

Case 3: More than one endpoint is found

BB Pro will zoom in to the area under consideration and prompt you to select a line to follow. Leftover lines will eventually be sent to the open layer.

“Multiple Entities Found: Please select Entity to Continue:”

In order to help you select the correct path the last segment joined to the polyline under construction is highlighted. It takes on the color of the Open layer. The entities to be joined have the color of the current layer.

Many times it will appear that there is only a single choice - why does BB Pro zoom in and ask you to selelct a line? Normally this is because there is a second line directly beneath the visible line. By clicking on the visible line, BB Pro will continue and discard the underlying line.

Example Files

We’ve provided 3 example files that show the operation of BB Pro.


units= inches

A microwave mixer circuit. This was originally drawn using a CAD program that could not output lines and arcs. BB Pro links it into closed polylines in a couple of seconds. Doing by hand takes 20 minutes.


units=other  search radius=0.0002
(although you can select inches, using a radius of 0.0002 on this example runs faster)

This is a chemically milled part (for a heart pacemaker.) It has two extremely complex boundaries that have lines under lines, and some lines that don’t touch. The service bureau that tried to clean up this drawing by hand, spent over 8 hours working on it without finding all the errors. BB Pro will fix it in about 1 minute.



This is a microwave circuit. In several areas there were drawing errors - lines not touching, lines under lines and co-linear lines. BB Pro removes these in about one minute with only minimal user input.

BB Pro Home

417 Ingalls St., Santa Cruz, CA 95060    Tel (831) 426-6163     Fax 426-2824    email: