mmAPI Error/Dialog handling

mmAPI Error/Dialog handling

Anonymous
Not applicable
870 Views
2 Replies
Message 1 of 3

mmAPI Error/Dialog handling

Anonymous
Not applicable

Hello,

 

I am currently working on a project where i use mmAPI and Python to automate a repair process for broken .stl files and calculate the boolean difference of repaired meshes. With the help of various @Anonymous posts i managed to accomplish this. I sometimes run into dialogs when trying to save a mesh (see attached picture) or errors when for example the boolean difference calculation failed. My question is: Is there a way to handle those dialogs / errors within my python script without clicking back into meshmixer and manually click "continue"?

Thank you in advance! 🙂

0 Likes
Accepted solutions (1)
871 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

There's no way I know handling such dialogs within mmApi

 

On WIN10 and my Phython3 built of mmApi I do some workaround to handle such cases:

  1. Pass the focus over to MM
  2. Emulate a key (either ENTER or (if needed) ESC)

ad 1: I use pygetwindow library

ad 2: I use keyboard library

 

 

 

 

import pygetwindow as gw
import keyboard

# set focus to Meshmixer
MM = gw.getWindowsWithTitle('Autodesk Meshmixer')[0]
MM.activate()

# hit enter to accept dialog
keyboard.press_and_release('enter')

### alternative: hit esc to cancel dialog
##keyboard.press_and_release('esc')

 

 

 

Message 3 of 3

Anonymous
Not applicable

Thank you for your reply. I didn't think of this. Will definitely try this out. 🙂

0 Likes