Welcome to the world of MicroStation Python! This wiki will guide you through creating your first Python program in MicroStation, a leading computer-aided design software for infrastructure design.
Let us dive into creating a simple "Hello World!" program in Python.
To create a new Python project in the Python Manager, click the Create a New Python Project icon and name it "HelloWorld.py". Save it to your preferred directory.
Within the Python Manager, locate your project "HelloWorld.py" in the project list. Click the Edit Python File icon to open the editor for writing your Python script.
The import datetime line brings in the datetime module, offering functions to work with dates and times.
import datetime
The print statements display text to the console "MicroStation - Text Window". Copy or type the following code into editor. Save the "HelloWorld.py" project.
import datetime # print print("Hello World!") # print variables s1 = "Hello" s2 = "World!" print(s1 + ", " + s2) # print current date with f-strings today = datetime.datetime.today() print(f"{today:%B %d, %Y}")
Select project "HelloWorld.py" from the Python Manager dialog and click on icon to Run/Execute the python script.
"MicroStation - Text Window" displays the output of your script.
Congratulations! You've just run your first Python program.
To delve deeper into Python programming in MicroStation, check out the following wikis:
These resources will provide you with more examples and detailed API documentation to help you on your journey with MicroStation Python.
Happy coding!
Python: Documentation | API Presentations | FAQs | GitHub | Samples | Wikis | Blogs