0

I have been trying to access to Microsoft Print 3D from python using "subprocess" package.

What I want to do is to open a set of (.stl) files in the app and extract some information from each of them.

#Path of the program
MS_Print_3D = '... /Applications (Parallels)/{c2916d26-d1f5-414d-b261-d6c91024400d} Applications.localized//Print 3D.app'
#STL 3D file
stl_file = '.../994012.stl'

I got to open and run the program with a selected (.stl) file. However, I do not know how to access to the attributes or the information that are plotted inside the app.

p_run = subprocess.run(["open", "-n", MS_Print_3D, stl_file],
                       stdout=subprocess.PIPE,
                       stderr=subprocess.PIPE,
                       check=True,
                       text=True,
                      )

I used stdout to see if there may be an output. However what I really want to know is if I can access to the information inside the application, software or program I am opening with subprocess.

I just want to know if it may be possible, or if I should use another method.

print('Standard Output:', p_run.stdout)
print('-------------')
print('Standard Error:', p_run.stderr)
print('-------------')
print('Arguments:', p_run.args)
print('-------------')
print('Return Code:', p_run.returncode)
print('-------------')
print('Check Return Code:', p_run.check_returncode)
print('-------------')
Standard Output: 
-------------
Standard Error: 
-------------
Arguments: ['open', '-n', '.../Applications (Parallels)/{c2916d26-d1f5-414d-b261-d6c91024400d} Applications.localized//Print 3D.app', '.../994012.stl']
-------------
Return Code: 0
-------------
Check Return Code: <bound method CompletedProcess.check_returncode of CompletedProcess(args=['open', '-n', '... Applications (Parallels)/{c2916d26-d1f5-414d-b261-d6c91024400d} Applications.localized//Print 3D.app', '...//994012.stl'], returncode=0, stdout='', stderr='')>
-------------
Juanunal
  • 5
  • 1
  • 2
  • Seems like you want to control the UI? This might be useful -> https://stackoverflow.com/a/9997608/12128167 – Sin Han Jinn Dec 18 '20 at 07:41
  • It was super useful your information. Thank you so much. However I think I may have some problems with it because I am working on Mac. So, I will check which one of those can be used on Mac. Thanks again. – Juanunal Jan 04 '21 at 18:41

0 Answers0