Example 3 - Executing a path and set digital output

# This examples demonstrates using motion id to wait for a specific motion to

# finish and set digital output

# Initialize with remote TCP (mode = 1) and constrain 6-DOF remote_tcp = p[-0.3909, -0.519, 0.295, 1.57, 0.0, 0.0] pcs = p[0.0, 0.0, 0.01, 0.0, 0.0, 0.0] mc_initialize(1, remote_tcp, doc = 6)

# Set PCS and add motions mc_set_pcs(pcs) waypoint1 = p[0.05, 0.1, 0.1, 0.0, 0.0, 0.0] waypoint2 = p[0.05, 0.05, 0.1, 0.0, 0.0, 0.0] circle_viapoint1 = p[0.075, 0.1, 0.1, 0.0, 0.0, 0.0] circle_endpoint1 = p[0.1, 0.05, 0.1, 0.0, 0.0, 0.0] speed_factor = 0.25 acc_factor = 0.05 blend_radius = 0.02 id0 = mc_add_linear(waypoint1, acc_factor, speed_factor, blend_radius) id1 = mc_add_linear(waypoint2, acc_factor, speed_factor,blend_radius) id2 = mc_add_circular(circle_viapoint1,circle_endpoint1, acc_factor, speed_factor, blend_radius, mode = 1)

pcs_toolpath = p[0.0, 0.0, 0.02, 0.0, 0.0, 0.0] mc_set_pcs(pcs_toolpath)

path_id = mc_load_path("/programs/myToolPathFile.nc", useFeedRate = True) id3 = mc_add_path(path_id, 1.0, 0.0, 0.0)

# Execute motions to id=id2 and wait for id2 to finish.

# This will execute motions from id0 to id2. mc_run_motion(id2)

# Set digital output set_standard_digital_out(7, True)

# Execute the rest of the motions, in this case, just id3 mc_run_motion()

# Set digital output set_standard_digital_out(7, False)