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-15-12, 03:37 AM
CNC PROGRAMMER
 
Join Date: Feb 2012
Location: saudi arabia
Posts: 17
Thanks: 0
Thanked 1 Time in 1 Post
Default i interested to know macro programming

hello,
can you help me to make macro programming bolt circle 16 holes
for VTL750M-OiM Doosan model, vertical lathe..
Reply With Quote
  #2 (permalink)  
Old 02-15-12, 03:42 AM
Senior CNC Specialist
 
Join Date: Jan 2012
Posts: 172
Thanks: 0
Thanked 23 Times in 20 Posts
Default Re: i interested to know macro programming

Quote:
Originally Posted by angelito View Post
hello,
can you help me to make macro programming bolt circle 16 holes
for VTL750M-OiM Doosan model, vertical lathe..
I take it that your machine has full "C" axis control. Please confirm this.

Regards,

Bill
Reply With Quote
  #3 (permalink)  
Old 02-15-12, 03:52 AM
CNC PROGRAMMER
 
Join Date: Feb 2012
Location: saudi arabia
Posts: 17
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: i interested to know macro programming

yeah,
in main spindle
Reply With Quote
  #4 (permalink)  
Old 02-15-12, 08:00 AM
Senior CNC Specialist
 
Join Date: Jan 2012
Posts: 172
Thanks: 0
Thanked 23 Times in 20 Posts
Default Re: i interested to know macro programming

Quote:
Originally Posted by angelito View Post
yeah,
in main spindle
Sorry to drag this out, but if your control has POLAR COORDINATE INTERPOLATION (G12.1, G13.1) it will greatly influence the way in which the Macro Program is structured. If the control has this function, you will have the choice of two methods.
1. Polar Coordinate Interpolation allows the program to be written as if programming a machining centre without any regard to an angular move.
or,
2. Simply positioning the tool at the correct X coordinate and indexing the "C" axis the required angular move, 22.5 degrees for your 16 holes.

Which ever method is used, the Macro program should be written in such a way that the number of holes can be specified as an argument. If you were to create a Macro program to do 16 holes only, you may as well just long hand code the CNC program.

Both methods are quite easy to create a Macro program for. With the "C" axis index method, the only math required will be to divide 360 by the number of holes required, so as to obtain the incremental "C" axis index to apply in the Macro program.

Post back if you control has Polar Coordinate Interpolation. If so, I'll give you an example of both methods.

Regards,

Bill
Reply With Quote
  #5 (permalink)  
Old 02-15-12, 11:35 AM
CNC PROGRAMMER
 
Join Date: Feb 2012
Location: saudi arabia
Posts: 17
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: i interested to know macro programming

give me example macro programming both method 1 and 2...
Reply With Quote
  #6 (permalink)  
Old 02-15-12, 07:22 PM
Senior CNC Specialist
 
Join Date: Jan 2012
Posts: 172
Thanks: 0
Thanked 23 Times in 20 Posts
Default Re: i interested to know macro programming

Quote:
Originally Posted by angelito View Post
give me example macro programming both method 1 and 2...
Example code for method 2, where the tool is positioned at the PCD and the "C" axis indexed to next position; I'll do method 1 when I get a bit of time. Instead of calling the Macro program with G65, you could create a Custom "G" code by registering the number of the "G" code in parameter #6050 so as to call Macro program O9010. For example, if 101 is registered in #6050, the Macro program will be called as follows:

G101 D100.0 A0.0 B30.0 K6 C83 Q0 R1.0 S0 Z-8.0 F150

Where:
D = PCD
A = Start angle
B = Incremental index angle
K = Number of indexes
C = Cycle number. in the following example, cycles from G83 to G85 are accommodated. The Macro program could be expanded to accommodate more.
Q = Peck amount for G83 cycle
R = Retract level
S = Dwell at bottom of hole cycle
Z = Final Z coordinate
F = Feed Rate

or the Macro program can be called as follows using G65

