Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Show/Hide Simulation Event

#1
Is there a way to add a simulation event to a program via Python API that will hide/show an object?

I'm thinking about using something like the following but I don't know how to call the object and the action (show/hide):

Code:
ins_event_show ={“类型”:INS_TYPE_EVENT,”性能r': EVENT_SHOW, 'Item': robot}

program = RDK.Item('My_Program', ITEM_TYPE_PROGRAM)
program.setParam("Add", ins_event_show)

Any thoughts?
#2
This is possible by using the ObjectList entry in the dictionary and a list of pointers as a string.

Example:
Code:
EVENT_SHOW=2
EVENT_HIDE=3

ObjectList = ""
for item in items:
ObjectList += str(item.item) + ","

ins_event_show ={“类型”:INS_TYPE_EVENT,”性能r': EVENT_SHOW, 'ObjectList': ObjectList}

program = RDK.Item('My_Program', ITEM_TYPE_PROGRAM)
program.setParam("Add", ins_event_show)
#3
Thank you Albert!

Is the ObjectList entry just a list of strings that represent the name of the object I want to hide/show?

I'm able to create a hide/show event in the simulation via the API but it unfortunately remains undefined and does not actually have the item I want selected.

I assume I'm doing something wrong with the ObjectList entry. Here's what the dictionary looks like that I pass into the setParam method:

show_instruction: {'Type': 7, 'Behavior': 2, 'ObjectList': ['Fanuc-M-20iD-35-Leg-1']}

There is a robot with that name in the station at the time of program creation.
#4
The item list should be a list of pointers as a string, separated by comma. The code I shared should give you the item pointer (item.item) and convert to a string.

You can read what a show or hide event instruction looks like to get an idea.




Users browsing this thread:
1 Guest(s)