Using MicroStation Python Samples


MicroStation Python comes with a collection of code sample which perform various functions in MicroStation. The samples are located in 2 places. 

  1. Locally installed at C:\ProgramData\Bentley\PowerplatformPython\Examples\MicroStation\ 
  2. On GitHub at MicroStationPython/MSPythonSamples at main · BentleySystems/MicroStationPython (github.com) 

Note 1: Any samples created between MicroStation releases will be published to the GitHub repository. 

Note 2: Some samples use DGN files and other data. Please find those files in C:\ProgramData\Bentley\PowerPlatformPython\Examples\Microstation\data\

Code samples are used in conjunction with the API Documentation to provide guidance on syntax when writing scripts for certain features. They can also be used as the basis for your scripts, blocks of code can be copied and pasted into your own scripts, or used in their entirety should the sample meet your need. 

There are also a number of websites that deliver samples of Python code. For example, the Python Examples | Programiz site provide basic examples as a learning guide.