G65 P9010 D100.0 A0.0 B30.0 K6 C81 Q0 R1.0 S0 Z-8.0 F150

Regards,

Bill

%
O9010
(A=#1)
(B=#2)
(C=#3)
(D=#7)
(F=#9)
(K=#6)
(Q=#17)
(R=#18)
(S=#19)
(Z=#26)

IF[#1EQ#0]OR[#2EQ#0]OR[#3EQ#0]OR[#7EQ#0]OR[#6EQ#0]GOTO100 (ERROR TRAP FOR MISSING DATA)
G00 X#7 C#1 M? (C AXIS CLAMP M CODE IF REQUIRED)
IF[#3LT83] OR [#3GT83]GOTO10
IF[#9EQ#0]OR[#26EQ#0]OR[#17EQ#0]OR[#18EQ#0]OR[#19EQ#0]GOTO100
G98 G83 Z#26 R#18 P#19 Q#17 F#9
GOTO30
N10
IF[#3LT84]OR[#3GT84]GOTO20
IF[#9EQ#0]OR[#18EQ#0]OR[#26EQ#0]GOTO100
G98 G84 Z#26 R#18 F#9
GOTO30
N20
IF[#3NE85]GOTO110 (INVALID CYCLE)
IF[#9EQ#0]OR[#18EQ#0]OR[#26EQ#0]GOTO100
G98 G85 Z#26 R#18 F#9
N30
#4=1 (COUNTER)
WHILE[#4LT#6K]DO1
#1=#1+#2
C#1 M? (C AXIS CLAMP M CODE IF REQUIRED)
#4=#4+1
END1
G80
GOTO120
N100
#3000=1(MISSING ADDRESS DATA)
GOTO120
N110
#3000=2(INVALID CYCLE)
N120 M99
%

Last edited by angelw; 02-15-12 at 08:43 PM.
Reply With Quote
  #7 (permalink)  
Old 02-15-12, 08:35 PM
CNC PROGRAMMER
 
Join Date: Feb 2012
Location: saudi arabia
Posts: 17
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: i interested to know macro programming

thank you angelw
i will try this immediately
Reply With Quote
  #8 (permalink)  
Old 02-15-12, 09:37 PM
Senior CNC Specialist
 
Join Date: Jan 2012
Posts: 172
Thanks: 0
Thanked 23 Times in 20 Posts
Default Re: i interested to know macro programming

Quote:
Originally Posted by angelito View Post
thank you angelw
i will try this immediately
Here is an example of PCD calcs used in conjunction with POLAR COORDINATE INTERPOLATION. I have not tested this, or the Macro in my previous Post. Accordingly, test in fresh air and in single block to check the tool positioning. In both examples, its a requirement that the Tool be positioned at the Initial Z level before calling the Macro program.

With both Macro programs, you could launch the required cycle in the main program before calling the Macro program, and only pass arguments relating to the PCD. In this case reference to the cycles and the associated error trapping would be deleted from the Macro program.

Ask any questions if you don't understand any part.

Regards,

Bill

G65 P9010 D100.0 A0.0 B30.0 K6 C81 Q0 R1.0 S0 Z-8.0 F150

%
O9010
(A=#1)
(B=#2)
(C=#3)
(D=#7)
(F=#9)
(K=#6)
(Q=#17)
(R=#18)
(S=#19)
(Z=#26)

IF[#1EQ#0]OR[#2EQ#0]OR[#3EQ#0]OR[#7EQ#0]OR[#6EQ#0]GOTO100 (ERROR TRAP FOR MISSING DATA)

G00 X#7 C#1 M? (C AXIS CLAMP M CODE IF REQUIRED)

IF[#3LT83] OR [#3GT83]GOTO10
IF[#9EQ#0]OR[#26EQ#0]OR[#17EQ#0]OR[#18EQ#0]OR[#19EQ#0]GOTO100
G98 G83 Z#26 R#18 P#19 Q#17 F#9
GOTO30
N10
IF[#3LT84]OR[#3GT84]GOTO20
IF[#9EQ#0]OR[#18EQ#0]OR[#26EQ#0]GOTO100
G98 G84 Z#26 R#18 F#9
GOTO30
N20
IF[#3NE85]GOTO110 (INVALID CYCLE)
IF[#9EQ#0]OR[#18EQ#0]OR[#26EQ#0]GOTO100
G98 G85 Z#26 R#18 F#9
N30
G12.1 Start of polar coordinate interpolation
#4=1 (COUNTER)
#1=0
WHILE[#4LT#6K]DO1
#1=#1+#2
You could have the following block
X[COS[#1 * #7]] C[SIN[#1*[#7/2]]] M? (C AXIS CLAMP M CODE IF REQUIRED)
or the following instead of the above block
#24=[COS[#1 * #7]]
#25=[SIN[#1*[#7/2]]]
X#24 C#25 M? (C AXIS CLAMP M CODE IF REQUIRED)
#4=#4+1
END1
G80
G13.1 Cancellation of polar coordinate interpolation
GOTO120
N100
#3000=1(MISSING ADDRESS DATA)
GOTO120
N110
#3000=2(INVALID CYCLE)
N120 M99
%

Last edited by angelw; 02-15-12 at 11:50 PM.
Reply With Quote
  #9 (permalink)  
Old 02-16-12, 05:13 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: i interested to know macro programming

Quote:
Originally Posted by angelw View Post
IF[#1EQ#0]OR[#2EQ#0]OR[#3EQ#0]OR[#7EQ#0]OR[#6EQ#0]GOTO100 (ERROR TRAP FOR MISSING DATA)
Hello Bill,
I have never used an IF statement with a string of OR before like that. Is there any controls that are specific to this or is this SOP for most Fanucs.

Steve

(The opinions in this post are my own and not those of machinetoolhelp.com and its management)
Reply With Quote
  #10 (permalink)  
Old 02-16-12, 10:37 PM
Senior CNC Specialist
 
Join Date: Jan 2012
Posts: 172
Thanks: 0
Thanked 23 Times in 20 Posts
Default Re: i interested to know macro programming

Quote:
Originally Posted by Stevo View Post
Hello Bill,
I have never used an IF statement with a string of OR before like that. Is there any controls that are specific to this or is this SOP for most Fanucs.

Steve
Hi Steve,
To tell the truth, I've not used that number of OR's in one string before, however, I've used IF[#1EQ#0]OR[#2EQ#0]OR[#3EQ#0]TH (whatever) many times with all manner of Fanuc controls. In terms of logic, there should be no reason why
IF[#1EQ#0]OR[#2EQ#0]OR[#3EQ#0]OR[#7EQ#0]OR[#6EQ#0]GOTO100
would not work.
Whatever is legal in a High Level language such as BASIC and all its derivatives, or Pascal, will work just fine in Fanuc User Macro. The above conditional block is quite legal in any of the aforementioned languages. Therefore, it would be SOP for all Fanuc controls equipped with User Macro B.

As you well know, the above conditional block could be broken up into a number of single conditional blocks:
IF[#1EQ#0]GOTO100
IF[#2EQ#0]GOTO100
etc
or, a number conditional ORs:
IF[#1EQ#0]OR[#2EQ#0]GOTO100
IF[#3EQ#0]OR[#7EQ#0]GOTO100
etc
In my opinion, the single, multiple OR's is a tidier way of doing it, but a number of single conditional blocks is marginally easier to debug. In single block, you can tell easily which block tests true. In the single, multiple OR conditional block, any bracketed comparison set testing True will trigger the GOTO100 statement. Having said that, its not much of a chore to look up the variable values in the Macro Variable page to see which variable is <vacant>.

Regards,

Bill

Last edited by angelw; 02-17-12 at 01:56 AM.
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:12 PM.

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