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

How to add comments through ProgEvents

#1
How can I add comments to a program's event via API? When I set the event Path Approach through the API it would always default to 'program call'. When I set the event through RoboDK itself I have the option to choose what instruction it should be. I want to do that through the API.

When I extract the ProgEvents with SetParam I can see the event's value starts with 3 and then the comment. I tried setting the events with the same values that I extracted. but in RoboDK it treats it like a 'program call' with a 3 at the start.

Code:
var progEvents = JsonConvert.DeserializeObject<JObject>(projectSettings.SetParam("ProgEvents"));

progEvents["CallRetract"] = "3approach started";

projectSettings.SetParam("ProgEvents", JsonConvert.SerializeObject(progEvents));
#2
To insert comments in the program events using the API you should use the tab symbol (\t) after the number 3. The index (number 3) is the order in the dropdown you can see in the options menu.

This is a working example in Python:
Code:
item = RDK.Item('Machining Project 1')
ProgEvents = item.setParam("ProgEvents")
ProgEvents["CallRetract"] = "3\tYour comment"
item.setParam("ProgEvents", ProgEvents)
  




Users browsing this thread:
1 Guest(s)