CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > LinuxCNC (formerly EMC2)


LinuxCNC (formerly EMC2) Discuss LinuxCNC (formerly EMC2) Controlers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 01-27-2008, 11:29 PM
 
Join Date: May 2005
Location: canada
Posts: 1,149
cyclestart is on a distinguished road
what's wrong with this program?

Punched this through a calculator a few times and it should work.

Code:
(#1 is X center)
(#2 is Y center)
(#3 is plunge depth)
(#4 is a quarter of stepover)
(#5 is one sixteeth of stepover plus #4)
(#6 is The finish radius)
(#15 is the start of the next loop)

o100 sub
G00 X#1 Y#2 Z.1
G01 Z#3 F10
X#4 
G03 X#1 Y#4 R#4
X[[-2]*#4] Y#2 R#5
#15=0
#6=.12
o101 while [#15 LT #6]
G03 X#1 Y[[[#4*3]+15]*[-1]] R[#5+#4+#15]
X[[4*#4]+#1+#15] Y#2 R[[2*#4]+#5+#15]
X#1 Y[[5*#4]+#2+#15] R[[3*#4]+#5+#15]
X[[[#4*6]+#1+#15]*[-1]] Y#2 R[[4*#4]+#5+#15]
#15 = [#4*4]+#15 
o101 endwhile
o100 endsub 

o100 call [0] [0] [-.1] [.0125] [.0156] 
G00 Z2
M02
the program should run like below, shouldn't it?
Code:
G00 X0.0000 Y0.0000 Z.1
G01 Z-.1 F10
X0.0125
G03 X0.0000 Y0.0125 R0.0125
X-0.0250 Y0.0000 R0.0156
G03 X0.0000 Y-0.0375 R0.0281
X0.0500 Y0.0000 R0.0406
X0.0000 Y0.0625 R0.0531
X-0.0750 Y0.0000 R0.0656
X0.0000 Y-0.0875 R0.0781
X0.1000 Y0.0000 R0.0906
X0.0000 Y0.1125 R0.1031
X-0.1250 Y0.0000 R0.1156
X0.0000 Y-0.1375 R0.1281
X0.1500 Y0.0000 R0.1406
X0.0000 Y0.1625 R0.1531
X-0.1750 Y0.0000 R0.1656
G00 Z2 
M02
This is part of a larger python generated program. Python had no problem generating the long hand gcode using the same logic as I used in the above parametric.
__________________
Anyone who says "It only goes together one way" has no imagination.
Reply With Quote

  #2   Ban this user!
Old 01-28-2008, 03:33 PM
acondit's Avatar  
Join Date: Apr 2005
Location: USA
Posts: 1,774
acondit is on a distinguished road

Originally Posted by cyclestart View Post
Punched this through a calculator a few times and it should work.

Code:
(#1 is X center)
(#2 is Y center)
(#3 is plunge depth)
(#4 is a quarter of stepover)
(#5 is one sixteeth of stepover plus #4)
(#6 is The finish radius)
(#15 is the start of the next loop)

o100 sub
G00 X#1 Y#2 Z.1
G01 Z#3 F10
X#4 
G03 X#1 Y#4 R#4
X[[-2]*#4] Y#2 R#5
#15=0
#6=.12
o101 while [#15 LT #6]
(G03 X#1 Y[[[#4*3]+15]*[-1]] R[#5+#4+#15]) ( <--- needs # in front of 15  see inserted line below )
G03 X#1 Y[[[#4*3]+#15]*[-1]] R[#5+#4+#15]  
X[[4*#4]+#1+#15] Y#2 R[[2*#4]+#5+#15]
X#1 Y[[5*#4]+#2+#15] R[[3*#4]+#5+#15]
X[[[#4*6]+#1+#15]*[-1]] Y#2 R[[4*#4]+#5+#15]
(#15 = [#4*4]+#15) (<--- needs square brackets around expression, see inserted line below)
#15 = [[#4*4]+#15]
o101 endwhile
o100 endsub 

o100 call [0] [0] [-.1] [.0125] [.0156] 
G00 Z2
M02
the program should run like below, shouldn't it?
Code:
G00 X0.0000 Y0.0000 Z.1
G01 Z-.1 F10
X0.0125
G03 X0.0000 Y0.0125 R0.0125
X-0.0250 Y0.0000 R0.0156
G03 X0.0000 Y-0.0375 R0.0281
X0.0500 Y0.0000 R0.0406
X0.0000 Y0.0625 R0.0531
X-0.0750 Y0.0000 R0.0656
X0.0000 Y-0.0875 R0.0781
X0.1000 Y0.0000 R0.0906
X0.0000 Y0.1125 R0.1031
X-0.1250 Y0.0000 R0.1156
X0.0000 Y-0.1375 R0.1281
X0.1500 Y0.0000 R0.1406
X0.0000 Y0.1625 R0.1531
X-0.1750 Y0.0000 R0.1656
G00 Z2 
M02
This is part of a larger python generated program. Python had no problem generating the long hand gcode using the same logic as I used in the above parametric.
Cyclestart,

Look in the quoted code for my notes and changes.

Alan
__________________
http://www.alansmachineworks.com
Reply With Quote

  #3   Ban this user!
Old 01-28-2008, 05:59 PM
 
Join Date: May 2005
Location: canada
Posts: 1,149
cyclestart is on a distinguished road

Thank you for taking the time to sort that Alan. Any guesses why my wife insists on balancing the check book?
__________________
Anyone who says "It only goes together one way" has no imagination.
Reply With Quote

  #4   Ban this user!
Old 01-28-2008, 06:06 PM
acondit's Avatar  
Join Date: Apr 2005
Location: USA
Posts: 1,774
acondit is on a distinguished road

Originally Posted by cyclestart View Post
Thank you for taking the time to sort that Alan. Any guesses why my wife insists on balancing the check book?
Mine does ours too. But these are the kind of errors that I make, so I have gotten better at finding them.

Good luck,
Alan
__________________
http://www.alansmachineworks.com
Reply With Quote

  #5   Ban this user!
Old 01-29-2008, 05:37 AM
 
Join Date: May 2005
Location: canada
Posts: 1,149
cyclestart is on a distinguished road

The beauty of generating g-code with python is the ease of debugging. The beauty of an emc style parametric is the economy of code. I want the best of both.

NCPlot does a macro B to "long hand" g-code conversion. Maybe it's times for a feature request.

Some people are never satisfied.

edit/ A practical example for this feature. An equally spaced pattern of 200 holes needs to be drilled. A parametric saves a lot of keystrokes. Now the drill goes dull on hole #150. How do you restart the program if it's all variables? Without altering the program?
__________________
Anyone who says "It only goes together one way" has no imagination.

Last edited by cyclestart; 01-29-2008 at 06:47 AM.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 01-29-2008, 08:29 AM
 
Join Date: Feb 2007
Location: USA
Posts: 514
Big John T is on a distinguished road

Originally Posted by cyclestart View Post
The beauty of generating g-code with python is the ease of debugging. The beauty of an emc style parametric is the economy of code. I want the best of both.

NCPlot does a macro B to "long hand" g-code conversion. Maybe it's times for a feature request.

Some people are never satisfied.

edit/ A practical example for this feature. An equally spaced pattern of 200 holes needs to be drilled. A parametric saves a lot of keystrokes. Now the drill goes dull on hole #150. How do you restart the program if it's all variables? Without altering the program?
I've have some python g code generators here http://wiki.linuxcnc.org/cgi-bin/emc...ode_Generators

John
Reply With Quote

  #7   Ban this user!
Old 01-29-2008, 11:21 PM
acondit's Avatar  
Join Date: Apr 2005
Location: USA
Posts: 1,774
acondit is on a distinguished road

Cyclestart,

I did a little editing on your file to try and make it a little easier to understand. I put the parameter comments inside the routine in case it were to be used with other subroutines. I also changed some of the variables to named variable to make it more easily readable.

I changed it to pass in the stepover value and do the calculations inside the routine for 1/4 step and 1/16 step and then also passed in the ending radius as a parameter.

(Subroutine to draw spiral)
o100 sub
(#1 is X center)
(#2 is Y center)
(#3 is Z plunge depth)
(#4 is the stepover amount )
(#5 is the ending radius )
(# is the amount to increment start of the next loop)

#=#4 ( Size of stepover )
#=[#/4] ( 1/4 of stepover )
#=[#/16] ( 1/16 of stepover )
#=[#+#] ( 5/16 of stepover )
#=0
G00 X#1 Y#2 Z0.1
G01 Z#3 F10
X#
G03 X#1 Y# R#
X[[-2]*#] Y#2 R#
o101 while [# LT #5]
G03 X#1 Y[[#2+#+[#*3]]*[-1]] R[#+[#*1]+#]
X[#1+#+[#*4]] Y#2 R[#+[#*2]+#]
X#1 Y[#2+#+[#*5]] R[#+[#*3]+#]
X[[#1+#+[#*6]]*[-1]] Y#2 R[#+[#*4]+#]
# = [#+#]
o101 endwhile
o100 endsub

o100 call [0] [0] [-0.1] [.050] [0.12]
G00 Z2
M02
The zip file has some indentation that is lost in the zone's editor.

Hope you like this,
Alan
Attached Files
File Type: zip spiralmacro.ngc.zip‎ (910 Bytes, 71 views)
__________________
http://www.alansmachineworks.com
Reply With Quote

  #8   Ban this user!
Old 01-30-2008, 09:32 AM
 
Join Date: May 2005
Location: canada
Posts: 1,149
cyclestart is on a distinguished road

Thanks again Alan. I wasn't aware emc would accept a file commented in that way. Really improves the readability. These files are being used to test some calculations for a python program. Making changes to a parametric is simply quicker than making those same changes in python. The clean up you did definitely gives me something to chew on.

A big attaboy to the developers for Axis (mostly Epler and Radek ?). Nobody should be deceived by it's simple, ie: clean , appearance. This thing is an amazing piece of work.

Alan
I have 3 Win2000 machines salvaged from work. Can we work out a trade for your Mac? j/k and rhetorical.
__________________
Anyone who says "It only goes together one way" has no imagination.
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
WTF Have I done wrong now? bryanrabb Mach Software (ArtSoft software) 4 01-08-2008 09:31 PM
Not sure what I'm doing wrong chuy Mastercam 4 08-01-2007 03:28 AM
What am I doing WRONG??? elalto Mach Software (ArtSoft software) 2 07-21-2006 05:23 AM
When everything goes wrong. ImanCarrot General Metalwork Discussion 4 04-23-2006 09:42 PM
Anyone got any basic examples of a program using a subroutine/program? Darc CamSoft Products 11 10-08-2005 11:45 PM




All times are GMT -5. The time now is 02:59 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 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 132 133 134 135 136 137 138 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 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 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361