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

On Event not adding instructions at each point of a curve follow project (CFP)

#1
When using curve follow project, the "program events" section works fine for "Path start" and "path finish", but the "on action" doesn't add an instruction at each point.  we need to add a line of code at each and every point to keep track of the tool Z orientation at each of those points.

The project is for surface finish of stainless steel and we imported a 3d cad model of the part, extracted a curve then added a CFP for a curve.  Every other "program event" works except "on action".

I tried for code and even for a program, but the path instructions show all the MoveL back to back without the actual additional instruction in between.

What am I missing there ?  Am I misunderstanding the intent behind the "on action" option ?

Thanks in advance !


.jpg   Capture d’écran 2025-02-10 100436.jpg (Size: 52.3 KB / Downloads: 68)
#2
The on action event applies to points only (point follow projects).

If you need to trigger a program call after each single movement I recommend you to create a script to do so.

This example adds a program call to OnPointEvent after every movement:
Code:
from robodk.robolink import *       # API to communicate with RoboDK
from robodk.robodialogs import *    # User prompts

# Enter the program to trigger right after every movement in the program:
ins_call = "OnPointEvent"

RDK = Robolink()

# Ask the user to select a program:
prog = RDK.ItemUserPick("Select a Program to modify", ITEM_TYPE_PROGRAM)
if not prog.Valid():
    print("Operation cancelled or no programs available")
    quit()

# Iterate through all the instructions in a program:
ins_id = 0
ins_count = prog.InstructionCount()
while ins_id < ins_count:
    # Retrieve instruction
    ins_nom, ins_type, move_type, isjointtarget, pose, joints = prog.Instruction(ins_id)
    if ins_type == INS_TYPE_MOVE:
        # Select the movement instruction as a reference
        prog.InstructionSelect(ins_id)
        # Add a new program call
        prog.RunInstruction(ins_call, INSTRUCTION_CALL_PROGRAM)
        # Advance one additional instruction as we just added another instruction
        ins_id = ins_id + 1
        ins_count = ins_count + 1

    ins_id = ins_id + 1
You can find more information and examples here (check example 4):
https://robodk.com/doc/en/PythonAPI/robo...AddProgram
  




Users browsing this thread:
1 Guest(s)