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)

%


------------------------------------------------------------------------------
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