Frusta

Check-in [83b3f53d74]
Login

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

Overview
Comment:fixed machine/exercise menu output
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:83b3f53d74e6ae22a1d6c10831c3e54e260fe27e
User & Date: rmelton 2014-01-06 01:07:38
Context
2014-01-06
05:17
fixed machine/exercise output check-in: c8eec67efd user: rmelton tags: trunk
01:07
fixed machine/exercise menu output check-in: 83b3f53d74 user: rmelton tags: trunk
2013-10-25
00:26
fixed G2 (arcs) check-in: fb1a2763ee user: rmelton tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/gcode/gcode_0.1.tcl.

540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
    }
    interp delete gcodeParseInterp
  }

  namespace eval write {
    #http://reprap.org/wiki/G-code
    variable fp
    proc Open {} {
      variable fp
      set fp [open "output.gcode" w]
    }
    proc Close {} {
      variable fp
      close $fp
      unset fp
    }
    proc Puts {args} {







|

|







540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
    }
    interp delete gcodeParseInterp
  }

  namespace eval write {
    #http://reprap.org/wiki/G-code
    variable fp
    proc Open {{fileName "output.gcode"}} {
      variable fp
      set fp [open $fileName w]
    }
    proc Close {} {
      variable fp
      close $fp
      unset fp
    }
    proc Puts {args} {

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

92
93
94
95
96
97
98

99
100



101
102
103
104
105
106
107
108
109











110
111
112
113
114
115
116
...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
      grid x             $w.loop.opositeCircle  $w.loop.segsOpositeCircle -sticky w
      grid x             $w.loop.stitchSides    $w.loop.segsStitchSides   -sticky w
      grid x             $w.loop.doSpiral       $w.loop.segsSpiral        -sticky w
      grid x             $w.loop.doResonanceX   $w.loop.segsResonanceX    -sticky w
      grid x             $w.loop.doResonanceY   $w.loop.segsResonanceY    -sticky w
    }


    label $w.stlFileLabel -text "Output STL File:"
    entry $w.stlFileName




    canvas $w.view -width [expr {[Settings::Get buildWidth]}] -height  [expr {[Settings::Get buildDepth]}]
    button $w.preview -text "Preview" -command [namespace code Preview]
    button $w.write -text "Write" -command [namespace code BuildExercise]

    grid $w.bed           $w.test        $w.view  -sticky n
    grid $w.loop          -              ^        -sticky ew
    grid ^                ^              $w.preview
    grid $w.stlFileLabel  $w.stlFileName $w.write











  }

  proc Preview {} {
    variable w
    variable v
    $w.view delete all
    lassign {0 0 200 200} X0 Y0 X1 Y1
................................................................................
      drawPathInCanvas $w.view [resonanceX          $v(x0) $v(y0) $v(x1) $v(y1) $v(segsResonanceX)] 1 {-fill orange}
    }
    if {$v(doResonanceY)} {
      drawPathInCanvas $w.view [resonanceY          $v(x0) $v(y0) $v(x1) $v(y1) $v(segsResonanceY)] 1 {-fill cyan}
    }
  }

  proc BuildExercise {} {
    variable v
    gcode::write::Open
    gcode::write::Init
    gcode::write::Display "Motor Exercise"
    for {set i 0} {$i < $v(loops)} {incr i} {
      gcode::write::Display "Motor Exercise $i/$v(loops)"
      if {$v(autoHome)} {







>
|
|
>
>
>



|

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







 







|







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
...
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
      grid x             $w.loop.opositeCircle  $w.loop.segsOpositeCircle -sticky w
      grid x             $w.loop.stitchSides    $w.loop.segsStitchSides   -sticky w
      grid x             $w.loop.doSpiral       $w.loop.segsSpiral        -sticky w
      grid x             $w.loop.doResonanceX   $w.loop.segsResonanceX    -sticky w
      grid x             $w.loop.doResonanceY   $w.loop.segsResonanceY    -sticky w
    }

    frame $w.gcode
    label $w.gcode.fileLabel -text "Output Gcode File:"
    entry $w.gcode.fileName
    button $w.gcode.choose -text "..." -command [namespace code "ChooseFile $w.gcode"]
    grid $w.gcode.fileLabel $w.gcode.fileName $w.gcode.choose
    $w.gcode.fileName insert 0 "exercise.gcode"

    canvas $w.view -width [expr {[Settings::Get buildWidth]}] -height  [expr {[Settings::Get buildDepth]}]
    button $w.preview -text "Preview" -command [namespace code Preview]
    button $w.write -text "Write" -command [namespace code [subst -nocommands {BuildExercise [$w.gcode.fileName get]}]]

    grid $w.bed             $w.test          $w.view  -sticky n
    grid $w.loop            -                ^        -sticky ew
    grid ^                  ^                $w.preview
    grid $w.gcode           -                $w.write
  }

  proc ChooseFile {w} {
    set newName [tk_getSaveFile -filetypes {
      {{Gcode Files}    {.gcode}      }
      {{All Files}    *             }
    } -defaultextension ".gcode" -parent $w]
    if {$newName ne {}} {
      $w.fileName delete 0 end
      $w.fileName insert 0 $newName
    }
  }

  proc Preview {} {
    variable w
    variable v
    $w.view delete all
    lassign {0 0 200 200} X0 Y0 X1 Y1
................................................................................
      drawPathInCanvas $w.view [resonanceX          $v(x0) $v(y0) $v(x1) $v(y1) $v(segsResonanceX)] 1 {-fill orange}
    }
    if {$v(doResonanceY)} {
      drawPathInCanvas $w.view [resonanceY          $v(x0) $v(y0) $v(x1) $v(y1) $v(segsResonanceY)] 1 {-fill cyan}
    }
  }

  proc BuildExercise {fileName} {
    variable v
    gcode::write::Open
    gcode::write::Init
    gcode::write::Display "Motor Exercise"
    for {set i 0} {$i < $v(loops)} {incr i} {
      gcode::write::Display "Motor Exercise $i/$v(loops)"
      if {$v(autoHome)} {

Changes to lib/slice.tcl.

532
533
534
535
536
537
538
539
540
541


542
543
544
545
546



547
548


549
550
551
552
553

554
555
556

557
558
559

560
561
562
563
564
565
566
567
568
569
570
571
          lappend sweepList($x1) [list $i $y1]
          incr i
        }
        #
        set activeList {}
        ## {{seg# y} ... }
        foreach x [lsort -real [array names sweepList]] {
          set segmentEvents $sweepList($x)
          ## This is a list of segments that have an endpoint at x
          # (maybe sort it on y)


          foreach segmentGlob $segmentEvents {
          lassign $segmentGlob segmentIndex y
            # i now have a pointer to the segment that is either starting or finishing
            if {[lsearch -index 0 -integer $activeList $segmentIndex] >= 0} {
              # it is already in the list of things being followed



              set activeList [lsearch -all -inline -not -index 0 -integer $activeList $segmentIndex]
            } else {


              # add it to the list of things being followed
              lappend activeList [list $segmentIndex $y]
            }
          }


          if {[llength $vertexList($vertex)] == 2} {
            lassign $vertexList($vertex) s1 s2
            unset vertexList($vertex)

            lappend joinList [list $s1 $s2]
          } else {
            ## FIXME - DRC

          }
        }
        foreach join $joinList {
          ...
        }
      }
    }
    ##
  }


  variable v







