RoboDK Forum
Add a shape as a tool using the python API- Printable Version

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: Add a shape as a tool using the python API (/Thread-Add-a-shape-as-a-tool-using-the-python-API)



Add a shape as a tool using the python API-hoolymama-06-28-2018

Hi,

I have some code to create a shape:
shape = RDK.AddShape(triangles)

And I know how to create a tool:
robot.AddTool(mat, name)

But I can't work out how to make the shape become the tool. I want the same result as dragging the shape to the robot in the UI, but I need to use the API.

Thanks!


再保险:添加一个形状作为一种工具使用python API-hoolymama-06-29-2018

I found it...

tool_item = robot.AddTool(robodk.Mat(mat))
shape = RDK.AddShape(triangles)
tool_item.AddGeometry(shape, robodk.eye())
shape.Delete()