Hello, we are doing 2D drawings on MicroStation as a team. There are certain errors that can occur in these drawings and ways to correct these errors. I'm trying to write a code that will correct these errors by manipulating the MicroStation application. When I run the code using the Python win32com library from within Visual Studio, I don't receive any errors in the terminal, but there is a part of the code that throws an error, and I can't figure out why. The part where I receive the error is as follows:
(-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147352565), None)
File (file location), line 63, in process_microstation_drawing
model_ref = design_file.Models(0)
^^^^^^^^^^^^^^^^^^^^^
(file location) line 117, in <module>
process_microstation_drawing(file_path)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147352565), None)
I would appreciate it if you could help me find a solution to this issue and guide me on how to correctly manipulate the application using the right library.
I am using MicroStation V8i (Select Series 3) x32 bit and Visual Studio Code [Python(win32com)] x64 bit. I want to create a program that outputs an .EXE. The part of the code where I encounter the error is [def process_microstation_drawing(file_path):]
if file_path.endswith(".dgn"):
microstation = win32com.client.Dispatch("MicroStationDGN.Application")
microstation.OpenDesignFile(file_path)
design_file = microstation.ActiveDesignFile
model_ref = design_file.Models(0)
exterior_walls = []
interior_walls = []
independent_boundaries = []
doors = []
windows = []