Bentley OpenRoads Designer / MicroStation VBA macros. The original
nodeincell.mvba ships compiled; everything else in this repo ships as
.bas source modules so the code is reviewable and contributable.
The macros target plain MicroStation VBA so they run in any OpenRoads Designer release without depending on a specific CivilModel API version. A few (StationOffset, PointsIO) are written as conservative fallbacks for the OpenRoads-native annotation tools.
-
Clone or download the repo.
-
In OpenRoads Designer: open the VBA Project Manager.
-
Right-click an existing project (or create a new one) → File → Import File... → pick a
.basfile. -
Each module appears under your project. Run a sub with:
VBA RUN [ProjectName] ModuleName.SubNameFor example:
VBA RUN MyTools LabelAcres.LabelAcresMain -
Bind frequent commands to function keys via Workspace → Function Keys for one-keystroke access.
| Sub | File | What it does |
|---|---|---|
LabelAcresMain |
LabelAcres.bas |
Label every selected closed shape with area in acres to 0.1 AC at the bbox center. |
TotalAreaMain |
TotalArea.bas |
Sum area of every selected closed shape; report sq ft + acres. |
TotalLengthMain |
TotalLength.bas |
Sum length of every selected linear element; report ft + mi. |
LotBDMain |
LotBearingDistance.bas |
Label every straight segment of the first selected shape with bearing+distance, plus area at centroid. |
| Sub | File | What it does |
|---|---|---|
ImportPNEZDMain |
PointsIO.bas |
Read a PNEZD CSV and place zero-length lines + 3-line text nodes for each point. |
ExportPNEZDMain |
PointsIO.bas |
Write every selected text node out to PNEZD CSV (first line treated as PNO). |
CoordNEMain |
CoordLabel.bas |
Two-line Northing / Easting label at the first selected element's centroid. |
CoordElevMain |
CoordLabel.bas |
One-line EL ###.## label at the first selected element's centroid. |
PointGridMain |
PointGrid.bas |
Rectangular grid of zero-length point elements between two corners. |
StationOffsetMain |
StationOffset.bas |
Station & offset (L/R) of a target X,Y relative to a selected alignment polyline. |
| Sub | File | What it does |
|---|---|---|
InverseReportMain |
InverseReport.bas |
Full inverse on the first selected line: bearing, distance, dN/dE/dZ, slope. |
SlopeLabelMain |
SlopeLabel.bas |
Slope label at the midpoint of a selected line (percent + H:V ratio). |
| Sub | File | What it does |
|---|---|---|
TextUpperMain |
TextCase.bas |
Selected text/text-nodes → UPPER. |
TextLowerMain |
TextCase.bas |
Selected text → lower. |
TextTitleCaseMain |
TextCase.bas |
Selected text → Title Case. |
TextHeightMain |
TextHeight.bas |
Apply a new height (master units) to every selected text/node. |
TextRotateHorizMain |
TextRotateHoriz.bas |
Rotate upside-down text 180° so it reads left-to-right. |
| Sub | File | What it does |
|---|---|---|
FlattenZMain |
ZTools.bas |
Set Z = 0 on every vertex/origin of every selected element. |
MoveZMain |
ZTools.bas |
Add a delta to Z across the selection. |
SetZMain |
ZTools.bas |
Set Z to a single value across the selection. |
| Sub | File | What it does |
|---|---|---|
LevelCountMain |
LevelCount.bas |
Element counts grouped by level (graphical elements only). |
LevelTranslateMain |
LevelTranslate.bas |
CSV-driven level rename / re-leveler (OLD,NEW per row, auto-creates). |
LevelIsolateMain |
LevelIsolate.bas |
Turn display off on every level except the selected element's level. |
LevelShowAllMain |
LevelIsolate.bas |
Turn display on for every level. |
CellCountMain |
CellCount.bas |
Tally of placed cells grouped by cell name. |
| File | What it does |
|---|---|
nodeincell.mvba |
Copy + increment text inside a cell as a single operation (compiled VBA project). |
- Working units are assumed to be survey feet. For metric DGNs,
change
SQFT_PER_ACREinLabelAcres.bas/TotalArea.basto4046.856(sq m / acre). StationOffsetis a fallback for environments where the OpenRoads CivilModel API isn't loaded. For real alignment objects with stationing equations and superelevation, prefer the native OpenRoads Civil Annotation tools — this VBA only understands plain MicroStation geometry.LevelIsolatewrites toLevel.IsDisplayed. If your DGN is attached to references with their own level override masks, the references won't update — toggle Level Display on the reference itself.ImportPNEZD/ExportPNEZDtreat the second line of a text node as the elevation when round-tripping. The import-then-export pair is lossless withinFormat("0.000")precision.- Source modules use
Option ExplicitandOn Error GoTo Cleanupso errors surface with a clear message instead of silently corrupting geometry.
Vanilla AutoCAD / Civil 3D LISP equivalents of many of these macros (LABELACRES, BD, SLP, NE, ZL, CHZ, FLAT, etc.) live in C3D-AutoCAD. Carlson Civil/Survey equivalents (LABELAC, LOTBD, PNORENUM, PNOINV, TRAV, FBREP, STALBL, etc.) live in Carlson-CAD. Together the three repos cover the LISP / VBA tooling layer of most US civil offices.
One .bas per logical unit (one module, one or more closely related Subs).
Header comment names the Sub(s), the key-in syntax, and any assumptions
about working units. Append a row to the right table above.