Replies: 2 comments 12 replies
-
I had looked into this myself, there’s a module pymouse to simulate mouse clicks, but I don’t know how it can be used. Maybe from a new thread and a timer I had thought about adding default prompts, but then thought they should honor locale. BTW, I want to say, PromptStatus is not always an error, and it could return a kword, but I found that I had a bug in that kwords were ignored This should work in the next release def PyRxCmd_entselkw():
try:
Ed.Editor.initGet(1, "Import Create")
es, id, pnt = Ed.Editor.entSel("\nEnter an option [Import/Create]: ")
if es == Ed.PromptStatus.eKeyword:
input = Ed.Editor.getInput()
match input:
case "Import":
print("\nImport was pressed")
case "Create":
print("\nCreate was pressed")
case _:
print("\nSet a default value")
elif es == Ed.PromptStatus.eNone:
print("\noops try again")
elif es == Ed.PromptStatus.eCancel:
print("\nyou canceled")
elif es == Ed.PromptStatus.eRejected:
print("\nWrong type!")
elif es == Ed.PromptStatus.eOk:
print("\nWoohoo! {} {} {}".format(es,id,pnt))
elif es == Ed.PromptStatus.eError:
print("\nError!")
except Exception:
traceback.print_exc() |
Beta Was this translation helpful? Give feedback.
1 reply
-
I think I found a way to test methods that require user interaction. from pyautogui import write as gui_write
from pyrx import Ed, command
@command
def doit():
gui_write("100,200\n") # queue a command to write coordinates
res = Ed.Editor.getPoint("\nEnter point: ")
print(res)
gui_write('(HANDENT "24D")\n') # queue a command to write a handent
res = Ed.Editor.entSel("\nSelect entity: ")
print(res)
|
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I implement wrapper functions, e.g. for
Ed.Editor.entSel
. Does anyone have an idea how to test them automatically (without user interaction)?Example:
Beta Was this translation helpful? Give feedback.
All reactions