Python Assistant Prompts


 

We’re pleased to introduce Python Assistant in MicroStation 2025, a powerful new feature designed to make automation and tool creation more accessible than ever. Whether you're just beginning your scripting journey or you're a seasoned user looking to accelerate your workflow, Python Assistant is here to help.

 

Below is a categorized list of prompts to help you get started and make the most of Python Assistant for learning and productivity.

 

NOTEAll items below are "Prompts" (linked or not) that you can Copy and Paste directly into the MicroStation Python Assistant.

Table of Contents

General Prompts

Script which generates 10 random rectangular shapes and adds the shapes to the current file/model. Some Shape elements to have a fill color.

Script which generates various 2d elements like point, line, line string, shape and adds the elements to the current file/model. Each unique element type to be a separate function. Set element properties like Color, Level, Weight to random values and Style=0.
Script to create a Text element with text "Line 1". Set properties Level, Color, Weight, Style=0. Set text style "MyCustomTextStyle" if the text style is present in the DGN File.  Script to read all elements in the current DGN file and report the element properties (Color, Level, Weight, Style and Element Type)

 

Annotation Prompts

Can you write a script which defines a new text style with specific font, height, width, color, and spacing parameters? Can you write a script which modifies the content of a selected text element?

 

Coordinate Systems Prompts

Can you write a script which retrieves the origin and rotation of the currently active ACS and displays it? Can you write a script which sets the LL84 Geographic Coordinate System (GCS) from the library and applies it to the active model?

 

Geometry Prompts

Can you write a script which creates a distance constraint between two planar faces in 3D? Can you write a script which implements a tool to create a polyface mesh (mesh with facets defined by points) based on user-clicked points defining each facet?
Can you write a script which creates a new named group and adds all currently selected elements to it? Can you write a script which performs a flood operation from a user-clicked point to identify a closed boundary and create a shape element representing that area?

 

Item Types Prompts

Can you write a script which reads all ECInstances attached to a selected element and prints their class names and property values? Can you write a script which defines a new Item Type library and adds Item Type definitions with various property types (text, number, boolean)?

 

Manipulation Prompts

Can you write a script which implements an interactive tool to copy selected elements from a base point specified by the user? Can you write a script which implements an interactive tool to scale selected elements relative to base point using a scale factor derived from user input?

Can you write a script which prompts the user to select a cell library name and cell name, then places that cell interactively?

Can you write a script which attaches another DGN file as a reference attachment, prompting the user for the file and attachment settings (model logical name, and scale)?

 

Printing & Raster Prompts

Can you write a script which generates a PDF plot of the current view? Can you write a script which saves the contents of the currently active view window to an image file (e.g., PNG, JPG, TIFF) with specified resolution?

 

Selection Prompts

Can you write a script which selects all elements of specific type (e.g., all Text Elements or all Cell Elements) in the active model? Can you write a script which selects all 3D solid or surface elements whose volume falls within user-specified range?

 

UX Prompts

Can you write a script which implements an interactive tool allowing the user to select text element and edit its content in a dialog box? Can you write a script which displays a non-modal PyQt window within MicroStation showing the current time, updating every second?

 

Feel free to explore these resources and start your journey with Python Assistant today! If you have any questions or need further assistance, you can reach us through the following channels:

 

 

Python: Documentation | API Presentations | FAQs | GitHub | Samples | Wikis | Blogs