Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Sanity Check! Tool Offsets: G10 P0 X...

    Scheduled Pinned Locked Moved
    General Discussion
    1
    2
    150
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DocTruckerundefined
      DocTrucker
      last edited by

      Hi All,

      Looking to implement a little meta coding object to repeat a specific pattern a number of times from an offset based on the current head position.

      Is the following current best practice for that procedure?

      • Read current head position from object model.
      • Read current G10 P0 offset from object model.
      • Apply appropriate offset to the G10 P0 values to make the current position position X=0, Y=0.
      • Run print job with M98 P"build-name.gcode" (Is this any worse than using the specific start build gcode?)
        ...Move head, repeat...

      I believe that is better than resetting the position using G92 as it doesn't invalidate any bed probing?

      Cheers.

      Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

      1 Reply Last reply Reply Quote 0
      • DocTruckerundefined
        DocTrucker
        last edited by

        So this is the test macro (that works):

        var tool_num = 0
        
        var num_x_pattern = 3
        var num_y_pattern = 2
        
        var x_pattern_space = 50.0
        var y_pattern_space = 25.0
        
        var int_x = move.axes[0].machinePosition
        var int_y = move.axes[1].machinePosition
        
        var initial_x_offset = tools[var.tool_num].offsets[0]
        var initial_y_offset = tools[var.tool_num].offsets[0]
        
        while true
        	if iterations = (var.num_x_pattern * var.num_y_pattern)
        		break
        	else
        		var x_i = mod(iterations, var.num_x_pattern)
        		var y_i = ((iterations-var.x_i)/var.num_x_pattern)
        		var x_pos = var.int_x + (var.x_i * var.x_pattern_space)
        		var y_pos = var.int_y + (var.y_i * var.y_pattern_space)
        		G10 P0 X{(-1 * var.x_pos)} Y{(-1 * var.y_pos)}
        		G1 X0 Y0 F6000
        		G1 X10 Y10 F600
        		continue 
        
        G10 P0 X{(-1 * var.initial_x_offset)} Y{(-1 * var.initial_y_offset)}
        G1 X{var.int_x} Y{var.int_y} F6000
        

        I would be replacing the following lines with a call to run a build file:

        		G1 X0 Y0 F6000
        		G1 X10 Y10 F600
        

        Does this seem the sensible approach?

        Running 3 P3Steel with Duet 2. Duet 3 on the shelf looking for a suitable machine. One first generation Duet in a Logo/Turtle style robot!

        1 Reply Last reply Reply Quote 0
        • DocTruckerundefined DocTrucker referenced this topic
        • DocTruckerundefined DocTrucker referenced this topic
        • DocTruckerundefined DocTrucker referenced this topic
        • First post
          Last post
        Unless otherwise noted, all forum content is licensed under CC-BY-SA