MicroStation BASIC Limits [FAQ]


  
 Applies To 
  
 Product(s):MicroStation
 Version(s):All
 Environment: N/A
 Area: N/A
 Subarea: N/A
 Original Author:Bentley Technical Support Group
  

 

 

 

 

 

 

 

 

Important Note

In MicroStation V8, Microsoft's Visual Basic for Applications (or VBA) was introduced. Although there are some similarities in concepts between MicroStation BASIC and VBA, Bentley HIGHLY recommends using VBA and not MicroStation BASIC in any MicroStation V8 version.

  What is the limit on total Strings?

The "string space", a memory allocation block used to contain strings as well as arrays, is limited to 1 MB. This includes all strings and arrays (public, private and local).

  What is the limit for the runtime stack?

The runtime stack is limited to 2,048 bytes. This space contains all local variables except arrays and strings. Each GoSub requires 2 bytes of runtime stack.

  What is the limit for private data space?

The private data space is allocated exactly to the size required by the private variables, up to a maximum of 32 K. This data space contains all private variables except strings and arrays which are in string space.

  What is the limit for public data space?

The public data space is allocated to exactly hold the public variables in use by all loaded macros, up to a maximum of 16 K. This data space contains all public variables except strings and arrays, which are stored in the string space.

  What is the max size for a source file?

The source file size is limited to 64 K bytes. (65535 characters) This size is the size of the source when normalized. The process of normalization will treat any string of spaces as a single character. If a line contains 7 spaces to line up the command with the line above it, that will count as one character. A tab takes up one character.

  What is the max compiled code size?

The max size of the compiled code segment is 64 K Bytes

  What is the max size of the symbol table?

The maximum size of the symbol table is 64K. The symbol table is used by runtime error handlers and the debugger.

  How many dimensions can be in a multiple dimension array?

The maximum number of dimensions for an array is 60.

 Dim Multi(3, 1 to 10, 1 to 15) 

This declaration creates an array that has three dimensions with sizes 4 by 10 by 15. The total number of elements is the product of these three dimensions, or 600.

  What is the max length for variable names and labels?

The max length of a variable name or label is 40 characters.

  What is the limit on DDE channels?

The limit is not fixed. The limited is determined by the available memory and system resources. This feature is restricted to the Windows platform only. The initial release of PowerDraft does not support DDE from BASIC, but the maintenance release includes DDE support.

  What is the limit on the number of open files?

The number of open files is limited to 255 or the operating system limit, whichever is less.

  What is max size of a single string?

The number of characters within a string literal is limited to 255. This is a string enclosed within quotation marks. Strings can be concatenated using the plus [+] operator with the normal string limit of 32,767 characters.

  What is the nesting levels of loops?

The number of nesting levels is limited by compiler memory.

  What is the text file input/output buffer size?

The maximum size of a single input/output operations is 512 bytes. When using the Input # or Print # statement the largest string which can be read/written to the file in a single operation is 512 bytes in length.

  What is the limit on size of an array?

There is a limit of 64K of data space for an array. To determine the size of an array apply the following calculation.

data size * (number of element in array + 1) <= 64K Bytes

For example an array with three dimensions and made of MbePoint would be as follows:

Dim array(0 to 5,1 to 10,11 to 30) as MbePoint

There are three variables to this equation...

  1. The data size, which in this case is 24 bytes ( an MbePoint is made up of three doubles of eight bytes each)
  2. The number of dimensions, in this case is three
  3. The number of indices for each dimension, (Upper bound - lower bound + 1), in this case 6, 10, 20.

The formula applied for this array generates the following:

24 * (5-0+1) * (10-1+1)* (30-11+1) = 28800 <= 65536 = 64K Bytes

The code below uses this string:

Option Base 1

Dim points (511,2) As MbePoint

Which turns out to be 24 * (511-1+1)(2-1+1) = 24528

See Also

Product TechNotes and FAQs

MicroStation Desktop TechNotes and FAQs

External Links

Bentley Technical Support KnowledgeBase

Bentley LEARN Server

Comments or Corrections?

Bentley's Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!