Appendix A: Operators and Units

This appendix describes mathematical and conditional operators.

Mathematical Operators

Entry boxes that accept numbers also accept mathematical, trigonometric and exponential operators in the form:

funcName (arg1; arg2; . . . ; argN)

Operator

Example

Operator

Example

Addition

3+.450

Arctangent

atan(1;1)

Subtraction

3-.500

Log (Base 10)

log(7.25)

Multiplication

3*.725

Natural Log (Base e)

ln(8.5)

Division

3/5.25

Remove Fractional Part

truncate(6.125)

Square Root

sqrt(8.75)

Absolute Value

abs(-47+16)

Parenthetical

3/(5*2/4)

Smallest Larger Integer

ceiling(5.25)

Scientific Notation

4e-3

Largest Smaller Integer

floor(12.75)

Exponentiation

exp(2;7)

Negative Value

neg(11.12)

Sine of Angle

sin(15)

Round

round(11.12)

Cosine of Angle

cos(30)

Random # in range 0 to 231

rand()

Math operators are case-sensitive so be sure to type them in lower case when using them. Use these operators to edit objects, make entries in the Status Line and specify values in dialog boxes.

Conditional Expressions

Conditional expressions are particularly useful with parametrics when an expression depends on a condition. For example, a flange might depend on the diameter of a pipe but should never be smaller than some minimum size. Use two function forms of conditional expressions, ifelse and RNG (range).

ifelse (condition; expression1; expression2)

Condition

The result of a boolean expression:

==

equals

!=

not equals

>

greater than

>=

greater than or equals

<

less than

<=

less than or equals

&&

logical and

||

logical or

!

logical not

expression1

The value of the ifelse function if the condition is true.

expression2

The value of the ifelse function if the condition is false.

The following examples show boolean expressions and an ifelse statement:

Length > 5

The length is greater than 5

(L <3) || (W >=2)

Either the length is less than 3 or the width is greater than or equal to 2.

3*ifelse (A>B; A; B)

Evaluate three times the maximum of the variables A and B, returning 3*A if A is larger than B and 3*B if B is larger than A.

The range function is a more general form of conditional expression.

RNG (T; V1; N1; V2; N2; V3; N3 ... Vi; Ni; Vi + 1)

In this function, the first argument (T) is tested against every N value in the other arguments and returns the value (V) that lies between the two N values that bracket T. Each of the test N values must be greater than the preceding N.

For example, the expression

RNG (A; -1; 10; 0; 20; 1)

returns -1 if A is less than 10

 

0 if 10 <= A <201

 

1 if A >= 20

Units of Measure

Use different units of measure such as inches ("), feet ('), inches and feet (x'y"), millimeters (mm), centimeters (cm) and meters (m). It is possible to mix the units in the mathematical expression as long as the units are labeled properly, for example, 10" + 25.4 cm.

Nanoseconds

Graphite is well-suited for computer hardware design, such as diagrams of timing devices. For example, draw in nanoseconds (a billionth of a second). Designs which include nanoseconds typically consist of wave forms made of horizontal and vertical lines which mimic the functions of a timing device.

The concept for using nanoseconds is to relate time with distance.

1.     Specify millimeters as the unit of measure by choosing Layout>Preferences>Units.

2.     Choose Layout>Preferences>Grid.

3.     Set the grid spacing to 34 and the number of subdivisions to 2.

A megahertz is approximately 34 nanoseconds and this becomes the base cycle, with two tick marks for drawing half cycles.

4.     Turn on the grid.

5.     Use the Connected Lines tool to draw the wave form of the desired specifications.

6.     Use the Expand/Shrink tool to stretch the wave form to half and full cycles.

Using Parametrics for Wave Forms

Use parametrics to speed up this process, as shown below. The dotted lines are constraint lines.

1.jpg

Tip: It is possible to place the constraint lines on another layer and hide them.

Decimal Indicators

International numeric keypads have a comma in place of the period because Europeans use commas in decimal expressions.

Graphite can handle both American and European decimal entries in the Status Line (24,5 or 24.5), however, the display is controlled by the Numbers Control Panel.

Keyboards and Command Keys

Since keyboards vary from country to country, the Graphite command keys may not respond as described with a non-American keyboard.

Table of Contents

Index

Glossary

-Search-

Back