On Wednesday 08 October 2014 08:36:06 linden did opine
And Gene did reply:
> Hello
>      I have been reading along on this mailing list for a few weeks now
> and playing with Linuxcnc Axis simulator in my free time. Both have
> been very informative and I have learned a lot. There are two items I
> was wondering if I could get a comment on.
> 
> #1 Dose any one have a python script or other program that will
> calculate estimated machine time for a .ngc file. PyCam will give you
> an estimate for the Gcode it generates. I have looked through the
> source code and I cant find any thing. I have no programming back
> ground and don't know what I am looking for witch dose not help;-)
> 
> #2 Can some one have a look at the following .ngc code with sub routine
> and give me any suggestions or comments regarding the layout
> programming logic ect. Please be ruthless I have no programming or CNC
> back ground;-)
> 
> thank for sharing,
> 
>   Linden
> 
> 
> %
> ; Cutoff sub V1.0
> ; Written by hand Linden
> ;
> ;Copyright GNU Public License V3)
> ;Credit  - Igor Chudov, Original cutoff sub script
> ;I have hacked Igors original script to do what I needed and take all
> responsibility for the messiness as I am not a programmer at all
> ;---------------------------------------------------------
> ; Not Production Tested !!!!!   Feeds, depth of cut, and Speeds not set
> ;
> ; TO DO:  Determine spindle direction requirements set actual speeds
> and feeds
> ;-------------------------------------------------------
> ; Material
> ;    - Aluminum
> ;
> ; Procedure:
> ;    - Square off end of rough stock with multiple passes of end mill.
> Cut in one direction only, pull back in x plane for return for next
> path. ;
> ; Tools:
> ;    #4 1/2 end mill,
> ;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;; ; Subroutines used in this script:
> ;
> o<cutoff> sub
>    #<width> = #1   (Width of part in Y)
>    #<depth> = #2   (milling depth, negative)
>    #<milld> = #3   (end mill diameter)
>    #<frate> = #4   (milling rate)
>    #<zstep> = #5   (Z step, positive, optional if 0 uses half end mill
> diameter)
>    #<dir> = #6      (0 for X+ {right} end of material 1 for X- {left}
> end of material)
>    #<Sspeed> = #7  (Spindle Speed)
> 
>    #<extra> = [ #<milld>/2+0.01 ]; (Finnish cutting width of cut plus
> 1/2 cuter diameter plus 0.01 )
>    #<z> = 0
> 
> G91                (Set to relative Coordinates)
> 
> G0 Y[-#<extra>]
> 
> F #<frate>
> 
>      o<if1> if [ #<dir> EQ 0]
>          #<diroffset1> = [ -1 ]
>          #<diroffset2> = [ 1 ]
>          M3  S[#<Sspeed>]
>      o<if1> else
>          #<diroffset1> = [ 1 ]
>          #<diroffset2> = [ -1 ]
>          M4  S[#<Sspeed>]
>      o<if1> endif
> 
>      o<if2> if [#<zstep> EQ 0]
>          #<zstep> = [ #<milld>/2 ]
>      o<if2> endif
> 
>     o<loop1> while [ 1 ]
>      #<z> = [#<z> - #<zstep>]
>      #<zmove> = #<zstep>
> 
>          o<if3> if [#<z> LT #<depth>]
>              #<zmove> = [ #<zmove> - [#<depth> - #<z>] ]
>              #<z> = #<depth>
>          o<if3> endif
> 
>     G0 Z[ -#<zmove> ]
> 
>          o<if4> if [ #<dir> ]
>              G1 Y[[#<width> + 2*#<extra>]*[#<diroffset1>]]
>              #<dir> = 0
>          o<if4> else
>              X[[#<diroffset1>]*[#<extra>]]
>              G0 Y[-[#<width> + 2*#<extra>]*[#<diroffset1>]]
>              X[[#<diroffset2>]*[#<extra>]]
>              #<dir> = 1
>          o<if4> endif
> 
> 
>          o<if5> if [ #<z> LE #<depth>]
>          o<loop1> break
>          o<if5> endif
> 
>     o<loop1> endwhile
> 
> 
> G0 Z[[-#<depth>]+[#<extra>]] (Withdraw to safe height start height plus
> 1/2 cutter diameter)
> 
> G4 P3         (Dwell  for 1 second)
> 
> G90                (Set back to absolute Coordinates)
> 
> o<cutoff> endsub
> 
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;
> ; Clear and set Machine Parameters:
> 
> G17            (Contour plane is XY Z = spindle)
> G54            (Coordinate system 1 touch off zero not machine home)
> G20            (All units in inches G21 mm)
> G90            (Absolute Distances)
> G40            (Cancel diameter comp)
> G49            (Cancel length offset)
> G80            (Cancel Canned cycles)
> G94            (Feed/Minute mode)
> ;G64 Pn.n        (Path Blending how dose this work what sould i put for
> settings)
> 
> ;;;;;;;;;;;;;;;;;;;;;
> ; Start message for operator
> 
> (MSG, Cut off sub will be run twice cutting both ends of bar in fixture
> 1. Set fixture 1 in mill Part 0 reference is surface of material and
> centre of centre hole. Tool 4 is 1/2 inch end mill Press pause button
> to continue.)
> ;
> ;;;;;;;;;;;;;;;;;;;
> 
> ;;;;;;;;;;;;;;;;;;;;;
> ;Tool change and Program Start
> 
> M0            (Pause)
> 
> M6 T4 (Tool change tool 4)
> 
> G0 X-1.000 Y1.000 Z0.000 (Rapid to cut start position)
> 
> o<cutoff> call [2.00](Width of cut in Y) [-1.00](Total depth of
> cut,negative number) [0.500](end mill diameter) [150](Feed speed)
> [.125](Depth of cut each pass) [0](0 X+ right hand end 1 X- left hand
> end)  [1000] (Spindle Speed)
> 
> G0 X3.000 Y1.000 Z0.000 (Rapid to cut start position)
> 
> o<cutoff> call [2.00](Width of cut in Y) [-1.00](Total depth of
> cut,negative number) [0.500](end mill diameter) [150](Feed speed)
> [.125](Depth of cut each pass) [1](0 X+ right hand end 1 X- left hand
> end)  [1000] (Spindle Speed)
> 
> ;;;;;;;;;;;;;;;;;
> ;End program and home
> ;;;;;;;;;;;;;;;;;
> 
> G28            (Return to reference point "HOME Position")
> 
> M2            (end program)
> 
> %

This got well mangled with line wraps from our mailers, but I was able to 
salvage it and run it in my sim here.
2 or 3 comments I think.

1. Get rid of the comments within the call lines, put them more in the 
form of a comment line above, describing the vars function. 228 character 
lines run ok, but are difficult to handle when the editor itself has to 
screen wrap so you have no clue if the is an EOL there or not.

2. You are "dig" cutting, which is not the preferred method for gross 
material removal, and in alu is extra hard on the mill because the edge 
attack angle is so low as the edge enters the material that the oxide on 
the alu wears the bit 10-50x faster.  Changing to "climb" cutting will 
extend the life of the mill.  Considerably.

So will a mist of oil directed at the mill, which if done correctly, will 
seal the alu surface away from the oxygen in the air as its exposed by the 
cut, and reduce the amount of oxide that must be cut thru.  The mister 
will have the side effect of blowing away most if not all of the swarf so 
you aren't re-cutting the swarf, also hard on the mills cutting edges and 
leaving a poorer finish when it does recut.

3. If you pull down the file menu, there is a properties option there, 
which reports on the file including its estimated run time, in this case 
41 seconds.  But I have also noted that the estimator can be off quite a 
ways when estimating a program using subroutines.  Salt & season to suit 
IOW.

Also, your use of the G4 P3 is not a one second delay, but 3.

Obviously your mill must be 10x the size & power of my table topper, but 
the code runs here.  In the real world, I would like to see some of the 
vars you pass now hard coded in the call's made into a set of 
#<varname> = value
lines and then called in the call by referencing the #<varname> at that 
position in the o(name) call line.  Lots easier to fix something you may 
want to fine tune after watching it make the first cut when you only have 
one place to fix it and its global.

Other, more experienced hands might have comments and advice, but those 
are my impressions, based on about a decade of lcnc use.  I may be the old 
man of the hill here, but I am far from the most experienced.

However, as a first effort, I am personally impressed, you seem to have 
done your "homework". ;-)

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>
US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to