Learning MicroStation VBA

Chapter 8: Working With Numbers

Overview

For hundreds and even thousands of years, the world's greatest mathematicians attempted to calculate an accurate value for Pi. When asked about this value today, we casually state 3.14159 or something close to it. A 2 + B 2 = C 2. This formula is second nature to children on our school's playgrounds today, whereas not long ago the equality of the sum of the squares of the sides of a right triangle to the square of the hypotenuse was a great unknown.

While software development, in general, deals in large part with logic, add MicroStation to the mix and the need to manipulate numbers increases exponentially. After all, what is a line? The shortest distance between two points. Each of these points is composed of three numeric values: an X, a Y, and a Z. To draw a circle at the midpoint of that line in VBA, we need to calculate the line's midpoint. How do we do that? Find the phone number of a math teacher? Not so, my friend.

Numeric Functions

VBA makes working with numbers a breeze. It doesn't do all of the work for us, but we can do a great deal with very little pain.

Addition

1 + 1 = 2. We learned this many, many years ago. The plus symbol (+) is used in VBA to add numbers. Take a look:

Sub <b class="bold">TestAdditionSubtraction</b>()    Dim SelPt As Point3d    Dim CenPt As Point3d ...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Digital LED Displays
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.