Questions similar to these appear in the Be Communities MicroStation Forum.
This page describes a solution to a user's question. The solution is implemented in a MicroStation VBA project.
A zebra crossing is also known as a pedestrian crossing. The crossing is a set of markings on a road (highway) that indicate clearly where a pedestrian is entitled to cross the road with reasonable safety.
MicroStation users who work in highways design or local government may want to draw diagrams of zebra crossing in their day-to-day work. We wrote a MicroStation tool that helps to automate that task. The tool is created in a VBA project.
The tool meets several user requirements …
Start the VBA macro using MicroStation key-in:
vba run [Zebra]modMain.Main
The Zebra Crossing dialog pops …
If you're not interested in the discussion on VBA that follows, skip straight to the download section below.
There are several VBA modules in the project …
modMain
contains the main entry point and utility functions
clsZebra
is a class module that encapsulates the logic to draw a crossing
clsCreateZebra
is a class module that Implements IPrimitiveCommandEvents
.
In other words, the MicroStation primitive command logic to let a user create graphics elements
frmZebra
is a VBA UserForm
that is the Create Zebra Crossing dialog
modClipboard
is a VBA normal module that contains version-dependent code to copy text to the Windows clipboard
The Create Zebra Crossing dialog contains text boxes that let a user specify design parameters for the zebra crossing …
The user adjusts those parameters and clicks the Place Zebra Crossing button.
That button click starts the primitive command implemented in clsCreateZebra
.
It prompts the user for the crossing start point, and then for the finish point.
clsCreateZebra
passes user input and mouse click data to clsZebra
.
That calculates the crossing size and number of panels to create a normal cell.
The cell is passed back to the primitive class clsCreateZebra
to display the crossing dynamically.
When the user places a second data point then the crossing is added to the active DGN model.
After the user has placed the second data point then clsZebra
calculates some useful metrics
and passes the results to the dialog for display …
At the same time those metrics are formatted and copied to the Windows clipboard. The user may copy the results into some other application. Here's an example …
Crossing width=4m Crossing length=6.98m Crossing area=27.93m² Panel length=0.5m Panel gap=0.5m Panel area=12.00m² Panel count=6
You can download the Zebra Crossing MVBA project.
The project includes the MVBA project Zebra.mvba
.
C:\Program Files\Bentley\Workspace\Standards\vba
vba run [Zebra]modMain.Main
This code has been tested in both MicroStation V8i and MicroStation CONNECT.