[Utilitek Logo]

User to User

Welcome to User to User

Utilitek Systems has developed this quarterly newsletter for you, a fellow Mentor Graphics user. Most of the articles are technical -- good solid information you can use to design your products faster, increasing quality and lowering costs.

If you want to learn more about how our Mentor PCB design or Mentor consulting services can help lower your costs and increase your productivity, give us a call at (607) 786-9064. If you have any comments or feedback about User to User, call us or email them to utilitek@utilitek.com.

Tips & Tricks

Each Tips and Tricks column will feature several useful shortcuts or lesser known features that we use to cut cycle time off our PCB design services. We hope Tips and Tricks helps you get your designs done faster, too.

View pin numbers in Layout or FabLink

Have you ever been in Layout or FabLink and needed to see the pin numbers of a component? Layout can display them for you on each pin. Make the pin_id layer for the side you wish to see visible and type:

$$display_pin_mode(@pin_id)

This function also has two other switches: @point, which is the default and displays a small square in the center of the pin; and @none, which turns off any display on the pin_id layers. You can add this command to your custom company menu to make it easier to use.

Loading AMPLE code into a scope that is not the current scope

Often when debugging AMPLE code, you have to reload the source file after a change has been made to the code. However, AMPLE functions are written for a specific scope. If you’re not in the same scope that the code is written for, you can still load the code without going through the hassle of changing your scope. To force a file to load into a different scope, just give the desired scope name as the second argument in the $load_userware command:

$load_userware("file path","scope to load into")

substituting your path for file_path and your desired scope for scope_to_load_into.

For example, if you have code in the file /user/ball/circattr that is written for the librarian scope lib_session,

$load_userware("/user/ball/circattr", "lib_session");

will always load it correctly.

Checking when Mentor’s automatic checking won’t

[Is there a clearance error?] Is there a clearance error?

Have you ever had to build a SMT footprint with a breakout pattern in copper? BoardStation doesn’t do any clearance checking within a geometry, so how do you make sure that you don’t have an error? At Utilitek, we use a little trick to do a quick visual check:

Increase the width of the breakout paths by 2 times the pad-to-trace clearance of the board. If you have any overlap between the edge of a path and the edge of any other copper feature (except another path) you have a clearance error. To check errors to other breakout paths increase the width by 1 times the trace-to-trace clearance of the board and perform a similar visual check.

For example, if your breakout path is 10 mils and the trace-to-trace and trace-to-pad clearances are 8 mils, first change all breakout path widths to 26 mils. If there is any overlap between a breakout path and any other copper (except another breakout path), you have a clearance error. To check clearance to other breakout paths, change all of the breakout path widths to 18 mils. You may have to do some additional "oversizing" if you use different trace-to-via clearances, but the concept is the same. You can use this same "oversizing" concept for many other checking purposes too.

[A clearance error is obvious after oversizing] A clearance error is obvious after oversizing.

Marking and measuring in any BoardStation tool

Unlike the Apollo, the SUN and HP do not have mark keys. A quick and easy way to mark a point in Librarian, Layout or FabLink is to use F8. Although normally used to view an area, if F8 is depressed and released in the same spot (without marking a region), a mark point is set without changing the view. (You will, however, get a warning that you can ignore.) The delta x and y readout in the upper left of the screen can then be used to measure. Of course, if you are using an Apollo, the mark key works also.

Moving the board origin in Layout or FabLink

Mentor provides a way to reposition your board origin and/or rotate the board after parts have been placed and routing has been laid down. And you don’t have to get into Librarian to do it! Pick the
SETUP->BOARD POSITION menu

selection in Layout or FabLink. You will now be dragging the board around on your cursor. Note that you are moving the board, not the origin. The origin remains fixed at its original location. Click the left mouse button when you have moved the board so that the location where you want the origin to be is over the origin mark (an X). Mentor’s implementation is a little confusing; just keep in mind that you are moving the board, not the origin.

The AMPLE Utility:

Using a prompt bar to add circular keepouts

Each issue of User to User features an AMPLE utility. The article will explain some of the key portions of the code. The utility is available on-line on our Internet server. You can get your own copy by sending a request via email to utilitek@utilitek.com. Please include your name, company, mailing address, phone number and email address. The utility will be emailed back to you.

Why use circular keepouts?

Standard BoardStation ampleware only allows you to add rectangular routing, via, trace or placement keepouts. Yet there are times when a circular keepout would be really handy. An unplated drill is round, so why put a square keepout around it? How many times have you wanted to squeak that last run around the drill hole only to be blocked by a square keepout? This AMPLE code provides an easy-to-use prompt bar interface that allows you to add a "circular" keepout simulated by a series of segments. It also provides a good opportunity to discuss custom prompt bar interfaces.

What is a Prompt Bar?

[Prompt bar]

Title Dynamic choice stepper gadget   entry box gadget  

Figure 1: The prompt bar interface for the utility

If a function is called, but these required arguments do not yet have values, the system needs to get the rest of the values. The system looks through a hierarchy of possible ways to get the values, and as a last resort, automatically creates a default prompt bar to get the input.

A prompt bar interface is a bar with several areas, called argument fields, that accept user input. A gadget is used to accept the input (see figure 1). A prompt bar is associated with only one AMPLE function, known as the connected function. The user input gathered from the prompt bar is passed to the connected function.

