# Tools to generate tool-paths for measuring printer timing parms. # Last edited on 2021-03-09 14:04:57 by jstolfi import timing_path_IMP import move_parms import path # The procedures in this module generate paths that are suitable for # measuring the dynamic parameters of printers, such as acceleration and # extrusion start/stop times. # # In all procedures, if the parameter {ang} is not zero, the whole path # is rotated by {ang} degrees, so that "horizontal" means "making an # angle of {ang} degrees with the {X} axis", and "vertical" means 90 # degrees CCW from that. # # If the bool {jmp} is false, the moves will all be traces with # parameters {mp_trace}. If {jmp} is true, they will all be jumps with # parameters {mp_jump}. # # In the second case, if the bool {udnoz} is true, a zero-length trace # with paramters {mp_trace} is inserted after every move, so as to force # a nozzle/filament up/down event. That should deposit a round dot of # material whose diameter is proportional to the width of {mp_trace}. # # The parameters {mp_jump} and {mp_trace} should be # {move_parms.Move_Parms} objects). # PATHS WIHT SHORT MOVES def straight(pt, n, d, ang, jmp, udnoz, mp_trace, mp_jump): # Creates a path that consists of {n} horizontal moves of length {d}, # starting at point {pt} The number {n} must be positive. The # # The remaining parameters are as in {full}. # return timing_path_IMP.straight(pt, n, d, ang, jmp, udnoz, mp_trace, mp_jump) def zigzag(pt, n, d, ang, jmp, udnoz, mp_trace, mp_jump): # Creates a path that consists of {n} moves of length {d}, # at 45 degrees, starting at point {pt} and moving horizontally. # Half the moves will be ascending (SW to NE) and half descending (NW to SE). # The number {n} must be nonzero. # return timing_path_IMP.zigzag(pt, n, d, ang, jmp, udnoz, mp_trace, mp_jump) def greek(pt, n, xd, yd, ang, jmp, udnoz, mp_trace, mp_jump): # Creates a path that consists of {n} moves, alternating between horizontal moves of length {xd}, # and {n}vertical moves of length {yd}, starting at point {pt}. The # horizontal moves are always left to right while the vertical ones # alternate between up and down. The number {n} must be non-negative. # return timing_path_IMP.greek(pt, n, xd, yd, ang, jmp, udnoz, mp_trace, mp_jump) def starry(ctr, n, d, bend, jmp, udnoz, mp_trace, mp_jump): # Creates a path that is a closed polygon with {2*n} moves of length {d} # with center at {ctr}. # # The polygon will turn CCW by {180/n + bend} degrees at every even # corner, and by {180/n - bend} degrees at every odd corner. Thus, if # {bend} is 0, the path is a regular polygon. If {bend} is positive # and greater than {180/n}, it will be a star- or sun-like shape with # {n} spikes. The {bend} angle should not get too close to {180}. # return timing_path_IMP.starry(ctr, n, d, bend, jmp, udnoz, mp_trace, mp_jump) def stair(pt, m, nx, xd, ny, yd, ang, jmp, udnoz, mp_trace, mp_jump): # Returns a staircase path with {m} with horizontal steps alternating # with {m} vertical steps. Each horizontal step will have {nx} moves # of length {xd} each. Each vertical step will have {ny} moves of # length {yd} each. # # If {m} is zero the result is an empty path at {pt}. # The numbers {nx} and {ny} must be non-negative. The # lengths {xd,yd} cannot be zero, but may be negative to invert the # direction of the staircase. # return timing_path_IMP.stair(pt, m, nx, xd, ny, yd, ang, jmp, udnoz, mp_trace, mp_jump) # PATHS FOR LONGER MOVES # def raster_snake(pt, n, d, totsz, jmp, udnoz, mp_trace, mp_jump): # # Creates a # # def squiral(pt, n, d, totsz, jmp, udnoz, mp_trace, mp_jump): # # Creates a # pass def full(nx, xdist, ny, ydist, ang, jmp, udnoz, totsz, mp_trace, mp_jump): # If {ang} is zero, generates a path that consists of {nx} moves in the # {X} direction by {xdist} millimeters. intercalated with {ny} moves in # the {Y} direction by {ydist} millimeters. Those lengths are # averages; the actual lengths will vary slightly from them so that # the endpoints are all distinct. # return timing_path_IMP.full(nx, xdist, ny, ydist, ang, jmp, udnoz, totsz, mp_trace, mp_jump)