MicroStation Python Python Development for MicroStation Programming Examples |
Search LA Solutions for articles about Python …
Bentley Systems introduced Python as a development tool with MicroStation 2024. MicroStation Python includes several Python modules and some MicroStation-specific extensions.
MicroStation provides the Python Manager. You'll find it in the Utilities tool box. It's the gateway to your Python projects.
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.
Bentley Programming Wiki Python Programming Wiki
Title | Link | Comments |
---|---|---|
Bentley Programming Wiki | Python Programming Wiki | Examples by mostly Bentley Systems staff |
DGN Utilities | DGN Utilities | Utilities for Analysing DGN objects |
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 | |
PointElementInfo class | PointElementInfo | Data class used to convey point element information (e.g. Text origin, Cell origin) |
Element Range | Element Range | element_range class used to compare one range (e.g. element range) with another range (e.g. fence range) |
Curve Vector | CurveVector | A curve vector is a pure geometrical abstraction of a DGN element |
Title | Link | Comments |
---|---|---|
Get Active Cell Library | Get Active Cell Library | Demonstrates how to get the active cell library and see its contents |
Get Cells from Library | Get List of Cells | Demonstrates how to get the active cell library and see its contents |
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__ |
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 |
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 |
Title | Link | Comments |
---|---|---|
Get Units-of-Resolution | Get Units-of-Resolution (UORs) | Get UORs from a DGN model |
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.
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 |
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 |
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 |
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 …
C:\ProgramData\Bentley\PowerPlatformPython\python
python -m pydoc modules