PDA

View Full Version : Need Help! Trying to drill holes in an angle



malare
08-22-2016, 04:09 AM
I need to set G17.1 for drilling angled holes in the RhinoCAM postprocessor.
How to do that? Do I have to use a macro?

Per

beezerlm
08-22-2016, 09:37 AM
You can setup a custom machine cycle that contains that code, then when you want to call it up you can drag it into your MOP set where ever you want it to go. There are several ways to do what you are looking for, but I would need more detail with examples of what you have now and what you want it to look like. Customizing the post in RhinoCam isn't hard once you get used to it.

malare
08-22-2016, 11:49 AM
I want to drill 115 holes in a brush. They all have different angles. I've added a picture so you will understand what it looks like.
331378

I have tried several drilling methods but they all use canned cycles and this wont work with my machine.

My machine has an A-axis which is rotating the spindlemotor and a B-axis which is rotating the workpiece.
I must find a way to workaround the canned cycles which only moves along the Z-axis.

malare
08-22-2016, 11:53 AM
This is the beginning of the code I have now. I'm running Linux-CNC.

%
G17 G21 G40 G90.1
(Setup 1)
G1 B-10.3 A-9.8 F5000.
(Standard Drill )
T22 M6
S18700 M3 G4 P2
G1 X-13.467 Y-26.114 Z8.271 F5000.
G73 X-13.467 Y-23.316 Z-22.858 R0.142 Q4. F2800.0
G80
G1 Y-26.114 Z8.271 F2800.
(Setup 2)
G1 B-10.3 A-9.1 F5000.
(Standard Drill )
X-13.466 Y-18.367 Z9.415 F5000.
G73 X-13.466 Y-15.668 Z-22.458 R0.542 Q4. F2800.0
G80
G1 Y-18.367 Z9.415 F2800.
(Setup 3)
G1 B-10.3 A-8.2 F5000.
(Standard Drill )
Y-10.206 Z10.408 F5000.
G73 X-13.466 Y-7.686 Z-22.036 R0.964 Q4. F2800.0
G80
G1 Y-10.206 Z10.408 F2800.
(Setup 4)
G1 B-10.2 A-7.2 F5000.
(Standard Drill )
Y-1.318 Z11.208 F5000.
G73 X-13.466 Y0.916 Z-21.578 R1.422 Q4. F2800.0
G80
G1 Y-1.318 Z11.208 F2800.
(Setup 5)
G1 B-10.2 A-6.3 F5000.
(Standard Drill )
Y6.982 Z11.767 F5000.
G73 X-13.466 Y8.959 Z-21.24 R1.76 Q4. F2800.0
G80
G1 Y6.982 Z11.767 F2800.
(Setup 6)
G1 B-10.2 A-5.5 F5000.
(Standard Drill )
X-13.465 Y14.887 Z12.143 F5000.
G73 X-13.465 Y16.626 Z-20.982 R2.018 Q4. F2800.0
G80
G1 Y14.887 Z12.143 F2800.

beezerlm
08-22-2016, 01:08 PM
Do you have a 4 or 5 axis seat of RhinoCam? This may be more than a 3 axis seat can handle without manually editing the code. I am only familiar with the 3 Axis advanced seats.

Do you know what you need it to look like in the end? I am assuming the G17.1 is for moving a U and a V axis in LinuxCNC controler? U axis being parallel to X axis, and V axis being parallel to Y axis correct?

I have a machine running LinuxCNC so I am somewhat familiar with it, but it is only a 2 axis setup so I may not be very helpful there.

Another option would be to build a RhinoPython Plugin That modifies your post output after posting, but that would take some time and coding experience.

malare
08-22-2016, 01:30 PM
I have the Pro version, 5-axis indexed.

beezerlm
08-22-2016, 01:35 PM
Can you provide a sample of the g-code modified to what your machine needs?

