Skip to main content

Basic Types

Besides all geometry types and global commands, you can use the basic types of CAESES within your feature definition. Basic types are simple float values (actually, double precision floating numbers), signed and unsigned integer values, as well as vectors and strings. Here are the most important basic types along with their creator commands for use within features:

  • FBool (bool)
  • FUnsigned (unsigned/uint)
  • FInteger (integer/int)
  • FDouble (double)
  • FString (string)
  • FObjectList (objectlist)

Let's consider an example when to use them. For a float number there is a creator command double, while the type of such a created object is FDouble. Let's consider an example of a basic type where simple double values are used:

double A(2)
double B(3)

double C(A+B)

The object C has a value of 5. Here is the same example with a parameter (the type you find in CAD > parameters > parameter) which can also hold double values:

double A(2)
double B(3)

parameter C(A+B)
Note

In this case the object C holds an expression A+B. The difference between a double and a parameter hence is that the double is a discrete value, while a parameter can hold an expression that can be evaluated to a double value. Both are valid and important to have, but they do serve different purposes.

Using a parameter to store a double value allows to keep a dependency to another object. For example, the number you want to refer to depends on the coordinate of a point, which is calculated depending on the shape of a curve that may change over time. The parameter will keep track of those changes, the double value will not. Parameters are a lot more powerful than a primitive double.

But, this power comes at a cost. If you only want to store a floating point number, an object of type FDouble is a lot cheaper than using the FParameter type. This may also apply if the value does actually depend on another object, but you know that between creating the variable and using the actual value, the supplying objects do not change. The same applies when using parameters instead of integers, or 3D points instead of vectors.

tip

Use objects of basic types whenever possible as long as you do not want to keep track of dependencies, because they offer better performance.

Further typical use cases for basic types are calculations within features, as well as index variables for loops:

unsigned ind(0)

while( ind < N )

// ...

ind += 1

endwhile