|

|
>
>

|



>
>
>


>
>




<
>
|
|
|
>
|
|
<
>
|
|
<
<








532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559

560
561
562
563
564
565
566

567
568
569


570
571
572
573
574
575
576
577
          lappend sweepList($x1) [list $i $y1]
          incr i
        }
        #
        set activeList {}
        ## {{seg# y} ... }
        foreach x [lsort -real [array names sweepList]] {
          set segmentEvents [lsort -real -index 1 $sweepList($x)]
          ## This is a list of segments that have an endpoint at x
          set stitchList {} ;## list of segments starting at this x
          set unstitchList {} ;# list of segments ending at ths x
          # {{seg# y} ... }
          foreach segmentGlob $segmentEvents {
            lassign $segmentGlob segmentIndex y
            # i now have a pointer to the segment that is either starting or finishing
            if {[lsearch -index 0 -integer $activeList $segmentIndex] >= 0} {
              # it is already in the list of things being followed
              # can it be atached to something starting in the list?
              lappend unstitchList [list $segmentIndex $y]
              ## remove it from the lits of things being followed
              set activeList [lsearch -all -inline -not -index 0 -integer $activeList $segmentIndex]
            } else {
              # Can it attach to an endoint of something falling off the list?
              lappend stitchList [list $segmentIndex $y]
              # add it to the list of things being followed
              lappend activeList [list $segmentIndex $y]
            }
          }

          foreach dropout $unstitchList {
            lassign $dropout dropIndex dropY
            set index [lsearch -index 1 -real $activeList $dropY]
            if {$index >= 0} {
              lassign [lindex $activeList $index] segIndex segY
              lappend joinList [list $x $segY $segIndex $dropIndex]
            } else {

              #DRC - segment ended with no connection
            }
          }


        }
      }
    }
    ##
  }


  variable v