Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | fixed G2 (arcs) |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
fb1a2763eec708f7867ab845f84e300a |
User & Date: | rmelton 2013-10-25 00:26:02.930 |
Context
2014-01-06
| ||
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 | |
2013-10-24
| ||
23:03 | fixed G2/G3 (arcs) last commit had deg/rad mistake check-in: 947f22cec0 user: rmelton tags: trunk | |
Changes
Changes to lib/gcode/gcode_0.1.tcl.
︙ | ︙ | |||
77 78 79 80 81 82 83 | [list $cfg(X) $cfg(Y) $cfg(Z)]\ [list $new(X) $new(Y) $new(Z)]\ ] lassign [list $new(X) $new(Y) $new(Z) $new(E)] cfg(X) cfg(Y) cfg(Z) cfg(E) } proc G2 {args} { | < | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | [list $cfg(X) $cfg(Y) $cfg(Z)]\ [list $new(X) $new(Y) $new(Z)]\ ] lassign [list $new(X) $new(Y) $new(Z) $new(E)] cfg(X) cfg(Y) cfg(Z) cfg(E) } proc G2 {args} { ## clockwise arc (ref http://linuxcnc.org/docs/html/gcode/gcode.html#sec:G2-G3-Arc) ## note this code is only valid for XY arcs variable cfg variable pathList set new(X) $cfg(X) set new(Y) $cfg(Y) set new(Z) $cfg(Z) |
︙ | ︙ | |||
140 141 142 143 144 145 146 | set Pi 3.14159265 #compute "start" angle set theta0 [expr {180.0*atan2((0-$offsetJ),(0-$offsetI))/$Pi}] #compute "stop" angle set theta1 [expr {180.0*atan2(($new(Y)-$Yc),($new(X)-$Xc))/$Pi}] if {$theta1 > $theta0} {set theta0 [expr {$theta0+360}]} set theta [expr {$theta0-$theta1}] | < | | | | | | > | | > > > > | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | set Pi 3.14159265 #compute "start" angle set theta0 [expr {180.0*atan2((0-$offsetJ),(0-$offsetI))/$Pi}] #compute "stop" angle set theta1 [expr {180.0*atan2(($new(Y)-$Yc),($new(X)-$Xc))/$Pi}] if {$theta1 > $theta0} {set theta0 [expr {$theta0+360}]} set theta [expr {$theta0-$theta1}] if {$theta > 270} {set stepAngle [expr {$theta/20.0}] } elseif {$theta > 180} {set stepAngle [expr {$theta/12.0}] } elseif {$theta > 90} {set stepAngle [expr {$theta/9.0}] } elseif {$theta > 45} {set stepAngle [expr {$theta/5.0}] } else {set stepAngle [expr {$theta/3.0}]} lassign [list $cfg(X) $cfg(Y)] x0 y0 if {abs(1.0-($r1/$r0)) > 0.1} { set color red log::Puts "WARNING, non-circular G2 arc squish=[expr abs(1.0-($r1/$r0))*100.0]% @ line??\n $saveArgs" } else { set radius $r0 } if {($theta0+$stepAngle) < $theta1} { ## arc is smaller than stepsize set stepAngle [expr {$theta1-$theta0}] } for {set deg [expr {$theta0+$stepAngle}]} {$deg >= $theta1} {set deg [expr {$deg-$stepAngle}]} { set rads [expr {$deg/360.0*2*$Pi}] if {[info exists radius]} { set x1 [expr {cos($rads)*$radius+$Xc}] set y1 [expr {sin($rads)*$radius+$Yc}] } else { set x1 [expr {cos($rads)*(($r1-$r0)*(($deg-$theta0)/($theta1-$theta0))+$r0)+$Xc}] set y1 [expr {sin($rads)*(($r1-$r0)*(($deg-$theta0)/($theta1-$theta0))+$r0)+$Yc}] } lappend pathList [list \ $width\ $type\ $color\ [list $x0 $y0 $cfg(Z)]\ [list $x1 $y1 $cfg(Z)]\ ] |
︙ | ︙ |
Changes to main.tcl.
︙ | ︙ | |||
42 43 44 45 46 47 48 | ## do any needed cleanup #puts stderr "closing in-memory db" Slice::Exit exit } ## main | < | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | ## do any needed cleanup #puts stderr "closing in-memory db" Slice::Exit exit } ## main parseCmdlineArgs ## Local Variables: ## mode: tcl ## tcl-indent-level: 2 |
︙ | ︙ |