The MicroStation Sample list as of the 2026 release. Samples can be used:
| Category | Sample Name | Description |
| Animation | BallsDroppingByGravity.py | Provides an interactive PyQt5 dialog to simulate and animate spheres dropping under gravity and colliding with other solids. |
| Base Geometry | DrawCircles.py | Draws a predefined set of circles in the DGN model using default parameters provided by the ElementDrawer helper. |
| Base Geometry | DrawLine.py | Uses the ElementDrawer utility to place a standard set of line elements into the design model using default settings. |
| Base Geometry | DrawRoundRectangles.py | Draws a set of rounded rectangles in the model using pre-configured helper functions for geometric creation. |
| Base Geometry | ElementDrawer.py | A collection of utility functions designed to draw common geometric elements such as lines, circles, and rounded rectangles. |
| Base Geometry | LineCreatorWithQtToolSettingDialog.py | A line placement tool that features a custom interactive settings dialog built using the PyQt5 framework. |
| Base Geometry | LineCreatorWithToolSettingDialog.py | Implements a line creation tool with a floating settings dialog created using the Tkinter library. |
| Base Geometry | LineExample.py | Demonstrates creating line elements and programmatically modifying their symbology properties like color, weight, and level. |
| Base Geometry | LineStringExample.py | Shows how to programmatically define a series of vertices to create and add line string elements to the active model. |
| Base Geometry | PlaceLine.py | Demonstrates invoking the "Place Line" command and programmatically providing the start and end data points via key-ins. |
| Base Geometry | PlaceLineCOM.py | Shows how to automate MicroStation via its COM API to invoke the line placement command and provide coordinate points. |
| Base Geometry | CreationExample.py | A master sample that executes multiple creation scripts to place lines, arcs, ellipses, attachments, and named groups. |
| Base Geometry | DrawElementWithArguments.py | Demonstrates how to process command-line arguments to draw either a line or a circle based on user-provided coordinates. |
| Base Geometry | RandomSizeColorCircles.py | Identifies a closed region and populates it with non-overlapping, randomly sized and colored filled circles based on user-defined packing density. |
| Cells | BarrierAlongPath.py | Automates the removal of specific "Barrier01" cells near a path and replaces them with new instances spaced at regular intervals. |
| Cells | CellSum.py | Analyzes the active design model to identify, categorize, and count graphical, point, and parametric cell instances. |
| Cells | DeleteCellsOnPath.py | Converts a specific element to a curve vector and deletes all "Barrier01" cells located within 50 units of that path. |
| Cells | ParametricCell.py | Demonstrates the full process of creating a parametric cell model, defining its variables, and placing it within a target model. |
| Cells | ParametricCellOnCurve.py | Analyzes a path and automatically places "Barrier01" parametric cells at vertex bisector points along that curve. |
| Cells | PlaceCell.py | Attaches a cell library and demonstrates placing both standard and parametric cells at a specified origin point. |
| Cells | PlaceCellFromLibrary.py | Attaches a library and places cell instances at calculated points along a B-spline curve based on arclength distance. |
| Cells | PlaceCellsAlongPath.py | Automatically places specified cell instances at regular intervals along an element's path, orienting them to the curve's tangent. |
| Cells | TkCellPlacer.py | Implements a tool using Tkinter that prompts users for a cell library and name, then interactively places that cell. |
| Change Tracking | ChangeTrackCallbacks.py | Demonstrates registering various callback functions to monitor and handle system-level change tracking events, including undo and redo operations. |
| Change Tracking | HistoryCallbacks.py | Shows how to register and handle numerous design history events such as pre-commit, post-create, and revision formatting. |
| Configuration | ConfigurationMapper.py | Provides a PyQt5-based GUI for searching configuration variables and visualizing their dependencies and source files as an interactive mind map. |
| Coordinate Systems | AcsExample.py | Demonstrates how to programmatically create and save a new rectangular Auxiliary Coordinate System (ACS). |
| Coordinate Systems | AcsInformation.py | Retrieves and displays the origin and rotation values of the currently active Auxiliary Coordinate System in the Message Center. |
| Coordinate Systems | ActiveACS.py | Obtains the active ACS for the selected viewport and displays its coordinate origin and rotation matrix details to the user. |
| Curves | ArcExample.py | Shows various methods for programmatically creating and adding multiple circular or elliptical arc elements to a design model. |
| Curves | DrawBSPLine.py | Programmatically defines a set of poles and an order to create and add a B-spline curve element to the model. |
| Curves | DrawCurve.py | Defines a set of coordinates and programmatically adds a generic curve element based on those points to the active DGN model. |
| Curves | EllipseExample.py | Shows several ways to programmatically create multiple ellipse elements with different radii, rotations, and positions. |
| Curves | StrokeElements.py | Demonstrates generating and reporting coordinate points along various curve vectors, either at a maximum edge length or at set intervals. |
| Detailing Symbols | CreateSectionAndModel.py | Identifies a specific line string element and creates a section callout and corresponding drawing model along its path. |
| Detailing Symbols | CreateSections.py | Automatically places multiple section callouts at defined intervals along an identified line string path using a specific drawing seed. |
| Geospatial | AddGeographicCoordinateSystemToModel.py | Adds a Geographic Coordinate System to a DGN model using EPSG codes, coordinate system names, or Well-Known Text (WKT) definitions. |
| Geospatial | ClearImportedFeatures.py | Programmatically identifies and removes elements from the active model that were previously imported as SHP or GDB features. |
| Geospatial | CreateCustomGCS_StlouisTM96.py | Adds a specific Geographic Coordinate System to the active model using a provided Well-Known Text (WKT) string for StLouisTM96. |
| Geospatial | GCSSetter.py | Demonstrates programmatically attaching the "LL84" Geographic Coordinate System to the active DGN model from the system library. |
| Geospatial | GDBExport.py | Shows how to export feature data from a model into a File Geodatabase (GDB) using filters like element templates, levels, or item types. |
| Geospatial | GDBImport.py | Demonstrates importing geospatial feature classes from a specified File Geodatabase into the current DGN model. |
| Geospatial | GDBImportAsCell.py | Imports point data from a File Geodatabase and represents them as specific cell elements styled by an element template. |
| Geospatial | GeospatialContextConnection.py | Provides examples of creating and managing server connections to ArcGIS and WFS sources, including layer selection and property retrieval. |
| Geospatial | GeospatialContextUtilities.py | Contains utility functions for geospatial workflows, such as creating named boundaries, setting fences, and fitting views. |
| Geospatial | GetDatasetLayers.py | Connects to a geospatial server and prints a list of all available feature layers contained within the dataset. |
| Geospatial | GetGDBImportFeatureClasses.py | Scans a File Geodatabase and lists all the feature classes it contains by their display names. |
| Geospatial | QueryAndDisplayProjectArea.py | Queries geospatial data within a project area and uses display rules and styles to color code infrastructure-suitable zones. |
| Geospatial | QueryAndReportProjectArea.py | Performs a geospatial query within a project area fence and generates a detailed report based on the imported item type data. |
| Geospatial | QueryServerConnection.py | Demonstrates several methods for querying geospatial features from a server connection using views, fences, or named boundaries. |
| Geospatial | QuerySpecificFeatureIn_Florida_NamedBoundary.py | Connects to an ArcGIS server and imports specific feature layers that fall within a defined Florida-based named boundary. |
| Geospatial | QueryWFSWithElementTemplate.py | Connects to a WFS server, updates a specific element template's color, and then queries features using that template for styling. |
| Geospatial | SHPExport.py | Demonstrates exporting geospatial features from the active design model into SHP files based on templates, levels, or item types. |
| Geospatial | SHPImport.py | Demonstrates importing feature data from an external SHP file into the active design model and fitting the view to the result. |
| Geospatial | SHPImportAsCell.py | Imports point geometry from a SHP file as cell elements, using an element template to define the cell name and size. |
| Geospatial | SHPImportWithDesignLink.py | Imports SHP features and automatically creates URL-based design links on them using property data from the source file. |
| Groups | NamedGroup.py | Demonstrates how to programmatically create a named group and add all currently selected elements as its members. |
| Groups | NamedGroupExample.py | Shows the creation of a named group and adding a newly created line element member to that group. |
| Groups | DrawGroupedHole.py | Shows the programmatic creation of a grouped hole element by combining inner and outer elliptical boundary elements. |
| Groups | ElementFlood.py | Uses DgnRegionElementTool to implement a tool that creates a new region element by flooding an area from a seed point. |
| Groups | GroupHole.py | Demonstrates automating the "Group Hole" command by programmatically providing the outer boundary and inner hole elements. |
| Groups | RegionCreator.py | Implements a tool that creates new region elements via a flood operation and applies active symbology and area fill settings. |
| GUI | PyQtClock.py | Demonstrates a real-time digital clock application built with PyQt5 that runs without blocking MicroStation's main input loop. |
| GUI | TkClock.py | Demonstrates a simple real-time digital clock built using the Tkinter framework that runs concurrently with MicroStation's main loop. |
| Hardware / Input Devices | GetInput.py | Demonstrates using PyCadInputQueue.GetInput to wait for and process specific user inputs like data points or key-ins. |
| Hardware / Input Devices | LocateCallbacks.py | Demonstrates registering callbacks to handle events related to element location, selection, double-clicking, and description overrides. |
| Hardware / Input Devices | StateCallbacks.py | Demonstrates registering callbacks for system state events such as entering data points, resets, cursor moves, and command terminations. |
| Manipulation | ElementCopyTool.py | Demonstrates how to use DgnElementSetTool to build a tool that copies design elements from an anchor point to a new location. |
| Manipulation | ElementModifier.py | Implements a tool that allows users to interactively move the vertex of a line or line string. |
| Manipulation | ElementMover.py | Shows how to inherit from DgnElementSetTool to create a basic tool for moving elements between two points. |
| Manipulation | ElementRotateTool.py | Provides a basic example of using DgnElementSetTool to create a tool for rotating selected elements based on user interaction. |
| Manipulation | ElementScaler.py | Implements an interactive tool that prompts the user for a numeric factor via a Tkinter dialog and then scales the selected element. |
| Manipulation | ElementScaleTool.py | Demonstrates building a tool to scale elements interactively, calculating the scale factor based on cursor distance from an anchor. |
| Manipulation | ModifyMultipleElements.py | Implements a tool to batch modify properties like text style, color, weight, level, or line style for multiple selected elements. |
| Manipulation | ReOrderCirclesBySize.py | Automatically identifies all true circles in the model, sorts them by diameter, and aligns them edge-to-edge along the X-axis. |
| Manipulation | ScanRange.py | Detects overlapping graphical elements in a model and automatically repositions them to resolve the geometric overlap. |
| Measure | MeasureAngleExample.py | Measures the angles between segments of a line string and places circles along the resulting bisector directions. |
| Measure | MeasureDistanceExample.py | Measures and utilizes the distance between existing circle elements and specified B-spline curves to place new elements on the opposite side. |
| Mesh | MeshStyleSamples.py | Shows how to create various mesh types, including indexed face loops, quad grids, triangle grids, and coordinate-based meshes. |
| Mesh | MeshToolCreateMesh.py | Implements an interactive tool that allows users to define a mesh element by picking multiple points on the screen. |
| Mesh | MeshTools.py | Adds key-in commands that launch custom tools for placing different types of mesh elements in the design. |
| Mesh | PolyfaceCreateTool.py | Implements a custom tool to create a polyface mesh element from a sequence of user-selected points on the canvas. |
| Mesh | PolyFaceCreator.py | Defines a tool using DgnElementSetTool to interactively create polyface mesh elements by picking points in the design. |
| Mesh | PolyfaceTool.py | Registers a key-in command that launches an interactive tool for creating new polyface mesh elements. |
| Miscellaneous | ComplexElemNested.py | Defines a tool for creating, modifying, and nesting complex elements like shapes, strings, surfaces, and solids. |
| Miscellaneous | PSampUtility.py | A library of utility functions for common tasks like model management, level creation, and drawing various basic geometric elements. |
| Models | CreateModifyModel.py | Demonstrates programmatically creating a new drawing model and subsequently changing its type to a sheet model. |
| Multi-Line | DrawMultiLine.py | Creates a multi-line element by defining a style from the DGN file and providing a sequence of points for its path. |
| Parametrics | ElementPropertyDrivingElements.py | Provides a PyQt5-based dialog to generate guide lines and cylinders between a circle center and points along a B-spline curve. |
| Parametrics | ConstrainPlanes.py | Implements a method to create a distance constraint between two selected planar faces of 3D solid bodies. |
| Parametrics | Constraint2d.py | Demonstrates applying various 2D geometric constraints like perpendicularity, tangency, and distance to elements within a model. |
| Parametrics | Constraint3d.py | Shows how to create 3D constraints between solid bodies, including fixed, parallel, and coincident relations between their faces or edges. |
| Parametrics | VariableAndVariation.py | Demonstrates full CRUD operations for design variables and variations, including importing and exporting them via CSV files. |
| Printing | PdfPlot.py | Demonstrates programmatically generating a PDF file of the current design using the PDF printer driver configuration. |
| Programming | AppData.py | Demonstrates how to use DgnModelAppData to register a listener that tracks model events such as element additions and deletions. |
| Programming | DebugPlaceLine.py | Demonstrates how to use the debugpy library to pause script execution and debug Python code while running inside MicroStation. |
| Programming | InputCallbacks.py | Demonstrates registering callbacks to filter, monitor, and preprocess system-level input events like commands and key-ins. |
| Programming | RunVBAMacro.py | Shows how to programmatically load a VBA project and execute a specific macro from a Python script. |
| Programming | SystemCallbacks.py | Demonstrates registering and handling numerous high-level system events such as file loading, saving, fencing, and reference attachment. |
| Programming | Terminal.py | Implements a fully functional interactive Python terminal within MicroStation using the Tkinter framework. |
| Programming | VisualScripterPrototype.py | Implements a prototype node-based visual scripting interface using Tkinter to create and manipulate geometric elements like circles. |
| Project Navigation | ElementLinkExample.py | Defines a tool to manage URL links on DGN elements, supporting operations like link creation, modification, extraction, and deletion. |
| Properties | TagsExampleCreateTagSet.py | Shows how to programmatically define a tag set with various property types and add it to the design file. |
| Properties | TagsExamplePlaceTagFromText.py | Implements a tool that reads text from an element and automatically creates and attaches a corresponding tag based on the value. |
| Properties | DgnECChangeEvents.py | Demonstrates registering for change events to track the creation, modification, and deletion of DgnEC instances and their relationships. |
| Properties | ECCrud.py | Provides a framework to perform Create, Read, Update, and Delete (CRUD) operations on EC schemas, instances, and relationships. |
| Properties | ECDumpUtility.py | Serializes EC property data from selected elements into a JSON file, including schema, class, and ID information. |
| Properties | ECInstances.py | Identifies the EC classes attached to the first selected element and prints all their property names and values to the console. |
| Properties | ECQuerySample.py | Demonstrates querying and selecting elements in a design model based on specific EC property criteria such as description, length, or color. |
| Properties | ECXSchema.py | Retrieves a list of schemas stored in the DGN file and provides functionality to export them to individual XML files. |
| Properties | ExtractItemTypesToExcel.py | Scans the model for 'Title Block' item types and exports all their property data into an Excel spreadsheet. |
| Properties | ExtractProperties.py | Retrieves all EC properties of a selected element and exports the values and types into a structured JSON file. |
| Properties | ItemTypeAttachDetach.py | Shows how to programmatically attach an item type from a library to an element and how to subsequently detach it. |
| Properties | ItemTypeCRUD.py | Demonstrates full CRUD operations for item types, including creating libraries, reading properties, and deleting definitions. |
| Properties | ItemTypeCustomProperty.py | Shows how to define and use complex custom item type properties such as arrays, structs, and arrays of structs. |
| Properties | RepopulateItemsFromExcel.py | Updates item type properties in a DGN file by reading matching data from a previously exported Excel spreadsheet. |
| Properties | report_Example.py | A complete workflow script that demonstrates creating item types, attaching them to elements, and generating corresponding reports. |
| Properties | report_example_attach_itemtypes.py | Implements a tool to interactively attach vendor and item information to selected model elements for reporting purposes. |
| Properties | report_example_common.py | Provides centralized configuration settings and common utility functions used across all report-related sample scripts. |
| Properties | report_example_create_itemtypes.py | Programmatically creates specific item type libraries and property definitions required for the reports example workflow. |
| Properties | report_example_generate_report.py | Defines a report category and definition, configures its columns based on item types, and sets up sorting rules. |
| Properties | TkTitleBlockManager.py | A Tkinter-based application that allows users to export and import title block data between Item Types and Excel spreadsheets. |
| Raster | QueryRasterElement.py | Scans the model for raster elements and queries their specific extent and handler information. |
| Raster | RasterAttachArcGIS.py | Demonstrates attaching an ArcGIS REST service as a raster attachment in the active model using key-in commands. |
| Raster | RasterAttachmentExample.py | Programmatically creates a raster attachment in the model by defining its document moniker, transform, and extent. |
| Raster | ShowElementAmountWithPandasBar.py | Uses the Pandas and Matplotlib libraries to count elements by type and generate a bar chart attached as a raster element. |
| Raster | TkModalDialog.py | Demonstrates using a Tkinter modal dialog to select a raster file and programmatically attach it as an image to the active model. |
| Reference | DgnAttachmentExample.py | Shows how to programmatically create a new model in a file and attach it as a DGN reference to the active model. |
| Reference | NestedReferenceMapper.py | Uses PyQt5 to create an interactive mind map visualization of the reference file hierarchy for the active DGN model. |
| Reference | Reference.py | Provides an interactive Tkinter interface for users to choose a DGN file and attach it as a reference with a specific scale. |
| Reference | ReferenceCommands.py | Registers key-in commands to automate the attachment, detachment, and rotation of DGN file references in the current model. |
| Selection | AllTextSelector.py | Scans the active model for all visible graphical elements and adds every text element found into the current selection set. |
| Selection | ElementsToDisplaySet.py | Selects elements matching a specified level name and adds them to a display set for isolated viewing. |
| Selection | ElementVolumeSelector.py | Uses a Tkinter dialog to filter and select all 3D elements in a model that fall within a user-specified volume range. |
| Selection | SelectCellElementByName.py | Identifies and highlights all cell elements in the active model that match a user-specified name. |
| Selection | SelectElementByArea.py | Uses EC queries to find and select all elements in the active design model whose enclosed area is below a given threshold. |
| Selection | SelectElementByColor.py | Demonstrates selecting and highlighting graphical elements in the active model based on a specific color index value. |
| Selection | SelectElementByItemType.py | Scans the model for elements whose custom item properties match a specific property name and string value. |
| Selection | SelectElementByLength.py | Selects and highlights line and line string elements whose calculated length is less than a user-provided threshold. |
| Selection | SelectElementByLevelName.py | Iterates through graphical elements and selects all those belonging to a level with the specified name. |
| Selection | SelectElementByLevelNumber.py | Selects and highlights all elements in the active design model that match a specified level number. |
| Selection | SelectElementByLineStyle.py | Identifies graphical elements in the active model that match a specified line style index and adds them to the selection set. |
| Selection | SelectElementByPerimeter.py | Uses intrinsic EC properties to select all graphical elements in the model whose perimeter is less than a specified value. |
| Selection | SelectElementByRGBColor.py | Scans graphical elements and selects those whose color matches a specific set of red, green, and blue values. |
| Selection | SelectElementByScanCriteria.py | Uses the ScanCriteria class to efficiently find and report the IDs of all MultiLine elements in the active design model. |
| Selection | SelectElementBySCRange.py | Demonstrates using ScanCriteria to identify and report elements that fall within a specific range of the active view. |
| Selection | SelectElementByType.py | Allows the user to select and highlight all graphical elements in the model that match a specific numeric element type. |
| Selection | SelectElementByVolume.py | Uses intrinsic EC properties to select and highlight 3D elements whose volume is less than a user-specified threshold. |
| Selection | SelectElementByWeight.py | Scans the active model for graphical elements with a specified line weight and adds them to the selection set. |
| Selection | SelectElementsOnLevelByColor.py | Implements a compound selection filter that identifies elements matching both a specific level name and RGB color value. |
| Selection | SelectSharedCellElementByName.py | Identifies and highlights shared cell instances (type 35) in the model that match a specific cell name. |
| Solids | RandomColorCylinders.py | Fills selected regions with randomly colored, non-overlapping circles that are then extruded into solid cylinders. |
| Solids | BoltAndNut.py | Creates complex 3D parametric solids for bolts and nuts using variables, expressions, and smart feature operations like extrusions and cuts. |
| Solids | ConvertSolidPrimitiveToParasolid.py | Provides a tool to convert DGN-based surface or solid primitives into Parasolid BRep body representations. |
| Solids | I-beam.py | Creates a parametric 3D I-beam solid by defining a 2D profile with constraints and then extruding and rotating the resulting body. |
| Solids | ModifyEdgeSamples.py | Provides a PyQt5-based tool to interactively blend or chamfer edges of 3D solid bodies with a specified radius. |
| Solids | ParametricSolid.py | Shows how to create a 3D parametric solid by extruding a circular profile element using smart feature settings. |
| Solids | SolidModification.py | A collection of samples demonstrating diverse solid operations such as imprinting, sweeping, spinning, thickening, blending, and booleans. |
| Surfaces | Surface_Panelization.py | Provides a PyQt5 interface to tile a selected surface with custom motifs that can be extruded into solids normal to the surface. |
| Surfaces | SurfaceCreateTool.py | Implements an interactive tool that allows users to create a new surface element by sweeping a profile along a selected path. |
| Table | TextTableSample.py | Provides a PyQt5-based user interface to create, populate, and interactively modify text table elements in the design model. |
| Text | CreateTextNodes.py | Shows how to programmatically define text properties and create formatted multi-line text node elements in a DGN model. |
| Text | EditTextElement.py | Implements an interactive tool that opens a Tkinter dialog to allow users to modify the text content of a selected element. |
| Text | IncrementText.py | Implements a tool that identifies numeric substrings in text elements, increments them by one, and places the updated text. |
| Text | ModifyTextTool.py | Defines a tool using DgnElementSetTool that toggles the text case of selected text or text node elements. |
| Text | TextExample.py | Demonstrates programmatically creating text elements and text node elements using several different predefined text styles. |
| Text | TextExampleCreateText.py | Shows the programmatic creation of single-line heading text and multi-line text node elements in a design model. |
| Text | TextExampleCreateTextStyles.py | Demonstrates how to programmatically define and add multiple custom text styles with varied properties to the DGN file. |
| Units | UnitConversionsSample.py | Shows how to programmatically convert distance values between different standard units based on the active DGN model's definitions. |
| View | ExampleViewTool.py | Implements a custom viewing tool using DgnViewTool that centers the view on a point and zooms in by a set factor. |
| View | SaveViewportToImage.py | Captures the current view as an RGBA buffer and saves it as a PNG file in a temporary local directory. |
| View | ViewCallbacks.py | Demonstrates registering callbacks for view-related events such as updates, cursor motions, and element substitution. |
| View | ViewGroupExample.py | Provides a PyQt5 user interface for managing view groups, including adding, deleting, and activating different view configurations. |
| View | ViewInfoExample.py | Uses PyQt5 to display detailed information about views and demonstrates resetting view geometry and coordinate systems. |
| View | ViewToImageFile.py | Demonstrates saving the currently active view as an image file in various formats such as PNG, JPG, or TIFF. |
| View | ViewToolExample.py | Provides an interactive PyQt5 tool to specify exact pixel dimensions or ratios for standard views to generate precise raster images. |
| View | ViewToPDF.py | Initializes a print description for the current view and generates a PDF plot file saved to a temporary local directory. |
| Visualization | GlassColorDarkerToLighter.py | Adjusts the color of glass panels in a gradient from darker to lighter based on their vertical or horizontal position. |
| Visualization | GlassColorRandom.py | Identifies glass panel elements and applies random color and transparency values to them for visualization purposes. |
| Visualization | GlassColorWithQtDialog.py | Provides a PyQt5 interface to interactively apply color gradients to glass panel elements using a custom UI slider and color picker. |