587,481 active members*
2,934 visitors online*
Register for free
Login
Results 1 to 8 of 8
  1. #1
    Join Date
    May 2005
    Posts
    1662

    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.

  2. #2
    Join Date
    Apr 2005
    Posts
    1778
    Quote 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

  3. #3
    Join Date
    May 2005
    Posts
    1662
    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.

  4. #4
    Join Date
    Apr 2005
    Posts
    1778
    Quote 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

  5. #5
    Join Date
    May 2005
    Posts
    1662
    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.

  6. #6
    Join Date
    Feb 2007
    Posts
    514
    Quote 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

  7. #7
    Join Date
    Apr 2005
    Posts
    1778
    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 Attached Files

  8. #8
    Join Date
    May 2005
    Posts
    1662
    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.

Similar Threads

  1. WTF Have I done wrong now?
    By bryanrabb in forum Mach Software (ArtSoft software)
    Replies: 4
    Last Post: 01-09-2008, 04:31 AM
  2. Not sure what I'm doing wrong
    By chuy in forum Mastercam
    Replies: 4
    Last Post: 08-01-2007, 09:28 AM
  3. What am I doing WRONG???
    By elalto in forum Mach Software (ArtSoft software)
    Replies: 2
    Last Post: 07-21-2006, 11:23 AM
  4. When everything goes wrong.
    By ImanCarrot in forum MetalWork Discussion
    Replies: 4
    Last Post: 04-24-2006, 03:42 AM
  5. Replies: 11
    Last Post: 10-09-2005, 05:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •