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 Side-by-Side Diffs Ignore Whitespace Patch

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

   117    117         drawPathInCanvas $w.view [stitchSidesXY      $v(x0) $v(y0) $v(x1) $v(y1) $v(segsStitchSides)]  25 {-fill white}
   118    118       }
   119    119       if {$v(doSpiral)} {
   120    120         drawPathInCanvas $w.view [spiralOutXY         $v(x0) $v(y0) $v(x1) $v(y1) $v(segsSpiral)]        1 {-fill purple -arrow none}
   121    121         drawPathInCanvas $w.view [spiralInXY          $v(x0) $v(y0) $v(x1) $v(y1) $v(segsSpiral)]        1 {-fill pink -arrow none}
   122    122       }
   123    123     }
          124  +
   124    125     proc buildExercise {} {
   125         -    
          126  +    variable v
          127  +    gcode::write::open
          128  +    gcode::write::display "Motor Exercise"
          129  +    $w.view delete all
          130  +    if {$v(doOpositeSides)} {
          131  +      gcode::write::path -move [squareCrissCrossXY $v(x0) $v(y0) $v(x1) $v(y1) $v(segsOpositeSide)] 25 {-fill blue}
          132  +    }
          133  +    if {$v(doOpositeCircle)} {
          134  +      gcode::write::path -move [roundCrissCrossXY  $v(x0) $v(y0) $v(x1) $v(y1) $v(segsOpositeCircle)] 25 {-fill green}
          135  +    }
          136  +    if {$v(doSideStitch)} {
          137  +      gcode::write::path -move [stitchSidesXY      $v(x0) $v(y0) $v(x1) $v(y1) $v(segsStitchSides)]  25 {-fill white}
          138  +    }
          139  +    if {$v(doSpiral)} {
          140  +      gcode::write::path -move [spiralOutXY         $v(x0) $v(y0) $v(x1) $v(y1) $v(segsSpiral)]        1 {-fill purple -arrow none}
          141  +      gcode::write::path -move [spiralInXY          $v(x0) $v(y0) $v(x1) $v(y1) $v(segsSpiral)]        1 {-fill pink -arrow none}
          142  +    }
   126    143     }
          144  +
   127    145     proc drawPathInCanvas {c path {delay 0} {pathArgs {}}} {
   128    146       set pathPt [lassign $path P0]
   129    147       lassign $P0 x0 y0
   130    148       foreach pt $pathPt {
   131    149         lassign $pt x1 y1
   132    150         $c create line $x0 $y0 $x1 $y1 -fill green -arrow last {*}$pathArgs
   133    151         lassign $pt x0 y0
................................................................................
   178    196       ## chase a line across edges in N steps
   179    197       set path {}
   180    198       set Xc [expr {$X0+$X1/2}]
   181    199       set Yc [expr {$Y0+$Y1/2}]
   182    200       set width  [expr {$X1-$X0}]
   183    201       set height [expr {$Y1-$Y0}]
   184    202       set R [expr {min(abs($X1-$X0)/2,abs($Y1-$Y0)/2)}]
   185         -    for {set i 0} {$i <= $N} {incr i} {
          203  +    for {set i 0} {$i < $N} {incr i} {
   186    204         set x0 [expr {1.0*($width/$N)*$i+$X0}]
   187    205         set y0 [expr {$Y0}]
   188    206         set x1 [expr {$X1}]
   189    207         set y1 [expr {1.0*($height/$N)*$i+$Y0}]
   190    208         lappend path [list $x0 $y0] [list $x1 $y1]
   191    209       }
   192         -    for {set i 0} {$i <= $N} {incr i} {
          210  +    for {set i 0} {$i < $N} {incr i} {
   193    211         set x0 [expr {$X1}]
   194    212         set y0 [expr {1.0*($height/$N)*$i+$Y0}]
   195    213         set x1 [expr {$X1-1.0*($width/$N)*$i}]
   196    214         set y1 [expr {$Y1}]
   197    215         lappend path [list $x0 $y0] [list $x1 $y1]
   198    216       }
   199         -    for {set i $N} {$i >= 0} {incr i -1} {
          217  +    for {set i $N} {$i > 0} {incr i -1} {
   200    218         set x0 [expr {1.0*($width/$N)*$i+$X0}]
   201    219         set y0 [expr {$Y1}]
   202    220         set x1 [expr {$X0}]
   203    221         set y1 [expr {1.0*($height/$N)*$i+$Y0}]
   204    222         lappend path [list $x0 $y0] [list $x1 $y1]
   205    223       }
   206         -    for {set i $N} {$i >= 0} {incr i -1} {
          224  +    for {set i $N} {$i > 0} {incr i -1} {
   207    225         set x0 [expr {$X0}]
   208    226         set y0 [expr {1.0*($height/$N)*$i+$Y0}]
   209    227         set x1 [expr {$X1-1.0*($width/$N)*$i}]
   210    228         set y1 [expr {$Y0}]
   211    229         lappend path [list $x0 $y0] [list $x1 $y1]
   212    230       }
   213    231       return $path