|
| |||||||
| Home | Recent Posts | HELP-FORUMS (ask/answer) | Classifieds-free | File Sharing / Documents | Photo Galleries | Polls | Newsletter | Machinetoolhelp.com. |
| Programming / Applications All CNC programming, CNC applications, milling, turning, tooling, macro programming, and other CNC machine tool related questions. |
![]() |
| | Bookmark or Share | Thread Tools | Search this Thread | Display Modes |
| |||
|
Hi All, Following is my answer to a question asked in another Forum. I'm Posting it here for the benefit of those who frequent this Forum, and my be interested. This Macro program calculates the Centre X Y coordiantes, and the Radius of a circle, the circumference of which, passes through any three points. The program is started, and each time the Operator Message prompts "MAN TOUCH", select Hand Wheel to make the touch. Once the touch is made, select Auto Mode and press Cycle Start to record the current X Y coordinates. The process of "MAN TOUCH" prompt, manual touch with Hand Wheel, and coordinate recording by pressing Cycle Start will repeat until all three points have been recorded. If the control has the infrastructure for Auto contact with a Probe, the High Speed Skip G31 will be used if the control is by Fanuc, and no Manual intervention will be required. In this case, the probe could be roughly positioned in the centre of the circle/arc to be measured, and a diameter roughly equal to the proposed circle/arc to be measured passed as an argument by the Macro Call block. For example: G65 P9081 D100.0 S2 (D100.0 being the rough diameter of the feature to be measured) Post any questions you may have. Regards, Bill The following is a conversion of a routine I wrote for a CAM software package. Accordingly, I haven't tested it on a machine as a User Macro program. However, I don't think I've made any mistakes so it should be right to go. Test it in fresh air first. Post back with result. If you use it to set a Work Shift, you could pass the Work Shift number to set in the Macro Call block. For example: G65 P9081 S2 Where S value 1 = G54 2 = G55 3 = G56 4 = G57 5 = G58 6 = G59 Then in the macro #[5201+[20*[#19]]]=#15 (X WORK SHIFT) #[5202+[20*[#19]]]=#16 (Y WORK SHIFT) Obviously the above two Macro statement go at the bottom of the following program after all calculations have been completed. Regards, Bill % O9081(CIRCLE THROUGH 3 POINTS MACRO) #3006=1 (MAN TOUCH 1 - CYCLE START) #3006=0 #1=#5021 (1ST X) #2=#5022 (1ST Y) #3006=1 (MAN TOUCH 2 - CYCLE START) #3006=0 #3=#5021 (2ND X) #4=#5022 (2ND Y) #3006=1 (MAN TOUCH 3 - CYCLE START) #3006=0 #5=#5021 (3RD X) #6=#5022 (3RD Y) (GET PERPENDICULAR BISECTOR OF #1, #2 and #3, #4) #7 = [#3 + #1] / 2 #8 = [#4 + #2] / 2 #9 = #3 - #1 #10 = -[#4 - #2] (GET PERPENDICULAR BISECTOR OF #3, #4 and #5, #6) #11 = [#5 + #3] / 2 #12 = [#6 + #4]/ 2 #13 = #5 - #3 #14 = -[#6 - #4] (SEE WHERE THE LINES INTERSECT) (X-CENTRE) #15 = [#8 * #10 * #14 + #11 * #10 * #13 - #7 * #9 * #14 - #12 * #10 * #14] / [#10 * #13 - #9 * #14] (Y-CENTRE) #16 = (#15 - #7) * #9 / #10 + #8 (RADIUS) #17= SQRT[ [ [#1-#15]* [#1-#15] ]+[ [#2-#16]*[#2-#16] ]] ............. Rest of program ............. Do whatever you want with the Centre and Radius information. For example: 1. Register as Work Shift Offset, 2. Rapid or feed to X#15 Y#16 3. Whatever M99 % Last edited by angelw; 02-08-12 at 02:40 AM. |
| |||
|
Very cool Bill.....thanks for the program. I am looking forward to goofing around with it when I get some free time. Well I guess that means I will not goof around with it but I will definitely be adding it to my archives for a rainy day. Steve (The opinions in this post are my own and not those of machinetoolhelp.com and its management) |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
| |