Examples of Commonly Used Formulas (AutoCAD Mechanical Toolset)

This page contains examples of two complex formulas. The purpose of providing these examples is to demonstrate how complex formulas can be perceived as a combination of several simple expressions and thereby interpret them with greater ease. The results of the formulas are shown as screen captures at the end of each section.

Example 1 =<if(equal(Hole:tapped,"0"),"%%c" Hole:dia,Hole:nominal)>

Typical usage

Typically used in a note (AMNOTE command) to annotate a standard hole. This expression is part of the default formula used in Template 1 for the Hole Drilled category for the AMNOTE command.

Description

Expression Explanation

If( )

Evaluates a logical value; in this case evaluates the result of the function equal(Hole:tapped,”0”). In case the function evaluates to TRUE, returns the expression marked 0, otherwise returns the expression marked 1.

equal(Hole:tapped, “0”)

Compares the reference hole:tapped with the value 0. For a tapped hole, hole:tapped evaluates to 1, if not, it evaluates to 0.

“%%c”

The diameter symbol.

Hole:dia

Evaluates to the diameter of the hole.

Hole:nominal

Evaluates to the nominal diameter of the hole.

Results

The following image shows two holes annotated by a leader note containing the formula. Observe the difference in the note texts for the through hole and the tapped hole.

Example 2 =<Origin><IF(OR(ISBLANK(Origin),ISBLANK(Index)),"",".")><Index>

Typical usage

Typically used in a hole chart. This expression is the default formula for a hole label in the DIN standard.

Description

This formula contains three expressions, each one delimited by angle brackets. The resulting text is a concatenation of all three expressions.

Expression Explanation

<Origin>

Evaluates to the name of the origin of the hole chart.

If( )

Evaluates a logical value; in this case evaluates the result of the function OR(...). In case the function evaluates to FALSE, returns the text marked 1, otherwise returns the text marked 2.

OR( )

Returns TRUE if any of the arguments evaluates to TRUE.

ISBLANK( )

Returns TRUE if the references Origin and Index evaluate to a blank text. If the hole chart origin is unnamed, ISBLANK(Origin) returns TRUE.

Origin

Evaluates to the name of the hole chart.

Index

Evaluates to the index number of the hole

Results

The following image shows two holes. The hole on the left is in a hole chart that has its origin labeled 1. The hole label is 1.1. The hole on the right is in a hole chart that does not have its origin labeled. The hole label is 1.