MCPcopy Create free account
hub / github.com/256dpi/gcode / OffsetXYZ

Function OffsetXYZ

tools.go:36–51  ·  view source on GitHub ↗

OffsetXYZ will offset all X, Y and Z G-Code values by the specified values.

(f *File, x, y, z float64)

Source from the content-addressed store, hash-verified

34
35// OffsetXYZ will offset all X, Y and Z G-Code values by the specified values.
36func OffsetXYZ(f *File, x, y, z float64) {
37 for _, l := range f.Lines {
38 for i, c := range l.Codes {
39 if c.Letter == "X" {
40 c.Value += x
41 } else if c.Letter == "Y" {
42 c.Value += y
43 } else if c.Letter == "Z" {
44 c.Value += z
45 }
46
47 // update code
48 l.Codes[i] = c
49 }
50 }
51}

Callers 2

offsetFunction · 0.92
TestOffsetXYZFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestOffsetXYZFunction · 0.68