CNC
CNC lathes and CNC mills repair,
CNC machine repair forums for machinists, cnc programing and manufacturing community.   
   CNC Store
Go Back   CNC Professional Forums > CNC Machinst Help & CNC Troubleshooting Forums > Programming / Applications
Members List Calendar Register FAQ/Rules/Policies Mark Forums Read
Home Recent Posts HELP-FORUMS (ask/answer) Classifieds-freeFile 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.

Reply
 
Bookmark or Share Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-12, 06:51 PM
Senior CNC Specialist
 
Join Date: Jan 2012
Posts: 172
Thanks: 0
Thanked 23 Times in 20 Posts
Default Usere Macro - Circle through 3 points

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.
Reply With Quote
The Following 2 Users Say Thank You to angelw For This Useful Post:
MMMMM (02-09-12), Stevo (02-08-12)
  #2 (permalink)  
Old 02-08-12, 08:11 PM
CNC Moderator
 
Join Date: May 2008
Location: Great State of Wisconsin
Posts: 1,045
Thanks: 6
Thanked 82 Times in 78 Posts
Default Re: Usere Macro - Circle through 3 points

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)
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
IMPORTANT DISCLAIMER
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Although The CNC Professional Forum has attempted to provide accurate information on the forum, The CNC Professional Forum assumes no responsibility for the accuracy of the information. All information is provided "as is" with all faults without warranty of any kind, either express or implied. Neither The CNC Professional Forum nor any of its directors, members, managers, employees, agents, vendors, or suppliers will be liable for any direct, indirect, general, bodily injury, compensatory, special, punitive, consequential, or incidental damages including, without limitation, lost profits or revenues, costs of replacement goods, loss or damage to data arising out of the use or inability to use this forum or any services associated with this forum, or damages from the use of or reliance on the information present on this forum, even if you have been advised of the possibility of such damages.


All times are GMT -5. The time now is 04:08 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
| Copyright ©2010-2011 CNC Professional Forum LLC
CNC Machinist Forums