MicroStation Python

  • All Publications
  • Links
  • LA Solutions
  • Home
  • Books about Python
  • Article Index
LA Solutions
tel: +44 1398 361 800

Python

MicroStation 2024 Python
Python Development for MicroStation
Programming Examples

Search LA Solutions for articles about Python …

Development Environment

MicroStation Python was introduced with MicroStation 2024.

MicroStation 2024 provides the Python Manager. You'll find it in the Utilities tool box.

Maximum Python File Length

Although it's not mentioned in Python help, the maximum length of a MicroStation Python file name is 48 characters, including the file extension.

A Python file name having more than 48 characters will crash MicroStation without warning.


MicroStation Python Article Index

Bentley Programming Wiki Python Programming Wiki

MicroStation Python
Title Link Comments
Bentley Programming Wiki Python Programming Wiki Examples by mostly Bentley Systems staff
DGN Utilities DGN Utilities Utilities for Analysing DGN objects

DGN Elements
Title Link Comments
Get Line Vertices Get Line Vertices
Get Zero-Length Lines Get Zero-Length Lines Shows how to build a list of elements with a list comprehension
Get Element at Offset Get Element at Offset
Count Elements by Type Count Elements by Type
Count Elements by Level Count Elements on Level
ChildElemIter Enumerate the contents of a complex element
Export Text Export Text Elements to a file Demonstrates pandas to create an Excel file
Export Text Table Export Text Table contents to a file Demonstrates pandas to create an Excel file
Import Text Import Text Elements from a file Demonstrates pandas to read an Excel file
Replace Text Replace Text Elements from Excel Demonstrates pandas to read an Excel file
PointElementInfo class PointElementInfo Data class used to convey point element information (e.g. Text origin, Cell origin)

Python
Title Link Comments
BeFileName Class BeFileName Demonstrates MicroStation Python file and folder manipulation
Class Selector Choose a class by name Demonstrates Python match, case and __qualname__

User Interface
Title Link Comments
Command Table Diagnostics Test an XML Command Table
MicroStation Window Title Set MicroStation Window Title
MicroStation Clock MicroStation clock using PyQt See PyQt
Hello World! Hello World using PyQt
Hello World Version 2 Hello World using PyQt: Version 2
Hello World Version 3 Hello World using PyQt: Version 3
Hello World Version 4 Hello World using PyQt: Version 4

Configuration Variables
Title Link Comments
Configuration Manager Example Shows how to use Python Configuration Manager Demonstrates Python ConfigurationManager
Get Report Folder Get Report Folder fom MS_REPORT_OUT

Measurements
Title Link Comments
Get Text Style Get Units-of-Resolution Get UORs from a DGN model

Python Installation

MicroStation 2024 installs Python for you. As with VBA, you don't need to install anything else. MicroStation provides the Python Manager, which you will find in the Utilities tool set.

Python Development Environment
Install Python MicroStation 2024 installs Python for you. Python Manager appears in the Utilities menu
MicroStation installs additional Python modules See Python help for details

Books about Python

Books about Python
Fluent Python O'Reilly Media A thorough guide to the mechanics of Python
Geometry for Programmers Manning Publications A great introduction to the maths of vectors, matrices and some dedicated Python modules
Math for Programmers Manning Publications Takes an alternative way to CAD to analyse multi-dimensional data

Development Tools

Development Tools: Visual Studio Code, Jupyter, GUIs and Windows
Title Article Location Comments
Visual Studio Code Visual Studio Code Microsoft freeware
Jupyter Jupyter Interactive development environment for notebooks
Message Center for Developers MicroStation Message Center See examples provided with MicroStation Python
User Interface: PyQt vs. Tkinter Comparing PyQt with Tkinter Two different GUI toolkits: see examples provided with MicroStation Python

Third-Party Libraries

There is a huge range of packages that enhance the Python ecosphere. Python.org provides a search tool to help you find a package.

Some packages are installed by MicroStation, so you don't have to. They are mentioned in the help section API Versions.

To see a full list of the modules delivered with MicroStation …

  • Open a Windows command window
  • Change to the Python folder, which is probably
    C:\ProgramData\Bentley\PowerPlatformPython\python
  • Key-in python -m pydoc modules

Trademarks

All trademarks are acknowledged. Trademarks may be registered in some jurisdictions.

Home
Home
Updated on 01-May-2025 Copyright © 2024…2025 Jon Summers