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

Python API: robolink.Robolink.AddShape Returns Misleading Error

#1
Check out the following code:

Code:
from robodk import robolink as rl

rdk = rl.Robolink()
my_frame = rdk.Item('my_frame')
my_obj = rdk.Item('my_obj')
pts = [[0,0,0], [0,1,0], [0,1,1]]
add_shape_success = rdk.AddShape(pts, add_to=my_obj)
add_shape_fail = rdk.AddShape(pts, add_to=my_frame)

The last line provokes the following warning message and fails to add an object:
Code:
WARNING: Invalid shape, a 3xN (or 6xN) list of points must be provided (N must be multiple of 3)

The warning message implies that the issue with the failed call is that the format of the points list is not valid. However, the actual issue is that a shape may only be added to an object, not a reference frame.

This can lead to pointless troubleshooting (guess how I know haha).
#2
Good point! Thank you for your feedback. The add_to parameter is misleading in the documentation: it is not the parent item, it is the object you would like to use to attach the geometry.

You can use setParent later on to attach the object to the reference frame.

We'll improve the documentation accordingly.
  




Users browsing this thread:
1 Guest(s)