Helical milling with a diagonal repeat ?

More
15 years 10 months ago #5946 by ArcEye
Replied by ArcEye on topic Re:Helical milling with a diagonal repeat ?
Hi,

Looking at your 2ndattempt.ngc, I'm afraid that at a very basic level you have failed to appreciate what Andy was doing in his first reply.

Sub(routine)s are discrete portions of code which do a particular task, the exact details of which are determined by the parameters passed to them.

They are declared either in the main gcode file (at the foot of it normally) or in separate files.
O123 sub
code here using params passed
O123 endsub

They must be called by the main program with the
O123 CALL [param1] [param2] etc syntax

A psuedo program block might be

Initial settings
Move to first hole position
do{
CALL sub to cut hole
More holes to cut? -> move to next one
}while(more holes to cut) - loop again
Move to safe position
End program

If you keep the actual code simple (just drilling a hole) and go back to the original reply and work from that, hopefully it will become clear and you can build up from there.

regards

ArcEye

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

More
15 years 10 months ago - 15 years 10 months ago #5947 by grey1beard
Replied by grey1beard on topic Re:Helical milling with a diagonal repeat ?
ArcEye wrote:

........I'm afraid that at a very basic level you have failed to appreciate what Andy was doing in his first reply.......

Hi ArcEye.
This is the story of my life.
Thanks for your input which I shall study.
It will be a bonus for me to find better ways of coding, for it was a hard slog to get to the stage now where the code actually does what I need it to do.
Regards
John
Last edit: 15 years 10 months ago by grey1beard.

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

More
15 years 10 months ago #5961 by ArcEye
Replied by ArcEye on topic Re:Helical milling with a diagonal repeat ?
Hi

I'm not able to get to my workshop to test it, so there may be a stupid error in it, but this is a simple example of what I am trying to explain.
Also shows that using labels makes it all much more readable.

Unless you want to re-use code with different files, the sub routine is most easily located at the foot of the same file, rather than a separate file.

Once you have your head around this, you can make the sub routine do your helical mill and use the loop in the main section to move between hole positions.

;;**********************************************************************************************

(Mill diagonal series of holes at X20 Y20 offsets from corner of workpiece)

G17 G21 G40 G49 G54 G80 G90 G94

(global labels have leading underscore)
#<_Holes> = 5
#<_Counter> = 0
#<_X_offset> = 20
#<_Y_offset> = 20
#<_TopZ> = 5
#<_BottomZ> = -10
#<_Feed> = 200
#<_Z_Feed> = 20

G28
M3 S600
M7
(position over corner)
G00 X0 Y0 Z20
G00 Z#<_TopZ>

O100 WHILE[#<_Counter> LT #<_Holes>]
G91
G00 X#<_X_offset> Y#<_Y_offset>
G90
O101 CALL
#<_Counter> = [#<_Counter> + 1]
ENDWHILE

G28
M5
M9
M30
M2

;;*************************************************************************************************

O101 sub
(Local sub so uses the global parameters)
G01 Z#<_BottomZ> F#<_Z_Feed>
G00 Z#<_TopZ>
O101 endsub

hope this helps
regards

ArcEye

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

More
15 years 10 months ago #5966 by grey1beard
Replied by grey1beard on topic Re:Helical milling with a diagonal repeat ?
As a first step to enlightenment, I turned your code example(many thanks) into a file "example.ngc" and placed in my emc2/nc folder, the idea being to get a look at it in 3d as well as reading the code.
Then I loaded AXIS sim, and opened the file, but it gives me an error "unable to open file <101>.
I have an idea that the call file needs to be loaded separately, also into the nc folder, but I'm not sure if this is so, or the details of how to do it.
Can you put me right on this ?
Many thanks
John

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

More
15 years 10 months ago #5969 by BigJohnT
Replied by BigJohnT on topic Re:Helical milling with a diagonal repeat ?
John,

You can put the o100 sub at the top of the file or create a file called 100.ngc and make sure you have a M2 at the end of the 100.ngc file if you do it that way.

www.linuxcnc.org/docview/html/gcode_main.html#r3_7

John

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

More
15 years 10 months ago - 15 years 10 months ago #5972 by grey1beard
Replied by grey1beard on topic Re:Helical milling with a diagonal repeat ?
Thanks John. Once I'd got the file named correctly it worked fine.

Thanks ArcEye. I now have another bit of coding I can start to use.

And thanks to Andy for getting the ball rolling.

Regards,
John
Last edit: 15 years 10 months ago by grey1beard.

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

Time to create page: 0.135 seconds
Powered by Kunena Forum