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

Convert python script into robodk program

#4
Hi,

I think this example of code from our documentation could help you:

Code:
# Turn off rendering (faster)
RDK.Render(False)
prog = RDK.AddProgram('AutoProgram')

# Hide program instructions (optional, but faster)
prog.ShowInstructions(False)

# Retrieve the current robot position:
pose_ref = robot.Pose()

# Iterate through a number of points
for i in range(len(POINTS)):
# add a new target
ti = RDK.AddTarget('Auto Target %i' % (i+1))

# use the reference pose and update the XYZ position
pose_ref.setPos(POINTS[i])
ti.setPose(pose_ref)

# force to use the target as a Cartesian target (default)
ti.setAsCartesianTarget()

# Add the target as a Linear/Joint move in the new program
prog.MoveL (ti)

# Hide the target items from the tree: it each movement still keeps its own target.
# Right click the movement instruction and select "Select Target" to see the target in the tree
program.ShowTargets(False)

# Turn rendering ON before starting the simulation (automatic if we are done)
RDK.Render(True)



Jeremy
Find useful information about RoboDK and its features by visiting ourOnline Documentationand by watching tutorials on ourYoutube Channel.




Messages In This Thread
RE: Convert python script into robodk program - byJeremy- 11-10-2020, 04:09 AM



Users browsing this thread:
1 Guest(s)