millmultiple3

More
06 Nov 2013 16:43 - 06 Nov 2013 19:46 #40578 by Rick G
millmultiple3 was created by Rick G
This is an updated version of millmutiple.

With this version you can select:

The part file to run.
Rotation of part.
Where to start the first part.
The distance between parts.
The direction of the parts.
How many parts.
The coordinate system to use.
The tool to use for tool radius compensation.
The feed rate.

Requires check_cord3.ngc and M110.

The concept of this untested sub is to take a part or pattern file and duplicate it as many times as necessary in what ever direction you wish using the ngcgui.
This was set up for XYZ machine such as a mill/router/plasma.

With this sub you should be able to take your existing part file and duplicate it.
; millmultiple3
; run multiple copies of an existing ngc file for xyz machine such as mill/router/plasma
; set start location, and offset locations in x and y direction
; existing ngc file must be a sub and have a numerical name such as 503.ngc in example
; part can be rotated
; 3/17/2011
; edit 9/1/2013
; edit 10/11/2013
; uses check_cord3.ngc and M110

o<millmultiple3> sub

#<part> =                #1 (=503 File to machine)
#<part_rotate> =   #2 (=0 Part rotate deg.)
#<Copies> =          #3 (=3 Copies)
#<X_Offset> =        #4 (=4.00 X Offset)
#<Y_Offset> =        #5 (=3.00 Y Offset)
#<Z_travel_pos> = #6 (=.025 Z safe travel)
#<X_Start> =           #7 (= 0 X Start position)
#<Y_Start> =           #8 (= 0 Y Start position)
#<Tool_no>	 =       #9 (= 2 Tool Number)
#<Feed_rate> =     #10 (= 100 Feed rate)
#<Z_feed_rate> =  #11 (= 10 Z rate) 
#<RPM>   =            #12 (= 500 Spindle RPM)
#<Main_cord> =    #13 (= 54 Main G cord)
#<Temp_cord> =    #14 (= 55 Temp G cord)

#<X_TOT> = #<X_Start>
#<Y_TOT> = #<Y_Start>

G17 (xy plane)
G20 (inches)
G40 (cancel cutter radius compensation)
G49 (cancel tool length offset)
G90 (absolute distance mode)
G94 (units/min feed rate)
G64 P.001 Q.001 (set path tolerance)

;set global parameter
#<_m:cord> = 0
#<_t:cord> = 0

;obtain coordinate number
o<check_cord3> call [#<Main_cord>] [#<Temp_cord>]
#<Main_cord_n> = #<_m:cord>
#<Temp_cord_n> = #<_t:cord>

;reset global parameters
#<_m:cord> = 0
#<_t:cord> = 0

o801	if [#<Temp_cord_n> EQ 0]
	(debug, bad Temp cord #<Temp_cord_n>) 
	o800 return
o801   endif

o901	if [#<Main_cord_n> EQ 0]
	(debug, bad Main cord #<Main_cord_n>) 
	o900 return
o901   endif

(debug, Main cord #<Main_cord> Main cord num #<Main_cord_n>) 
(debug, Temp cord #<Temp_cord> Temp cord num #<Temp_cord_n>)


;go to start position
G#<Main_cord>
F#<Feed_rate>
M6 T#<Tool_no>
G0 Z#<Z_travel_pos>
G0 X#<X_Start> Y#<Y_Start>
G10 L20 P#<Temp_cord_n> X0 Y0 Z#<Z_travel_pos> (set Temp cord)
G10 L2 P#<Temp_cord_n> R#<part_rotate> (set part rotation)
G#<Temp_cord> 

o800 if [#<_feature:> eq 0]
 M3 (Spindle on forward)
 (debug, Spindle on, pause for Spindle to reach speed)
 G4 P1 (pause for spindle to reach speed)
 M110 (clear messages)
 (debug, Spindle on) 
o800 endif

o100 while [#<Copies> gt 0]
  G0 Z#<Z_travel_pos>
  o#<part> call [#<Tool_no>] [#<Feed_rate>] [#<Z_feed_rate>]
      o102 if [#<Copies> gt 1]
       G40 (turn off tool radius offset so G10 can work)
       #<X_TOT> =[#<X_TOT> + #<X_Offset>]
       #<Y_TOT> =[#<Y_TOT> + #<Y_Offset>]
       G#<Main_cord>
       G0 Z#<Z_travel_pos>
       G0 X#<X_TOT> Y#<Y_TOT>
       G#<Temp_cord>
       G10 L20 P#<Temp_cord_n> X0 Y0 (set X and Y cord)
      o102 endif
  #<Copies>=[#<Copies>-1]
 o100 endwhile

G40 (turn off tool radius offset)
G#<Main_cord>
G0 Z#<Z_travel_pos>
G0 X#<X_TOT> Y#<Y_TOT>
G10 L2 P#<Temp_cord_n> R0
G10 L20 P#<Temp_cord_n> X#<X_TOT> Y#<Y_TOT>
M5(spindle off)
M110 (clear messages)
o<millmultiple3> endsub

To try just make your part file a sub by..

Name the part file with a numerical name (say 503.ngc)
Make the file a sub by

Start and end the file with...

o<filename> sub
(not_a_subfile)

#<Tool_no> = #1
#<Feed_rate> = #2
#<Z_feed_rate> = #3

;;;lines of code;;;


o<filename> endsub

Be sure to have all files in the correct directory.

For example the file 503.ngc is
o<503> sub

(not_a_subfile)

; sample file for millmultiple3 not for actual machining

#<Tool_no>	 =     #1
#<Feed_rate> =    #2
#<Z_feed_rate> =  #3

G0 z.025
F#<Feed_rate>
G0 x0 y0 z.010
G41 D#<Tool_no>
G0 x-.75
F#<Z_feed_rate>
G1 z0 
F#<Feed_rate>
G3 x-.75 y0 z-.125 i.75
G3 x-.75 y0 z-.125 i.75
G0 z.025
G0 x-2 y1.5
F#<Z_feed_rate>
G1 z0 
F#<Feed_rate>
G1 x2 z-.125
G1 y-1.5
G1 x-2
G1 y1.5
G1 x2
G0 z.025


o<503> endsub




Because ngcgui allows you to string several subs together before you finalize you should be able to set up several rows and columns of the part.
Again this is untested and you will probably only want to use this as a starting point to fit your needs.




I also have a slightly different version which creates rows and columns of parts which I will post latter.


Rick G
Attachments:
Last edit: 06 Nov 2013 19:46 by Rick G.
The following user(s) said Thank You: BigJohnT

Please Log in or Create an account to join the conversation.

Time to create page: 0.093 seconds
Powered by Kunena Forum