MicroStation BASIC FAQ


  
 Applies To 
  
 Product(s):All
 Version(s):See Important Note below
 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.
For more information on the use of VBA, see:
https://communities.bentley.com/products/microstation/w/microstation__wiki/15465/vba-programming-microstation

What is MicroStation BASIC?

MicroStation BASIC is a tool to allow you to drive MicroStation. The BASIC program can select tools and view controls, send key-ins, and modify elements using the tools provided.

What can I do with MicroStation BASIC?

The goal of MicroStation BASIC is to allow you to automate many activities which you can perform interactively in MicroStation.

What Bentley products support MicroStation BASIC?

MicroStation BASIC was first available in MicroStation PowerDraft. MicroStation also includes BASIC. Any platform which supports these products will have BASIC available.

Do I need MicroStation or MicroStation PowerDraft to run a BASIC program?

Yes, MicroStation BASIC is part of the MicroStation environment.

Do I have to use the MicroStation BASIC editor?

No, the input files for MicroStation BASIC are ASCII files. Any Text Editor can be used to edit them. You can use the MicroStation BASIC Editor for debugging.

How do I start a macro from the MicroStation command line or Key-in Field?

Use the command Macro followed by the macro name.

macro widget

If the macro does not reside in the directory(s) specified by MS_MACRO then the full path must be used.

macro c:\MyMacros\MyWidget

A macro name can be specified two ways, widget.ba or widget.bas. If the .ba file extension is used, the BASIC program will not be recompiled. If the .bas file extension is used, the BASIC program will be recompiled if the source file has been updated since the last compile.

How do I start a macro with the debugger from the command line?

Use the command Macro with Debug followed by the macro name.

macro debug Widget

How do I recompile the application for other platforms?

MicroStation BASIC programs are platform independent. Copy the .ba in the same way you would a DGN file to the target platform. The source file .bas does not have to be copied. If both files are present and the source has changed, the compile happens automatically.

How do I run a MicroStation BASIC program as a start up macro?

An MDL application RunMacro is supplied in the MDL examples directory. This application will look at configuration variables and run a MicroStation BASIC program(s) as MicroStation starts. For more information on RunMacro, see \ustation\mdl\examples\runmacro\readme.txt.

What is Macro Record/Edit/Playback?

This question has three parts. Macro Record is a way of creating a macro from actions take through the operator interface. The macro recorder generates BASIC code for each recordable user action. Edit is to take a recorded macro and add actions which could not be recorded. Playback of a recorded macro repeats each step recorded. In an unmodified macro there will be no interaction with the operator. All inputs were recorded are played back.

See Also

Product TechNotes and FAQs

MicroStation Desktop TechNotes and FAQs

https://communities.bentley.com/products/programming/microstation_programming/

https://communities.bentley.com/products/microstation/w/microstation__wiki/15465/vba-programming-microstation

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!