Now my py. file need auto read data, so I put the py. file at data file directory. but now .scdoc also need in the directory file. So how to use code open SCDM .scdoc file and read py. file?
@Helen You can open a .scdoc in pyprimemesh. https://prime.docs.pyansys.com/version/stable/api/_autosummary/ansys.meshing.prime.FileIO.import_cad.html
It seems like you want to open and read both an .scdoc file and a .py file from the same directory in your Python script. You can use the open function to open and read files in Python. Here's an example of how you can achieve this:
import os
current_directory = os.path.dirname(os.path.realpath(file))
scdoc_filename = "your_file.scdoc" py_filename = "your_file.py"
scdoc_path = os.path.join(current_directory, scdoc_filename) py_path = os.path.join(current_directory, py_filename)
with open(scdoc_path, 'r') as scdoc_file: scdoc_content = scdoc_file.read() # Process the content as needed
with open(py_path, 'r') as py_file: py_content = py_file.read() # Process the content as needed