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 01-11-12, 02:08 AM
Guren
Guest
 
Posts: n/a
Default My first custom macro Error 004

Hi, I made my first custom macro, but when I run it I get an error 004, I have quadro-checked all but I was not able to find any mistake on my part. Since its my first time, Maybe im doing something wrong?

Error 004 - ADDRESS NOT FOUND A numeral or the sign “ – ” was input without an address at the beginning of a block. Modify the program .

I call the macro with the following line:
Code:
N1 G65 P9011 A29.5 B-30 C12.5 D100 E0.11 F-1

Error is being shown when I get to this line:
G96 S#7                    # Set Constant Surface speed


# Parametres
# ====================================================================
# Param.A(#1) Shows outer diameter of the final detail                X29.5
# Param.B(#2) Lenght of the detail (How far to move the tool)        Z-30
# Param.C(#3) Inner hole Outer diameter (cut until reach the hole)    X12.5    
# Param.D(#7) constant surface Speed m/mm                            S100
# Param.E(#8) Cutting speed                                            F0.11
# Param.F(#9) After cutting it off cut X.millimeters deeper            X..-1

# Explanation
# ====================================================================
# Macro is ment to cut off a detail with an inner hole
# It will also Remove sharp edge from the right side
# Uses Catcher, Constant surface speed limit is set to S1000
    CSS limit can be altered in a subprogram 9011

# Program 9011
# ====================================================================
% 
:9011
N1 G50 S1000 M3            # Set Spindle speed limit to 1000 rpm
T0101                    # Swap tool
G97                        # Cancel Constant Surface speed
G96 S#7                    # Set Constant Surface speed
G0 X#1+1 Z#2-3            # Move fast, G0, to the detail cutting off position X(Detail Diam. + 1mm) Z(-Detail lenght)
G1 X#1 F0.3 M8            # Move slowly, G1, to the detail cutting off position X(Detail Diam.)
X#1-1.2 F#8                # Make a small cut X(Detail Diam.) -1.2 mm
X#1+0.2 F3                # Move back top, X(Detail Diam.) +0.2 mm
X#1 Z#2+0.6 F0.3        # move right Z(-Detail lenght) + 0.6
G3 X#1-1.2 Z#2 R0.6 F0.1# Radius 0.6 (Removing sharp edge hire)
#20=#3-0.2                # Make new var (store inner hole outer diam) -0.2mm value hire
X#20 F#8                # Cut until (inner hole outer diam) -0.2mm
M70                        # open catcher
G97 S900                # Cancel Constant Surface speed & set spindle speed to 900 rpm
#21=#20-1                # make new var
X#21 F0.04                # cut off the detail
M74                        # close the catcher
X#21-#9 F#8                # Cut a bit more down (clean up leftover rubbish just in case)
G0 Z#2+0.2                # this & next 3 lines move the tool away
G0 X150 M9
G0 Z150
M99
%
Reply With Quote
  #2 (permalink)  
Old 01-11-12, 07:35 AM
Senior CNC Specialist
 
Join Date: Dec 2011
Location: Illinois / Wisconsin border
Posts: 123
Thanks: 26
Thanked 5 Times in 5 Posts
Default Re: My first custom macro Error 004

I get an "ARC ERROR" on the "X#20 F#8" line ... modal G3 interpreted without I,J,K or R

Actually, I get an error on the other two X commands after your G3 too

...still working on your G96

Last edited by MMMMM; 01-11-12 at 07:42 AM.
Reply With Quote
  #3 (permalink)  
Old 01-11-12, 07:53 AM
Senior CNC Specialist
 
Join Date: Dec 2011
Location: Illinois / Wisconsin border
Posts: 123
Thanks: 26
Thanked 5 Times in 5 Posts
Default Re: My first custom macro Error 004

