It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
I found this thread, and this thread, about capturing a mouse click and its location, and about objects selection, and I was wondering if it is possible to create a procedure, where instead of a plugin, to have a procedure with a similar waiting mode for user to select an object.
Basically I want to make a procedure where it will enable a waiting mode for user to select a pcell instance and pop up a message box with its information.
I've build a procedure's template that pop ups info of already selected instances:
def getPCellInstInfo() :
#pya.LayoutView().current().clear_object_selection()
# waiting mode...
# create check mechanism so the selected objects are only 1
sel_obj = pya.LayoutView().current().object_selection
# remove for-loop - unnecessary for 1 inst
for sel in sel_obj :
lib = sel.inst().cell.pcell_library().name()
name = sel.inst().cell.name
#params = sel.inst().pcell_parameters_by_name()
pya.MessageBox().info("PCell Info", "PCell Lib : " + str(lib) + "\nPCell Name : " + str(name), pya.MessageBox.Ok)
# for
# getPCellInstInfo
Thanks in advance,
Chris
Comments
Hi Chris,
you can wait for a mouse click and when this happens, find the object by searching from this point.
Matthias
Hi Matthias,
It is possible to use something like pya.Plugin().mouse_click_event() inside my code?
Could be possible to give me an example?
Note that I want to avoid creating a plugin button at the layout, but instead to call a procedure-function of an object which is going to wait for a mouse click.
Chris
Hi Chris,
no, there is no blocking function you can call to wait for a mouse click. The UI is event-driven.
Matthias
Ok, thank you Matthias