malare
08-22-2016, 03:22 PM
Something like this: (I don't know if this is correct)

G1 B-10.3 A-9.8 F5000. (Turn the rotary axis)
G1 X-13.467 Y-26.114 Z8.271 F5000. (Go to start point)
X-13.467 Y-23.316 Z0.142 F2800.0 (Startpoint for drilling)
G21 G91 (Is this the correct command?)
Y? Z-15.000 (I want the drill to go down 15 mm in the same direction as the earlier move. I believe I have to give a Y and Z command, because the motor with drill is rotated. But how do I get the values from the -9.8 angle?)
Y? Z15.000 (Going back up the hole)
G21 G90 (resetting the command)
G80
Y-26.114 Z8.271 F2800. (Go from drillpoint to startpoint)

And then there is 114 more holes with other angles.

Or could this be done with G17.1?

beezerlm
08-22-2016, 04:11 PM
I think I see what you are looking for now. I don't believe G17.1 is what you are looking for here, but I could be wrong. There is a G10 command in Linux cnc to rotate your coordinate system, but it appears it will only rotate around the Z-axis: G Codes (http://linuxcnc.org/docs/2.5/html/gcode/gcode.html#sec:G10-L2_) . I believe you would need to rotate your coordinate system around the X axis to match your A axis rotation. Then a Z depth command would move both Z and Y depending on the angle of rotation. If you are unable to rotate your coordinate system like this in LinuxCNC, you would have to program the Z and Y positions for each move on the angle. It looks like this has been discussed before here: https://forum.linuxcnc.org/forum/20-g-code/28020-coordinate-system-how-to-rotate-about-x-axis


I think it would be a good Idea to figure out the best way to do this with the LinuxCNC control first so you know which codes you need, then get RhinoCam to output the code the way you need it.

awerby
08-22-2016, 05:03 PM
It seems like the simplest way, if you're planning to do a lot of these, would be to build a fixture that holds the workpiece so it rotates around the line parallel to the X axis on which the lines of holes along Y converge. Then you could tilt the spindle progressively as the drilling proceeds to the center, along X, and back again as it passes it. Have you asked Mecsoft tech support for help? They're pretty good at showing you how to proceed with problems like this, taking over your computer so you can follow along on your screen.

malare
08-23-2016, 03:06 AM
After reading your links I believe that the solution must be to do trigonometric calculations to get the direction.
Can you write an expression in a user defined drill in RhinoCAM?

Your last suggestion which of course should be easiest is not possible unless I rebuild my machine.

beezerlm
08-23-2016, 09:32 AM
In my last suggestion I was referring to rotating your machine coordinate system around the X axis in the LinuxCNC control. If you were able to do that, the control would handle the trig for you. If you programmed Z-15.0 it would move the Y and Z axis to produce the required angle. I don't know if this is possible with LinuxCNC though.

I don't think you can add your own code to the user defined cycles, but it would be great if you could.

You may want to give Mecsoft a call to see what they suggest. Seeing as how you have a 5 axis seat, there may be some nice tools that I am unaware of that would help you out.

malare
08-23-2016, 11:56 AM
I have good contact with our support here in Sweden and he has helped me a lot, but he is not so well acquainted with Linux.

I have now solved the problem but it was not easy because I had to do a lot of editing of the code from RhinoCAM.
I found out that it was not possible to write a user drill which gave a correct output for LinuxCNC because of the parentheses rules.

I got this from RhinoCAM:

G1 X-13.467 Y-26.114 Z8.271 F5000.
X-13.467 Y-23.316 Z-7.858 F2800.0
G21 G91
YSIN-9.8*-22.858 Z-15.000
Y-SIN-9.8*-22.858 Z15.000
G21 G90
G80
Y-26.114 Z8.271 F2800.

and I have edited it to this which works in LinuxCNC:

G1 X-13.467 Y-26.114 Z8.271 F5000.
X-13.467 Y-23.316 Z-7.858 F2800.0
G21 G91
Y[SIN[-9.8]*-22.858] Z-15.000
Y-[SIN[-9.8]*-22.858] Z15.000
G21 G90
G80 G1
Y-26.114 Z8.271 F2800.

The user defined drill looks like this:
331532

Thank you very much anyhow for your help

Per

beezerlm
08-23-2016, 12:55 PM
Glad you got something figured out.

If this is something you have to do often, and you are familiar with a coding language like Python or Java, you could write a program that makes the changes automatically to the raw G-code after it's posted. I made a program in Java a few years back that takes two 2-Axis programs and merges them into one 4-Axis program for our wire edm. It works well and saves us from having to spend a lot of time using the find/replace commands.

malare
08-23-2016, 02:36 PM
Well, I do not believe that I will have to do this often.
This is done for a designer who has a lot of ideas which he comes to me with and asks if I can solve it. Next time it can be something quite different.

My eldest son is a programmer so if I can't fix it myself I usually ask him.