### Configure VSCode settings.json for MicroStation Python Intellisense Source: https://developer.bentley.com/documentation/microstation-python-api/guides/vscodeintellisense Modify your VSCode project's settings.json file to enable Intellisense for the MicroStation Python API. This involves specifying the stub path for function stubs and the extra path for the MicroStation installation directory. Intellisense relies on these paths to provide code completion and contextual information. ```json { "explorer.confirmDelete": false, "python.languageServer": "Default", "python.analysis.stubPath": "C:/ProgramData/Bentley/PowerPlatformPython/Examples/MicroStation/Intellisense", "python.analysis.extraPaths": ["C:/Program Files/Bentley/MicroStation 2024/MicroStation/"] } ``` -------------------------------- ### Path Description and Initialization Methods Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/LineHandler This section includes methods for getting path descriptions and initializing basis for elements. ```APIDOC ## GetPathDescription ### Description Retrieves a description of the path of an element. ### Method GetPathDescription ### Parameters - **eh** (MSPyDgnPlatform.ElementHandle) - The handle of the element. - **string** (MSPyBentley.WString) - The string to store the path description in. - **path** (MSPyDgnPlatform.DisplayPath) - The DisplayPath object. - **levelStr** (str) - The level string. - **modelStr** (str) - The model string. - **groupStr** (str) - The group string. - **delimiterStr** (str) - The delimiter string. ### Response #### Success Response (None) Returns None. ## InitializeBasis ### Description Initializes the basis for an element with a given transform and range. ### Method InitializeBasis ### Parameters - **eeh** (MSPyDgnPlatform.EditElementHandle) - The handle of the element to initialize. - **transform** (MSPyBentleyGeom.Transform) - The transform to apply. - **range** (MSPyBentleyGeom.DRange3d) - The range to set. ### Response #### Success Response (None) Returns None. ``` -------------------------------- ### StoredExpressionEntry Methods Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/StoredExpressionEntry This section details the methods available for the StoredExpressionEntry class, including getting and setting entry labels and names. ```APIDOC ## GetLabel ### Description Get entry label. ### Method GET ### Endpoint `/websites/developer_bentley_microstation-python-api/StoredExpressionEntry/GetLabel` ### Parameters This method does not take any parameters. ### Request Example ```json { "method": "GetLabel", "params": [] } ``` ### Response #### Success Response (200) - **label** (str) - The label of the stored expression entry. #### Response Example ```json { "label": "ExampleLabel" } ``` ## GetName ### Description Get entry name. ### Method GET ### Endpoint `/websites/developer_bentley_microstation-python-api/StoredExpressionEntry/GetName` ### Parameters This method does not take any parameters. ### Request Example ```json { "method": "GetName", "params": [] } ``` ### Response #### Success Response (200) - **name** (str) - The name of the stored expression entry. #### Response Example ```json { "name": "ExampleName" } ``` ## SetLabel ### Description Set entry label. ### Method POST ### Endpoint `/websites/developer_bentley_microstation-python-api/StoredExpressionEntry/SetLabel` ### Parameters #### Request Body - **label** (str) - Required - The label to set for the stored expression entry. ### Request Example ```json { "method": "SetLabel", "params": { "label": "NewLabel" } } ``` ### Response #### Success Response (200) - **status** (int) - Indicates the success of the operation (e.g., 0 for success). #### Response Example ```json { "status": 0 } ``` ## SetName ### Description Set entry name. ### Method POST ### Endpoint `/websites/developer_bentley_microstation-python-api/StoredExpressionEntry/SetName` ### Parameters #### Request Body - **name** (str) - Required - The name to set for the stored expression entry. ### Request Example ```json { "method": "SetName", "params": { "name": "NewName" } } ``` ### Response #### Success Response (200) - **status** (int) - Indicates the success of the operation (e.g., 0 for success). #### Response Example ```json { "status": 0 } ``` ## SetNameAndLabel ### Description Set both the entry name and label. ### Method POST ### Endpoint `/websites/developer_bentley_microstation-python-api/StoredExpressionEntry/SetNameAndLabel` ### Parameters #### Request Body - **name** (str) - Required - The name to set for the stored expression entry. - **label** (str) - Required - The label to set for the stored expression entry. ### Request Example ```json { "method": "SetNameAndLabel", "params": { "name": "NewName", "label": "NewLabel" } } ``` ### Response #### Success Response (200) - **status** (int) - Indicates the success of the operation (e.g., 0 for success). #### Response Example ```json { "status": 0 } ``` ``` -------------------------------- ### Material Manager - GetManager Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/MaterialManager Gets the singleton instance of the MaterialManager. ```APIDOC ## GetManager ### Description Returns the singleton instance of the MaterialManager. This is typically used to access other MaterialManager methods. ### Method (Assumed to be a static or class method call, not a direct HTTP endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python # This is a conceptual representation as it's a method call material_manager = MSPyDgnPlatform.MaterialManager.GetManager() ``` ### Response - **MaterialManager** (MSPyDgnPlatform.MaterialManager) - The singleton instance of the Material Manager. ``` -------------------------------- ### Python Script Setup for Remote Debugging with debugpy Source: https://developer.bentley.com/documentation/microstation-python-api/guides/debuggingpythonapps This Python code snippet should be included in your script to enable remote debugging. It uses the `debugpy` library to listen for a debugger connection on a specified host and port, waits for the client to attach, and sets an initial breakpoint. ```python import debugpy debugpy.listen(('0.0.0.0',5678), in_process_debug_adapter=True) print("Waiting for debugger attach") debugpy.wait_for_client() debugpy.breakpoint() ``` -------------------------------- ### Fraction Class Methods Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/HorizontalBarFraction Methods related to the Fraction class in the MicroStation Python API, including getting and setting alignment, numerator, denominator, and fraction type. ```APIDOC ## GetAlignment /api/Fraction ### Description Gets the alignment of the fraction with other runs in the line. This property is important for vertical alignment within the line. ### Method GET ### Endpoint /api/Fraction/GetAlignment ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **alignment** (StackedFractionAlignment) - The alignment of the fraction. #### Response Example ```json { "alignment": "Default" } ``` ## GetDenominator /api/Fraction ### Description Gets the denominator character stream of the fraction. ### Method GET ### Endpoint /api/Fraction/GetDenominator ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **denominator** (CharStream) - The denominator character stream. #### Response Example ```json { "denominator": "2" } ``` ## GetFractionType /api/Fraction ### Description Gets the type of this fraction, which corresponds to its sub-class type. ### Method GET ### Endpoint /api/Fraction/GetFractionType ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **fractionType** (StackedFractionType) - The type of the fraction. #### Response Example ```json { "fractionType": "Normal" } ``` ## GetNumerator /api/Fraction ### Description Gets the numerator character stream of the fraction. ### Method GET ### Endpoint /api/Fraction/GetNumerator ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **numerator** (CharStream) - The numerator character stream. #### Response Example ```json { "numerator": "1" } ``` ## SetAlignment /api/Fraction ### Description Sets the alignment of the fraction with other runs in the line. ### Method POST ### Endpoint /api/Fraction/SetAlignment ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **newVal** (StackedFractionAlignment) - The new alignment value for the fraction. ### Request Example ```json { "newVal": "Center" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates if the alignment was set successfully. #### Response Example ```json { "status": "Success" } ``` ``` -------------------------------- ### Instance and Curve Methods Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/LineHandler This section covers methods for getting a singleton instance of LineHandler and querying curve vectors. ```APIDOC ## GetInstance ### Description Gets a singleton instance of LineHandler. ### Method GetInstance ### Parameters None ### Response #### Success Response (MSPyDgnPlatform.LineHandler) Returns a LineHandler instance. ## GetCurveVector ### Description Retrieves the curve vector for a given element handle. ### Method GetCurveVector ### Parameters - **eh** (MSPyDgnPlatform.ElementHandle) - The handle of the element. ### Response #### Success Response (tuple) Returns a tuple representing the curve vector. ``` -------------------------------- ### Access Keyin Command Arguments in Python Source: https://developer.bentley.com/documentation/microstation-python-api/guides/developingpythonapps This Python function shows how to access arguments passed to a MicroStation keyin command. Arguments are available in the `sys.argv` list. The example prints the number of arguments and the first argument if available. ```python import sys def myCommandFn(): print (len(sys.argv)) if (len(sys.argv) > 0): print (sys.argv[0]) ``` -------------------------------- ### Create and Manipulate 3D Geometry with Python in MicroStation Source: https://context7.com/context7/developer_bentley_microstation-python-api/llms.txt Provides examples of creating and manipulating 3D geometric primitives using the MicroStation geometry API. This includes defining 3D points, creating a bounding range by extending it with points, and constructing a transformation matrix involving rotation around the Z-axis and translation. ```python import MSPyBentleyGeom as geom # Create 3D points origin = geom.DPoint3d(0, 0, 0) point1 = geom.DPoint3d(100, 0, 0) point2 = geom.DPoint3d(100, 100, 0) point3 = geom.DPoint3d(0, 100, 0) # Create bounding range range3d = geom.DRange3d() range3d.Init() range3d.Extend(origin) range3d.Extend(point1) range3d.Extend(point2) range3d.Extend(point3) print(f"Range: Low({range3d.low.x}, {range3d.low.y}, {range3d.low.z})") print(f" High({range3d.high.x}, {range3d.high.y}, {range3d.high.z})") # Create transformation matrix transform = geom.Transform.FromIdentity() # Apply rotation around Z axis (45 degrees) angleRadians = geom.Angle.DegreesToRadians(45.0) rotMatrix = geom.RotMatrix.FromAxisAndRotationAngle(2, angleRadians) # Z-axis = 2 transform.SetMatrix(rotMatrix) # Apply translation translation = geom.DVec3d(50, 50, 0) transform.SetTranslation(translation) ``` -------------------------------- ### Create Line Element Source: https://context7.com/context7/developer_bentley_microstation-python-api/llms.txt Creates a new line element in a DGN file using specified start and end points. ```APIDOC ## Create Line Element ### Description Creates a new line element in a DGN file with specified start and end points. ### Method POST (Implicit, as it creates an element) ### Endpoint /dgn/elements/line ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **startPoint** (object) - Required - The starting point of the line segment (e.g., `{"x": 0, "y": 0, "z": 0}`). - **endPoint** (object) - Required - The ending point of the line segment (e.g., `{"x": 100, "y": 100, "z": 0}`). - **is3D** (boolean) - Optional - Specifies if the element is 3D (defaults to true). - **modelReference** (object) - Required - Reference to the DGN model where the element will be created. ### Request Example ```json { "startPoint": {"x": 0, "y": 0, "z": 0}, "endPoint": {"x": 100, "y": 100, "z": 0}, "is3D": true } ``` ### Response #### Success Response (200) - **elementId** (string) - The ID of the newly created line element. #### Response Example ```json { "elementId": "12345" } ``` ``` -------------------------------- ### Register Python Key-in Commands in MicroStation Source: https://context7.com/context7/developer_bentley_microstation-python-api/llms.txt Registers custom key-in commands in MicroStation using Python. This involves defining handler functions and an XML file to map key-in names to these functions. The example shows how to access command arguments and interact with the active DGN model. ```python import os import sys import MSPyMstnPlatform as mstn from MSPyBentley import WString # Define keyin handler functions def customCommand(): """Handler for custom keyin command""" # Access command arguments if len(sys.argv) > 0: arg = sys.argv[0] print(f"Custom command executed with argument: {arg}") else: print("Custom command executed with no arguments") # Get active model and perform operations modelRef = mstn.ISessionMgr.GetActiveDgnModelRef() modelName = modelRef.GetDgnModel().GetModelName() print(f"Active model: {modelName}") def analyzeModel(): """Analyzes current model and reports statistics""" modelRef = mstn.ISessionMgr.GetActiveDgnModelRef() # Count elements elementCount = 0 for _ in modelRef.GetDgnModel().GetGraphicElements(): elementCount += 1 print(f"Model contains {elementCount} graphic elements") # Register keyins from XML file # Create commands XML file with keyin definitions pythonFile = __file__ commandsXml = os.path.join(os.path.dirname(__file__), 'mycommands.commands.xml') # Load command table manager = mstn.PythonKeyinManager.GetManager() status = manager.LoadCommandTableFromXml( WString(pythonFile), WString(commandsXml) ) if status == mstn.BentleyStatus.eSUCCESS: print("Commands registered successfully") else: print("Failed to register commands") # Example commands.xml content: # # # # CUSTOM CMD # # # ANALYZE MODEL # # ``` -------------------------------- ### Create Custom Interactive Line Drawing Tool in Python Source: https://context7.com/context7/developer_bentley_microstation-python-api/llms.txt This Python code defines a custom tool for MicroStation that allows users to draw lines interactively. It handles user input for start and end points, creates a line element, and provides feedback via the message center. It requires the MSPyDgnView, MSPyBentleyGeom, MSPyDgnPlatform, and MSPyMstnPlatform modules. ```python import MSPyDgnView as view import MSPyBentleyGeom as geom import MSPyDgnPlatform as dgn import MSPyMstnPlatform as mstn class CustomLineTool(view.DgnPrimitiveTool): """Custom tool for drawing lines with user interaction""" def __init__(self): view.DgnPrimitiveTool.__init__(self) self.startPoint = None self.acceptedPoints = [] def OnPostInstall(self): """Called when tool is activated""" mstn.MessageCenter.Instance().ShowStatusMessage("Select start point") return True def OnDataButton(self, ev): """Called when user clicks data button""" # Get point from button event point = ev.GetPoint() if self.startPoint is None: # First point - store as start self.startPoint = point self.acceptedPoints.append(point) mstn.MessageCenter.Instance().ShowStatusMessage("Select end point") else: # Second point - create line endPoint = point self.acceptedPoints.append(endPoint) # Create line element segment = geom.DSegment3d(self.startPoint, endPoint) eeh = dgn.EditElementHandle() modelRef = mstn.ISessionMgr.GetActiveDgnModelRef() status = dgn.LineHandler.CreateLineElement( eeh, None, segment, True, modelRef ) if status == dgn.BentleyStatus.eSUCCESS: eeh.AddToModel() mstn.MessageCenter.Instance().ShowInfoMessage("Line created") # Reset for next line self.startPoint = endPoint mstn.MessageCenter.Instance().ShowStatusMessage("Select end point") return True def OnResetButton(self, ev): """Called when user clicks reset button""" # Cancel tool self.ExitTool() return True def OnDynamicFrame(self, ev): """Called during cursor motion for dynamic preview""" if self.startPoint is not None: # Draw temporary line from start to cursor cursorPoint = ev.GetPoint() # Use view context to draw temporary graphics # (Implementation depends on graphics context API) return True # Install tool def InstallCustomTool(): tool = CustomLineTool() tool.InstallTool() ``` -------------------------------- ### Run Class Methods Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/HorizontalBarFraction Methods related to the Run class in the MicroStation Python API, including getting run properties and converting a run to a string representation. ```APIDOC ## GetProperties /api/Run ### Description Gets the properties for this run. ### Method GET ### Endpoint /api/Run/GetProperties ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **properties** (RunProperties) - The properties of the run. #### Response Example ```json { "properties": { "color": "Red", "lineStyle": "Solid" } } ``` ## ToString /api/Run ### Description Creates a simple string representation of this run. Non CharStream runs will encode themselves as a string. ### Method GET ### Endpoint /api/Run/ToString ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **representation** (WString) - The string representation of the run. #### Response Example ```json { "representation": "Sample Run Text" } ``` ``` -------------------------------- ### Display Handler Methods Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/LineHandler This section details various methods associated with the DisplayHandler class in MSPyDgnPlatform, including getting orientation, snap origin, and transform origin. ```APIDOC ## GetOrientation ### Description Gets the orientation of an element. ### Method GetOrientation ### Parameters - **eh** (MSPyDgnPlatform.ElementHandle) - The handle of the element. - **orientation** (MSPyBentleyGeom.RotMatrix) - The RotMatrix to store the orientation in. ### Response #### Success Response (None) Returns None. ## GetSnapOrigin ### Description Gets the snap origin of an element. ### Method GetSnapOrigin ### Parameters - **eh** (MSPyDgnPlatform.ElementHandle) - The handle of the element. - **origin** (MSPyBentleyGeom.DPoint3d) - The DPoint3d to store the origin in. ### Response #### Success Response (None) Returns None. ## GetTransformOrigin ### Description Gets the transform origin of an element. ### Method GetTransformOrigin ### Parameters - **eh** (MSPyDgnPlatform.ElementHandle) - The handle of the element. - **origin** (MSPyBentleyGeom.DPoint3d) - The DPoint3d to store the origin in. ### Response #### Success Response (None) Returns None. ## IsPlanar ### Description Checks if an element is planar. ### Method IsPlanar ### Parameters - **eh** (MSPyDgnPlatform.ElementHandle) - The handle of the element. - **normal** (MSPyBentleyGeom.DVec3d) - The DVec3d to store the normal if planar. - **point** (MSPyBentleyGeom.DPoint3d) - The DPoint3d to store a point on the plane if planar. - **inputDefaultNormal** (MSPyBentleyGeom.DVec3d) - The default normal to use if the element is not planar. ### Response #### Success Response (bool) Returns True if the element is planar, False otherwise. ## IsRenderable ### Description Checks if an element is renderable. ### Method IsRenderable ### Parameters - **eh** (MSPyDgnPlatform.ElementHandle) - The handle of the element. ### Response #### Success Response (bool) Returns True if the element is renderable, False otherwise. ## IsVisible ### Description Checks if an element is visible in the current view context. ### Method IsVisible ### Parameters - **eh** (MSPyDgnPlatform.ElementHandle) - The handle of the element. - **context** (MSPyDgnPlatform.ViewContext) - The view context to check against. - **testRange** (bool) - Whether to test the element's range. - **testLevel** (bool) - Whether to test the element's level visibility. - **testClass** (bool) - Whether to test the element's class visibility. ### Response #### Success Response (bool) Returns True if the element is visible, False otherwise. ## SetBasisRange ### Description Sets the basis range for an element. ### Method SetBasisRange ### Parameters - **eeh** (MSPyDgnPlatform.EditElementHandle) - The handle of the element to modify. - **range** (MSPyBentleyGeom.DRange3d) - The DRange3d to set as the basis range. ### Response #### Success Response (None) Returns None. ## SetBasisTransform ### Description Sets the basis transform for an element. ### Method SetBasisTransform ### Parameters - **eeh** (MSPyDgnPlatform.EditElementHandle) - The handle of the element to modify. - **transform** (MSPyBentleyGeom.Transform) - The Transform to set as the basis transform. ### Response #### Success Response (None) Returns None. ``` -------------------------------- ### Create Line Element in MicroStation DGN Source: https://context7.com/context7/developer_bentley_microstation-python-api/llms.txt This snippet demonstrates how to create a new line element within a DGN file using the MicroStation Python API. It requires the `MSPyBentleyGeom` and `MSPyDgnPlatform` modules. The function takes start and end points, defines a line segment, and adds the element to the specified model. Error handling for file opening and element creation is included. ```python import MSPyBentleyGeom as geom import MSPyDgnPlatform as dgn # Open DGN file and get model reference dgnFile = dgn.DgnDocument.FindByFileName("example.dgn") if dgnFile is None: print("Failed to open file") else: modelRef = dgnFile.GetDefaultModelRef() # Define line segment from (0,0,0) to (100,100,0) startPoint = geom.DPoint3d(0, 0, 0) endPoint = geom.DPoint3d(100, 100, 0) segment = geom.DSegment3d(startPoint, endPoint) # Create line element eeh = dgn.EditElementHandle() status = dgn.LineHandler.CreateLineElement( eeh, None, # No template element, use defaults segment, True, # 3D element modelRef ) if status == dgn.BentleyStatus.eSUCCESS: # Add element to model eeh.AddToModel() print(f"Line element created successfully") else: print(f"Failed to create line element: {status}") ``` -------------------------------- ### Material Manager - CreateEmptyPalFile Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/MaterialManager Creates an empty palette file. ```APIDOC ## CreateEmptyPalFile ### Description Creates an empty palette file. ### Method (Assumed to be a method call within a Python class, not a direct HTTP endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python # This is a conceptual representation as it's a method call material_manager.CreateEmptyPalFile(moniker=my_document_moniker) ``` ### Response (Return type not explicitly specified in the provided text, likely status or void.) ``` -------------------------------- ### Get Fraction Type - MicroStation Python API Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/HorizontalBarFraction Gets the type of the fraction, which corresponds to its sub-class type. A dynamic_cast would also achieve this. ```python def GetFractionType(self: MSPyDgnPlatform.Fraction) -> MSPyDgnPlatform.StackedFractionType: """Gets the type of this fraction. @note This directly corresponds to the sub-class type, so a dynamic_cast would also suffice.""" pass ``` -------------------------------- ### LevelHandle - Get Name Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/EditLevelHandle Retrieves the name of the level. ```APIDOC ## GetName /api/websites/developer_bentley_microstation-python-api ### Description Get the name of this level. May be NULL. ### Method GET ### Endpoint /api/websites/developer_bentley_microstation-python-api ### Parameters #### Query Parameters - **levelHandle** (MSPyDgnPlatform.LevelHandle) - Required - The LevelHandle object. ### Response #### Success Response (200) - **name** (str) - The name of the level. #### Response Example ```json { "name": "Default" } ``` ``` -------------------------------- ### MSPyBentley - Core Utilities Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyMstnPlatformModule/PlotStartStopCmd This section covers fundamental utility classes and functions for string manipulation, file handling, date/time operations, and basic data structures within the MicroStation Python API. ```APIDOC ## MSPyBentley Core Utilities ### Description Provides essential utility classes for string operations, file management, date/time handling, and basic data structures. ### Classes - **AString**: Represents a string object. - **AStringArray**: Represents an array of AString objects. - **Base64Utilities**: Utilities for Base64 encoding and decoding. - **BeDateTime**: Represents a date and time object. - **BeDateTimeInfo**: Information about a BeDateTime object. - **BeFile**: Utilities for file operations. - **BeFileAccess**: File access control. - **BeFileAttributes**: File attributes. - **BeFileListIterator**: Iterator for file lists. - **BeFileName**: Represents a file name. - **BeFileNameAccess**: File name access control. - **BeFileNameStatus**: Status of a file name operation. - **BeFileSeekOrigin**: Origin for file seeking. - **BeFileSharing**: File sharing options. - **BeFileStatus**: Status of a file operation. - **BeStringUtilities**: General string utility functions. - **BeTextFile**: Utilities for text file operations. - **BoolArray**: Represents an array of boolean values. - **DoubleArray**: Represents an array of double-precision floating-point numbers. - **DoubleFormatter**: Formats double-precision numbers. - **DoubleFormatterBase**: Base class for double formatters. - **DsigAnnotationData**: Data for digital signature annotations. - **DsigQuery**: Query for digital signatures. - **FloatArray**: Represents an array of single-precision floating-point numbers. - **HeapZone**: Represents a heap zone. - **HexFormatOptions**: Options for hexadecimal formatting. - **Int16Array**: Represents an array of 16-bit integers. - **Int32Array**: Represents an array of 32-bit integers. - **Int64Array**: Represents an array of 64-bit integers. - **Int64VecArray**: Represents a vector array of 64-bit integers. - **Int8Array**: Represents an array of 8-bit integers. - **ItemsView_WStringWCharMap**: View for WString-WChar map items. - **ItemsView_WStringWStringMap_**: View for WString-WString map items. - **KeysView_WStringWCharMap_**: View for WString-WChar map keys. - **KeysView_WStringWStringMap_**: View for WString-WString map keys. - **LangCodePage**: Language code page information. - **PrecisionFormat**: Formatting for precision values. - **PrecisionType**: Type of precision. - **PyNameSpaceManager**: Manages Python namespaces. - **TextFileEncoding**: Text file encoding options. - **TextFileOpenType**: Type for opening text files. - **TextFileOptions**: Options for text file operations. - **TextFileReadStatus**: Status of text file reading. - **TextFileWriteStatus**: Status of text file writing. - **UInt16Array**: Represents an array of unsigned 16-bit integers. - **UInt32Array**: Represents an array of unsigned 32-bit integers. - **UInt64Array**: Represents an array of unsigned 64-bit integers. - **UInt64VecArray**: Represents a vector array of unsigned 64-bit integers. - **UInt8Array**: Represents an array of unsigned 8-bit integers. - **Utf8String**: Represents a UTF-8 encoded string. - **Utf8StringArray**: Represents an array of Utf8String objects. - **ValuesView_WStringWCharMap_**: View for WString-WChar map values. - **ValuesView_WStringWStringMap_**: View for WString-WString map values. - **WCharArray**: Represents an array of wide characters. - **WString**: Represents a wide string. - **WStringArray**: Represents an array of WString objects. - **WStringWCharMap**: Map between WString and WChar. - **WStringWStringMap**: Map between two WStrings. ``` -------------------------------- ### MSPyBentley - Overview Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/StoredExpressionEntry The MSPyBentley namespace provides core utility classes for interacting with MicroStation's Python environment. ```APIDOC ## MSPyBentley Namespace ### Description Provides fundamental classes for MicroStation Python API development, including string manipulation, file handling, date/time utilities, and data structures. ### Key Classes - **AString**: Represents a MicroStation string. - **BeDateTime**: Handles date and time information. - **BeFile**: Utilities for file operations. - **BeStringUtilities**: Common string manipulation functions. - **Utf8String**: Represents a UTF-8 encoded string. ### Example Usage ```python from MSPyBentley import AString, Utf8String my_string = AString("Hello, MicroStation!") utf_string = Utf8String(my_string.ToJson()) print(utf_string.ToJson()) ``` ``` -------------------------------- ### MSPyBentleyGeom Overview Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/IParametricCellDefEventListener Overview of the MSPyBentleyGeom module, containing classes for geometric entities and operations. ```APIDOC ## MSPyBentleyGeom Module ### Description Provides classes and functions for defining and manipulating geometric entities within MicroStation. ### Core Geometric Types - **DPoint2d**: Represents a 2D point. - **DPoint3d**: Represents a 3D point. - **DVec2d**: Represents a 2D vector. - **DVec3d**: Represents a 3D vector. - **DRange3d**: Represents a 3D bounding box. - **RotMatrix**: Represents a 3x3 rotation matrix. - **Transform**: Represents a 4x4 transformation matrix. ### Curve and Surface Types - **MSBsplineCurve**: Represents a B-spline curve. - **MSBsplineSurface**: Represents a B-spline surface. - **ICurvePrimitive**: Interface for curve primitives. ### Utility Classes - **Angle**: Represents an angle. - **ClipPlane**: Represents a clipping plane. - **GeoPoint**: Represents a geographic point. - **PolyfaceHeader**: Represents a polygonal mesh. - **SolidPrimitiveType**: Enum for solid primitive types. ``` -------------------------------- ### LevelHandle - Get Transparency Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/EditLevelHandle Retrieves the display transparency of the level. ```APIDOC ## GetTransparency /api/websites/developer_bentley_microstation-python-api ### Description Get the level display transparency. ### Method GET ### Endpoint /api/websites/developer_bentley_microstation-python-api ### Parameters #### Query Parameters - **levelHandle** (MSPyDgnPlatform.LevelHandle) - Required - The LevelHandle object. ### Response #### Success Response (200) - **transparency** (float) - The display transparency of the level (0.0 to 1.0). #### Response Example ```json { "transparency": 0.5 } ``` ``` -------------------------------- ### LevelHandle - Get Hidden Status Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/EditLevelHandle Queries if a level is hidden. ```APIDOC ## GetHidden /api/websites/developer_bentley_microstation-python-api ### Description Query if this level is hidden, i.e., should not be shown to the user. ### Method GET ### Endpoint /api/websites/developer_bentley_microstation-python-api ### Parameters #### Query Parameters - **levelHandle** (MSPyDgnPlatform.LevelHandle) - Required - The LevelHandle object. ### Response #### Success Response (200) - **hidden** (bool) - True if the level is hidden, false otherwise. #### Response Example ```json { "hidden": false } ``` ``` -------------------------------- ### VSCode launch.json Configuration for Remote Python Debugging Source: https://developer.bentley.com/documentation/microstation-python-api/guides/debuggingpythonapps This JSON configuration is added to the `launch.json` file within the `.vscode` directory in your project. It tells VSCode how to connect to a running Python process using the `debugpy` library, specifying the host and port for the connection. ```json { "name": "Python: Remote Attach", "type": "python", "request": "attach", "host": "127.0.0.1", "port": 5678 } ``` -------------------------------- ### MSPyBentley Overview Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/IParametricCellDefEventListener Overview of the MSPyBentley module, which provides fundamental data types and utilities for MicroStation Python development. ```APIDOC ## MSPyBentley Module ### Description Provides core data structures and utility functions for MicroStation Python applications. ### Classes - **AString**: Represents a MicroStation string. - **AStringArray**: An array of AString objects. - **Base64Utilities**: Utilities for Base64 encoding and decoding. - **BeDateTime**: Represents a date and time value. - **BeFile**: Utilities for file operations. - **BeStringUtilities**: General string manipulation utilities. - **BoolArray**: An array of boolean values. - **DoubleArray**: An array of double-precision floating-point numbers. - **Int32Array**: An array of 32-bit integers. - **Int64Array**: An array of 64-bit integers. - **UInt32Array**: An array of unsigned 32-bit integers. - **UInt64Array**: An array of unsigned 64-bit integers. - **Utf8String**: Represents a UTF-8 encoded string. - **Utf8StringArray**: An array of Utf8String objects. - **WCharArray**: An array of wide characters. - **WString**: Represents a wide character string. - **WStringArray**: An array of WString objects. ``` -------------------------------- ### LevelHandle - Get Status Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/EditLevelHandle Returns the error status if the LevelHandle is invalid. ```APIDOC ## GetStatus /api/websites/developer_bentley_microstation-python-api ### Description Returns non-zero error status if this is an invalid handle. The status indicates why the level cache operation that produced this handle failed. ### Method GET ### Endpoint /api/websites/developer_bentley_microstation-python-api ### Parameters #### Query Parameters - **levelHandle** (MSPyDgnPlatform.LevelHandle) - Required - The LevelHandle object. ### Response #### Success Response (200) - **status** (MSPyDgnPlatform.LevelCacheErrorCode) - The error status code. 0 indicates a valid handle. #### Response Example ```json { "status": 0 } ``` ``` -------------------------------- ### LevelHandle - Get Read Only Status Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/EditLevelHandle Queries if the level is set to read-only. ```APIDOC ## GetReadOnly /api/websites/developer_bentley_microstation-python-api ### Description Query if this level should not be modified. ### Method GET ### Endpoint /api/websites/developer_bentley_microstation-python-api ### Parameters #### Query Parameters - **levelHandle** (MSPyDgnPlatform.LevelHandle) - Required - The LevelHandle object. ### Response #### Success Response (200) - **readOnly** (bool) - True if the level is read-only, false otherwise. #### Response Example ```json { "readOnly": false } ``` ``` -------------------------------- ### LevelHandle - Get Plot Style Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/EditLevelHandle Retrieves the plot style for the level. ```APIDOC ## GetPlotStyle /api/websites/developer_bentley_microstation-python-api ### Description Get the PlotStyle for this level. ### Method GET ### Endpoint /api/websites/developer_bentley_microstation-python-api ### Parameters #### Query Parameters - **levelHandle** (MSPyDgnPlatform.LevelHandle) - Required - The LevelHandle object. ### Response #### Success Response (200) - **plotStyle** (MSPyDgnPlatform.LevelDefinitionPlotStyle) - The LevelDefinitionPlotStyle object. #### Response Example ```json { "plotStyle": { "name": "Default Plot Style" } } ``` ``` -------------------------------- ### LevelHandle - Get Plot Status Source: https://developer.bentley.com/documentation/microstation-python-api/apireference/MSPyDgnPlatformModule/EditLevelHandle Queries if elements on a level should be plotted. ```APIDOC ## GetPlot /api/websites/developer_bentley_microstation-python-api ### Description Query if elements on this level should be plotted. ### Method GET ### Endpoint /api/websites/developer_bentley_microstation-python-api ### Parameters #### Query Parameters - **levelHandle** (MSPyDgnPlatform.LevelHandle) - Required - The LevelHandle object. ### Response #### Success Response (200) - **plot** (bool) - True if elements on the level should be plotted, false otherwise. #### Response Example ```json { "plot": true } ``` ```