With the exception of the title of the prompt bar, each argument field has a gadget that accepts the input. Each gadget is associated with one particular argument in the connected function. The type of gadget used in the prompt bar is automatically chosen by the system based on the type of its associated argument. The table titled Prompt Bar Gadgets Data Types in the Customizing the Common User Interface manual lists how the choices are made.

Typical gadgets are edit boxes, which will accept a value the user inputs, and choice steppers, which present a set of predetermined choices from which the user can select. When the user sets a value in a prompt bar gadget, the value is passed to its associated argument in the connected function.

The $create_prompt function can be used to override some of the defaults that the system sets when creating a prompt bar. Fonts, text color, titles, and option boxes are just some of the items you can override in a prompt bar by using $create_prompt.

How the prompt bar works in the utility

The code to create circular attributes consists of several smaller functions. The top level function declaration and the $create_prompt for it appear in figures 2 and 3.

function ut_add_circle_attribute(  

center : pcb_location

//center of circular attribute

,attribute_name: name [routing_keepout,place_keep_both,place_keep_top,place_keep_bott,via_keepout,trace_keepout] {default = @routing_keepout}

 

,segments: name [s8, s16, s32, s64] {default = @s32}

//number of line segments to use to simulate circle

,radius : number {default = .1}

//radius of circle

,layer:name[all,pad_1,pad_2,signal_2,signal_3,signal_4,signal_5,signal_6,signal_7,signal_8] {default = @all}

//layer(s) to put circular attribute on

),sealed

 

Figure 2: Declaration for the main function - "the connected function"

Wrapper Function

$create_prompt is connected to the ut_add_circle_attribute function by the value of its second argument. The $create_prompt is wrapped in a user defined function, ut_add_circle_attribute_prompt. The name of this wrapper function is identical to the connected function name except that _prompt is added to the end. This naming convention tells AMPLE that the $create_prompt function is to be loaded only when it is needed, and this is known as demand loading. Demand loaded functions do not use any memory unless they are actually called, leaving valuable memory free for other uses.

$prompt_arg

Each argument to $create_prompt creates or changes the default presentation of an area in the prompt bar. Most of the arguments to the $create_prompt function are $prompt_arg functions with arguments of their own.

For example:

,$prompt_arg(@segments, "seg") //# segments gadget title

creates the fourth argument field in the prompt bar; the one showing "s32" in the figure 1. This gadget is associated with the segments argument in the connected function by the @segments parameter. The "seg" specifies the comment text displayed to the left of the gadget in the prompt bar. Additional optional arguments in the $prompt_arg allow you to control the fonts and frame color of the gadget.

Gadget Selection

The type of gadget is selected by the system based on the associated argument type in the connected function. For example, the connected function has the associated argument:

,segments: name [s8, s16, s32, s64] {default = @s32}

Since segments has a constraint list that forces the value to be a value from the constraint list, a choice stepper gadget is automatically chosen. The default choice presented in the gadget is s32, the default value for segments. By using a constraint list in the arguments to a connected function, you can guarantee that the user inputs a correct value: the interface is correct by construction.

function ut_add_circle_attribute_prompt(), invisible //wrapper function forces demand load
{  
$create_prompt("lib_session" //scope
,@ut_add_circle_attribute //connected function
,"Add Circle" //title of prompt bar
,$prompt_dynamic(@center, "$prompt_for_pcb_location()") //get xy location of center dynamically
,$prompt_arg(@center, "loc") //xy location field gadget title
,$prompt_arg(@attribute_name, "name") //attribute gadget title
,$prompt_arg(@segments, "seg") //# segments gadget title
,$prompt_arg(@radius, "rad") //radius gadget title
,$prompt_arg(@layer, "lay") //layer gadget title
);  
}  

Figure 3: The function that creates the prompt

Dynamic Prompt

Except for the $prompt_dynamic function, all of the other arguments in the $create_prompt function operate similarly to the one just described for segments.

,$prompt_dynamic(@center, "$prompt_for_pcb_location()")
,$prompt_arg(@center, "loc")

The $prompt_dynamic function allows the user to point to the spot where the circle is to be added, using the mouse. The function creates a gadget that accepts input dynamically, in this case from the $prompt_for_pcb_location() function. The $prompt_for_pcb_location turns the cursor into a crosshair and returns the x and y location of the user’s mouse click. The location values are passed to the center argument of the connected function. This example is a typical use of the $prompt_dynamic function in concert with one of several different prompt for location functions to get a location using the mouse.

How to download this utility

Once you understand how to create the custom prompt bar, the rest of the code to actually implement circular attributes is pretty straightforward. So, if you want to use circular keepouts, or want an example of a custom prompt bar, you can download this AMPLE userware. Use the utility as is, or customize it to meet your needs.

Do you have a need for a simple utility like the one just presented, or a more complicated AMPLE application? Utilitek Systems offers custom development services to make your company a more productive Mentor user. Let us help you decrease your design cycle time and cost -- call us at (607) 786-9064 or email us at utilitek@utilitek.com.

[Dividing Line Image]
Send mail to webmaster@utilitek.com with questions or comments about this web site.
Copyright 1999 Utilitek Systems, Inc.
Last modified: February 06, 1997