Frusta

Check-in [a243c85b43]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:started gcode writer
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a243c85b43151c632e18bf4e9d77479502370156
User & Date: rmelton 2013-10-23 03:07:24
Context
2013-10-23
04:23
First working version of gcode exercise code generator check-in: 04002210f3 user: rmelton tags: trunk
03:07
started gcode writer check-in: a243c85b43 user: rmelton tags: trunk
03:06
started gcode writer check-in: 09fd732842 user: rmelton tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/machine/machine_0.1.tcl.

117
118
119
120
121
122
123

124






125


126









127
128
129
130
131
132
133
...
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
      drawPathInCanvas $w.view [stitchSidesXY      $v(x0) $v(y0) $v(x1) $v(y1) $v(segsStitchSides)]  25 {-fill white}
    }
    if {$v(doSpiral)} {
      drawPathInCanvas $w.view [spiralOutXY         $v(x0) $v(y0) $v(x1) $v(y1) $v(segsSpiral)]        1 {-fill purple -arrow none}
      drawPathInCanvas $w.view [spiralInXY          $v(x0) $v(y0) $v(x1) $v(y1) $v(segsSpiral)]        1 {-fill pink -arrow none}
    }
  }

  proc buildExercise {} {






    


  }









  proc drawPathInCanvas {c path {delay 0} {pathArgs {}}} {
    set pathPt [lassign $path P0]
    lassign $P0 x0 y0
    foreach pt $pathPt {
      lassign $pt x1 y1
      $c create line $x0 $y0 $x1 $y1 -fill green -arrow last {*}$pathArgs
      lassign $pt x0 y0
................................................................................
    ## chase a line across edges in N steps
    set path {}
    set Xc [expr {$X0+$X1/2}]
    set Yc [expr {$Y0+$Y1/2}]
    set width  [expr {$X1-$X0}]
    set height [expr {$Y1-$Y0}]
    set R [expr {min(abs($X1-$X0)/2,abs($Y1-$Y0)/2)}]
    for {set i 0} {$i <= $N} {incr i} {
      set x0 [expr {1.0*($width/$N)*$i+$X0}]
      set y0 [expr {$Y0}]
      set x1 [expr {$X1}]
      set y1 [expr {1.0*($height/$N)*$i+$Y0}]
      lappend path [list $x0 $y0] [list $x1 $y1]
    }
    for {set i 0} {$i <= $N} {incr i} {
      set x0 [expr {$X1}]
      set y0 [expr {1.0*($height/$N)*$i+$Y0}]
      set x1 [expr {$X1-1.0*($width/$N)*$i}]
      set y1 [expr {$Y1}]
      lappend path [list $x0 $y0] [list $x1 $y1]
    }
    for {set i $N} {$i >= 0} {incr i -1} {
      set x0 [expr {1.0*($width/$N)*$i+$X0}]
      set y0 [expr {$Y1}]
      set x1 [expr {$X0}]
      set y1 [expr {1.0*($height/$N)*$i+$Y0}]
      lappend path [list $x0 $y0] [list $x1 $y1]
    }
    for {set i $N} {$i >= 0} {incr i -1} {
      set x0 [expr {$X0}]
      set y0 [expr {1.0*($height/$N)*$i+$Y0}]
      set x1 [expr {$X1-1.0*($width/$N)*$i}]
      set y1 [expr {$Y0}]
      lappend path [list $x0 $y0] [list $x1 $y1]
    }
    return $path







>

>
>
>
>
>
>
|
>
>
|
>
>
>
>
>
>
>
>
>







 







|






|






|






|







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
...
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
      drawPathInCanvas $w.view [stitchSidesXY      $v(x0) $v(y0) $v(x1) $v(y1) $v(segsStitchSides)]  25 {-fill white}
    }
    if {$v(doSpiral)} {
      drawPathInCanvas $w.view [spiralOutXY         $v(x0) $v(y0) $v(x1) $v(y1) $v(segsSpiral)]        1 {-fill purple -arrow none}
      drawPathInCanvas $w.view [spiralInXY          $v(x0) $v(y0) $v(x1) $v(y1) $v(segsSpiral)]        1 {-fill pink -arrow none}
    }
  }

  proc buildExercise {} {
    variable v
    gcode::write::open
    gcode::write::display "Motor Exercise"
    $w.view delete all
    if {$v(doOpositeSides)} {
      gcode::write::path -move [squareCrissCrossXY $v(x0) $v(y0) $v(x1) $v(y1) $v(segsOpositeSide)] 25 {-fill blue}
    }
    if {$v(doOpositeCircle)} {
      gcode::write::path -move [roundCrissCrossXY  $v(x0) $v(y0) $v(x1) $v(y1) $v(segsOpositeCircle)] 25 {-fill green}
    }
    if {$v(doSideStitch)} {
      gcode::write::path -move [stitchSidesXY      $v(x0) $v(y0) $v(x1) $v(y1) $v(segsStitchSides)]  25 {-fill white}
    }
    if {$v(doSpiral)} {
      gcode::write::path -move [spiralOutXY         $v(x0) $v(y0) $v(x1) $v(y1) $v(segsSpiral)]        1 {-fill purple -arrow none}
      gcode::write::path -move [spiralInXY          $v(x0) $v(y0) $v(x1) $v(y1) $v(segsSpiral)]        1 {-fill pink -arrow none}
    }
  }

  proc drawPathInCanvas {c path {delay 0} {pathArgs {}}} {
    set pathPt [lassign $path P0]
    lassign $P0 x0 y0
    foreach pt $pathPt {
      lassign $pt x1 y1
      $c create line $x0 $y0 $x1 $y1 -fill green -arrow last {*}$pathArgs
      lassign $pt x0 y0
................................................................................
    ## chase a line across edges in N steps
    set path {}
    set Xc [expr {$X0+$X1/2}]
    set Yc [expr {$Y0+$Y1/2}]
    set width  [expr {$X1-$X0}]
    set height [expr {$Y1-$Y0}]
    set R [expr {min(abs($X1-$X0)/2,abs($Y1-$Y0)/2)}]
    for {set i 0} {$i < $N} {incr i} {
      set x0 [expr {1.0*($width/$N)*$i+$X0}]
      set y0 [expr {$Y0}]
      set x1 [expr {$X1}]
      set y1 [expr {1.0*($height/$N)*$i+$Y0}]
      lappend path [list $x0 $y0] [list $x1 $y1]
    }
    for {set i 0} {$i < $N} {incr i} {
      set x0 [expr {$X1}]
      set y0 [expr {1.0*($height/$N)*$i+$Y0}]
      set x1 [expr {$X1-1.0*($width/$N)*$i}]
      set y1 [expr {$Y1}]
      lappend path [list $x0 $y0] [list $x1 $y1]
    }
    for {set i $N} {$i > 0} {incr i -1} {
      set x0 [expr {1.0*($width/$N)*$i+$X0}]
      set y0 [expr {$Y1}]
      set x1 [expr {$X0}]
      set y1 [expr {1.0*($height/$N)*$i+$Y0}]
      lappend path [list $x0 $y0] [list $x1 $y1]
    }
    for {set i $N} {$i > 0} {incr i -1} {
      set x0 [expr {$X0}]
      set y0 [expr {1.0*($height/$N)*$i+$Y0}]
      set x1 [expr {$X1-1.0*($width/$N)*$i}]
      set y1 [expr {$Y0}]
      lappend path [list $x0 $y0] [list $x1 $y1]
    }
    return $path