ok ... I'm also getting a goofy arc move after you re-assign the #20 variable within the macro.
I believe this nests it to a new level and doesn't calculate it properly.
Try using an unused variable instead of recalculating the existing one (#20) as the value changes from 12.3 to -.2 within the sub (macro)

.. #21 is recalculated too; from 11.3 to -1.2
Reply With Quote
  #4 (permalink)  
Old 01-11-12, 07:59 AM
Senior CNC Specialist
 
Join Date: Dec 2011
Location: Illinois / Wisconsin border
Posts: 123
Thanks: 26
Thanked 5 Times in 5 Posts
Default Re: My first custom macro Error 004

attached is modified and ploted
Attached Thumbnails
My first custom macro Error 004-macro_pic.jpg  
Reply With Quote
  #5 (permalink)  
Old 01-11-12, 08:58 AM
Senior CNC Specialist
 
Join Date: Dec 2011
Location: Illinois / Wisconsin border
Posts: 123
Thanks: 26
Thanked 5 Times in 5 Posts
Default Re: My first custom macro Error 004

path plotted
Attached Thumbnails
My first custom macro Error 004-macro1.jpg  
Reply With Quote
  #6 (permalink)  
Old 01-12-12, 01:15 AM
Guren
Guest
 
Posts: n/a
Default Re: My first custom macro Error 004

Quote:
Originally Posted by MMMMM View Post
attached is modified and ploted
The image you posted is so small that I can not see anything on this image. Can you please repost it with readable size. ?

also what software did you use to plot it?
Reply With Quote
  #7 (permalink)  
Old 01-12-12, 10:51 AM
Senior CNC Specialist
 
Join Date: Dec 2011
Location: Illinois / Wisconsin border
Posts: 123
Thanks: 26
Thanked 5 Times in 5 Posts
Default Re: My first custom macro Error 004

Guren - I've sent you a PM
Reply With Quote
  #8 (permalink)  
Old 01-13-12, 04:56 AM
CNC Tech
 
Join Date: Jan 2012
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
Default Re: My first custom macro Error 004

Quote:
Originally Posted by MMMMM View Post
Guren - I've sent you a PM
This is interesting, looks like my account was deleted for some reason so I didnt receive your pm. I registered new acc with same name & hire i am now.

In any case I solved the problem:

X#2+1

Thats right, this was the cause of all problems.

Turns out you can ether write it like this:

X[#2+1]

or
#20=#2+1
X#20


After I rewrote the code using expression all worked fine. I also checkked the manual again & indeed, it does not say that you can not write code like I tried above.

So yes this is something to keep in mind when writing a macro.
Reply With Quote
The Following User Says Thank You to Guren For This Useful Post:
MMMMM (01-13-12)
  #9 (permalink)  
Old 01-13-12, 10:02 AM
CNC Moderator
 
Join Date: May 2008
Location: Great State of Wisconsin
Posts: 1,045
Thanks: 6
Thanked 82 Times in 78 Posts
Default Re: My first custom macro Error 004

Quote:
Originally Posted by Guren View Post
This is interesting, looks like my account was deleted for some reason so I didnt receive your pm. I registered new acc with same name & hire i am now.

In any case I solved the problem:

X#2+1

Thats right, this was the cause of all problems.

Turns out you can ether write it like this:

X[#2+1]

or
#20=#2+1
X#20


After I rewrote the code using expression all worked fine. I also checkked the manual again & indeed, it does not say that you can not write code like I tried above.

So yes this is something to keep in mind when writing a macro.
For movement commands like G0X[#2+.1] you have to have in brackets. If you are just setting a variable you do not have to have the brackets.

G0X#2+.1----incorrect
G0X[#2+.1]----correct

#20=#2+1----correct
#20=[#2+1]----also correct

Stevo

(The opinions in this post are my own and not those of machinetoolhelp.com and its management)

Last edited by Stevo; 01-13-12 at 01:27 PM. Reason: sntax error
Reply With Quote
  #10 (permalink)  
Old 01-15-12, 09:46 PM
Senior CNC Specialist
 
Join Date: Mar 2010
Posts: 154
Thanks: 0
Thanked 16 Times in 15 Posts
Default Re: My first custom macro Error 004

Do not hesitate in making fair use of brackets. Unnecessary brackets do not hurt. However, nesting of brackets is permitted up to a maximum of five levels, i.e., five left and five right nested brackets can be used. There is, however, no limitation on the total number of brackets in an expression; you can have nesting at several places in the same expression.
Reply With Quote
  #11 (permalink)  
Old 01-16-12, 03:58 AM
CNC Tech
 
Join Date: Jan 2012
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
Default Re: My first custom macro Error 004

I wanted to post the full code earlier, but I found some issues with the description, so I made some modifications.

I also made myself a printabe doc file, so if anyone wants it, then its attached.

Its office 97 doc file. Also the table has 2 columns so u can just copy paste the code

NB! This macro was written & tested under FANUC Series oi-TB. So use this code at your own responsibility, meaning you check it first, then run it as the graph in your machine, then set the zero point of the detail very far away from the potentional crashing area. Run the Program 1 step at the time without fluid. Always be ready to hit the BIG RED BUTTON!

Attached Files
File Type: doc Macro call + program.doc (29.5 KB, 6 views)


Last edited by Guren; 01-16-12 at 04:00 AM.
Reply With Quote
The Following User Says Thank You to Guren For This Useful Post:
MMMMM (01-16-12)
  #12 (permalink)  
Old 01-22-12, 11:57 AM
CNC Tech
 
Join Date: Jan 2012
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
Default Re: My first custom macro Error 004

I can not find the edit button so im posting new reply.

I was going through the documentation today & noticed an important screw-up. When I ran this macro in the machine, I saw this & fixed it, but lather I thought I also fixed it in the documentation.

It appears not to be the case.

If you run this in the graph mode you will see weird behavior, but I will point this out, just in case anyway.

So if detail length is 10 millimeters & insert width is 3 mm, then we want to move our tool at the G0 speed, to the z-13. position & then start cutting it off.

So we set parameter B to B-13

But the code will move the tool to B-16 instead, and if your Z-13 position is very close the the chunks it might crash into the chunks.

This #2=#2-3 (line) should be removed from the macro. Its a part from the old macro. see the image.


Reply With Quote
  #13 (permalink)  
Old 01-28-12, 03:48 PM
Senior CNC Specialist
 
Join Date: Jan 2012
Posts: 172
Thanks: 0
Thanked 23 Times in 20 Posts
Default Re: My first custom macro Error 004

Guren,
1. In your code shown in the attached picture below, the two blocks enclosed in the first Red rectangle is the calculation and move for the first X cut of part off. If the tool offset for the tool is correct, and as this calculation is the hole diameter - 0.2, why would the part not be severed from the base material by the X feed block and before the parts catcher is called? Should the calculation not be #21 = #3 + 0.2 ?
2. Its common practice when parting off, that one never assumes that the part has been severed from the base part, and therefore, the tool should always be cleared of the work in the X axis first. In most cases, the work-piece will be gone; accordingly, the small Z+ move shown in the second Red rectangle will clear the negative side of the parting tool of the face of the base material. However, if the workpiece is still attached, your Z+ move will cause the tool to rub on the Z+ side of the parting tool. I would simply delete that line and withdraw the tool in the X axis.

Regards,

Bill
My first custom macro Error 004-macro1.jpg

Last edited by angelw; 01-28-12 at 03:51 PM.
Reply With Quote
  #14 (permalink)  
Old 02-06-12, 08:28 AM
CNC Tech
 
Join Date: Jan 2012
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
Default Re: My first custom macro Error 004

Quote:
Originally Posted by angelw View Post
Guren,
Should the calculation not be #21 = #3 + 0.2 ?

Sorry for not answering this earlier, my machine broke & I was really busy repairing it. Rest assured, it was not because i was screwing around with those macros ^ ^! Some bolts inside of the spindle broke & inflicted load damage, I had to make a new tube & after I assembled all, it turned out the tube didnt fit into the machine, because the thread was too big, so the thread had to be modified, (Yes we have a pro who was able to pull this off, it was real magic he performed, since the tube was more like 0 shaped & not round) in the end the thread was remade 3 times before it fit in... & 1. spare part didnt fit ether, so it had to be modified also. A lot pain in the neck.

Finished repairs today, all seems to be working

To your questions:

1)

The last 1 millimeter is being cut with extremely low feedrate F0.04, there is a good reason for it.
Im using neutral inserts for cutting off:

As result, burrs are formed (see the image below), removing those burrs are easy as long as the insert is not worn off. But, with the time, the insert will start wearing off, and the more it wears off the more difficult it is to remove those burrs.


I had cases where I was doing 800 details per day & removing those burrs was real work out. I had to input 70% of all my strength to remove burrs on 1 single detail. Now multiply this by 800 times.

I tested several feeds, F0.05 - F0.12, but with F0.04, those burrs were the easiest to remove.

From my experience, I would say, it will fall off around (#3 -0.2 -0.7)

So if the hole diameter is 20 mm, it will fall off in around 19.1 mm, but it may not, so just to be safe we cut until (20 -1.2 = 18.8)


You can of course cut until (#21 =#3) & then with low feedrate until (#21 = #21 -1.2), but then you will be cutting additional 0.2mm with extreme low feedrate. Basically i wanted to minimize the distance being cut with the low feedrate to a minimum, yet keep it universal, so I can use it with any type of work/material/hole.



2) G0 Z[#2+0.2]

I used to move the tool away like this;

Cut it off then G0 X150 Z150

But then I had a case where the detail was not cut off. And the tool moved away & ripped the detail away from the material. It also damaged my tool once. Then I tried to move the tool away like this, straight top then right:

G0 X150
Z150

But this was causing the tool to rub, so I figured Ill do it like this to avoid crashing & insert rubbing:

G0 Z[#2+0.2]
X150
Z150

So if the detail was not cut off, bad things, wont happen & it will simply rub the right side of the tool while moving away. Of course we need to consider a possibility where we are cutting off several details from 1 long workpiece, by moving the detail Zero point to the left (G55 G56 G57 etc...), if the detail isnt cut off hire, it will crash real bad.

But for this case we have the Parameter H.


Another reason for the parameter H, is that, I also Drill the holes & then cut off the details. I use different Drills (Drills with inserts & normal drills.) So, sometimes I need to cut deeper & H comes really handy in those cases.

But then again you are right, this is why we have parameter H, guess ill just need to ensure that H is set deep enough.


As a side note.


I found a way to make details faster by just putting tool change on the same line as changing the spindle speed, but if used with CSS, tool movements, get dangerous & unpredictable, but those issues can be bypassed, so I will be re writting the beginning of the macro. And the last part you recommended also.

But first I have a question.

Before I move the tool to the cut off position I set the spindle speed to the speed it will have when I turn on the CSS.

Im wondering if there is any point adding this spindle speed as a separate parameter or should i just set one never changing speed? I will make 2 samples:

Sample 1 (mat diameter in this sample is 50, so we move tool to X52)

Hire we turn on the CSS, after we have moved to pos X52, the spindle speed will be 612rpm (But I already pre calculated this so spindle speed is set to 612 before I start moving the tool)

N1 G97 T0101 S612 M3
G50 S1200
G0 X52 Z-15
G96 S100

Sample 2 (but we want an universal macro, hire the detail diameter is 23) So we move the tool to X25. At point X25, the Spindle speed will not be 900, but should I care? what if I set spindle speed to S900 & will never change it.(so I wont have to add a new parameter & calc this speed every time) So at this point the spindle will increase speed to 1273, how much time do I loose like this?

N1 G97 T0101 S900 M3
G50 S1200
G0 X32 Z-15
G96 S100

If this confuses you see the thumbnail of the new sample macro. I havent had time to test it in real time tho.
Attached Thumbnails
My first custom macro Error 004-neutral-inserts.jpg   My first custom macro Error 004-untitled.jpg  


Last edited by Guren; 02-06-12 at 08:42 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:04 PM.

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